NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
nvme_pci_common.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #include "nvme_pci_common.h"
27 
28 #include <doca_dev.h>
29 
30 DOCA_LOG_REGISTER(NVME_PCI_COMMON);
31 
32 doca_error_t find_supported_device(const char *dev_name,
33  const struct doca_devemu_pci_type *pci_type,
34  emulation_supported_cb_t has_support,
35  struct doca_dev **dev)
36 {
37  struct doca_devinfo **dev_list;
38  uint32_t nb_devs;
39  doca_error_t res;
40  size_t i;
41  uint8_t is_supported;
42  char ibdev_name[DOCA_DEVINFO_IBDEV_NAME_SIZE] = {0};
43 
44  /* Set default return value */
45  *dev = NULL;
46 
47  res = doca_devinfo_create_list(&dev_list, &nb_devs);
48  if (res != DOCA_SUCCESS) {
49  DOCA_LOG_ERR("Failed to load doca devices list: %s", doca_error_get_descr(res));
50  return res;
51  }
52 
53  /* Search */
54  for (i = 0; i < nb_devs; i++) {
55  res = doca_devinfo_get_ibdev_name(dev_list[i], ibdev_name, sizeof(ibdev_name));
56  if (res != DOCA_SUCCESS) {
57  DOCA_LOG_ERR("Failed to get ibdev name for device: %s", doca_error_get_descr(res));
58  doca_devinfo_destroy_list(dev_list);
59  return res;
60  }
61 
62  if (strncmp(dev_name, ibdev_name, DOCA_DEVINFO_IBDEV_NAME_SIZE) == 0) {
63  res = has_support(dev_list[i], pci_type, &is_supported);
64  if (res != DOCA_SUCCESS) {
65  DOCA_LOG_ERR("Failed to check the support capability: %s", doca_error_get_descr(res));
66  doca_devinfo_destroy_list(dev_list);
67  return res;
68  }
69 
70  if (is_supported == 0) {
72  "Device doesn't support the hot plug capability. Make sure a physical function was provided, and running with root permission");
73  doca_devinfo_destroy_list(dev_list);
75  }
76 
77  res = doca_dev_open(dev_list[i], dev);
78  if (res != DOCA_SUCCESS) {
79  doca_devinfo_destroy_list(dev_list);
80  DOCA_LOG_ERR("Failed to open DOCA device: %s", doca_error_get_descr(res));
81  return res;
82  }
83 
84  doca_devinfo_destroy_list(dev_list);
85  return DOCA_SUCCESS;
86  }
87  }
88 
89  DOCA_LOG_WARN("Matching device not found");
90 
91  doca_devinfo_destroy_list(dev_list);
92  return DOCA_ERROR_NOT_FOUND;
93 }
94 
95 doca_error_t find_emulated_device(struct doca_devemu_pci_type *pci_type, const char *vuid, struct doca_dev_rep **rep)
96 {
97  struct doca_devinfo_rep **rep_list;
98  uint32_t nb_devs;
99  uint32_t dev_idx;
100  char actual_vuid[DOCA_DEVINFO_REP_VUID_SIZE];
101  doca_error_t res;
102 
103  res = doca_devemu_pci_type_create_rep_list(pci_type, &rep_list, &nb_devs);
104  if (res != DOCA_SUCCESS) {
105  DOCA_LOG_ERR("Unable to create list of emulated devices: %s", doca_error_get_descr(res));
106  return res;
107  }
108 
109  /* Search */
110  for (dev_idx = 0; dev_idx < nb_devs; ++dev_idx) {
111  res = doca_devinfo_rep_get_vuid(rep_list[dev_idx], actual_vuid, DOCA_DEVINFO_REP_VUID_SIZE);
112  if (res != DOCA_SUCCESS || strncmp(actual_vuid, vuid, DOCA_DEVINFO_REP_VUID_SIZE) != 0)
113  continue;
114 
115  res = doca_dev_rep_open(rep_list[dev_idx], rep);
117  if (res != DOCA_SUCCESS) {
118  DOCA_LOG_ERR("Failed to open DOCA device: %s", doca_error_get_descr(res));
119  return res;
120  }
121  return DOCA_SUCCESS;
122  }
123 
124  DOCA_LOG_ERR("Matching emulated device not found");
125 
127  return DOCA_ERROR_NOT_FOUND;
128 }
129 
130 /*
131  * Sets the PCI configurations of the type
132  * Once device is hotplugged the configurations will be visible to the Host as part of the
133  * PCI configuration space of that device
134  *
135  * @pci_type [in]: The emulated PCI type
136  * @dev [in]: The device that manages the PCI type
137  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
138  */
139 static doca_error_t set_pci_type_configurations(struct doca_devemu_pci_type *pci_type, struct doca_dev *dev)
140 {
141  const struct bar_memory_layout_config *layout_config;
142  const struct bar_db_region_config *db_config;
143  const struct bar_region_config *region_config;
144  int idx;
145  doca_error_t res;
146 
147  res = doca_devemu_pci_type_set_dev(pci_type, dev);
148  if (res != DOCA_SUCCESS) {
149  DOCA_LOG_ERR("Unable to set device for PCI type: %s", doca_error_get_descr(res));
150  return res;
151  }
152 
154  if (res != DOCA_SUCCESS) {
155  DOCA_LOG_ERR("Unable to set device ID for PCI type: %s", doca_error_get_descr(res));
156  return res;
157  }
158 
160  if (res != DOCA_SUCCESS) {
161  DOCA_LOG_ERR("Unable to set vendor ID for PCI type: %s", doca_error_get_descr(res));
162  return res;
163  }
164 
166  if (res != DOCA_SUCCESS) {
167  DOCA_LOG_ERR("Unable to set subsystem ID for PCI type: %s", doca_error_get_descr(res));
168  return res;
169  }
170 
172  if (res != DOCA_SUCCESS) {
173  DOCA_LOG_ERR("Unable to set subsystem vendor ID for PCI type: %s", doca_error_get_descr(res));
174  return res;
175  }
176 
178  if (res != DOCA_SUCCESS) {
179  DOCA_LOG_ERR("Unable to set revision ID for PCI type: %s", doca_error_get_descr(res));
180  return res;
181  }
182 
184  if (res != DOCA_SUCCESS) {
185  DOCA_LOG_ERR("Unable to set class code for PCI type: %s", doca_error_get_descr(res));
186  return res;
187  }
188 
190  if (res != DOCA_SUCCESS) {
191  DOCA_LOG_ERR("Unable to set number of MSI-X for PCI type: %s", doca_error_get_descr(res));
192  return res;
193  }
194 
195  for (idx = 0; idx < PCI_TYPE_NUM_BAR_MEMORY_LAYOUT; ++idx) {
196  layout_config = &layout_configs[idx];
198  layout_config->bar_id,
199  layout_config->log_size,
200  layout_config->memory_type,
201  layout_config->prefetchable);
202  if (res != DOCA_SUCCESS) {
203  DOCA_LOG_ERR("Unable to set layout at index %d: %s", idx, doca_error_get_descr(res));
204  return res;
205  }
206  }
207 
208  for (idx = 0; idx < PCI_TYPE_NUM_BAR_DB_REGIONS; ++idx) {
209  db_config = &db_configs[idx];
210  if (db_config->with_data)
212  db_config->region.bar_id,
213  db_config->region.start_address,
214  db_config->region.size,
215  db_config->log_db_size,
216  db_config->db_id_msbyte,
217  db_config->db_id_lsbyte);
218  else
220  db_config->region.bar_id,
221  db_config->region.start_address,
222  db_config->region.size,
223  db_config->log_db_size,
224  db_config->log_db_stride_size);
225  if (res != DOCA_SUCCESS) {
226  DOCA_LOG_ERR("Unable to set DB region at index %d: %s", idx, doca_error_get_descr(res));
227  return res;
228  }
229  }
230 
231  for (idx = 0; idx < PCI_TYPE_NUM_BAR_MSIX_TABLE_REGIONS; ++idx) {
232  region_config = &msix_table_configs[idx];
234  region_config->bar_id,
235  region_config->start_address,
236  region_config->size);
237  if (res != DOCA_SUCCESS) {
238  DOCA_LOG_ERR("Unable to set MSI-X table region at index %d: %s",
239  idx,
240  doca_error_get_descr(res));
241  return res;
242  }
243  }
244 
245  for (idx = 0; idx < PCI_TYPE_NUM_BAR_MSIX_PBA_REGIONS; ++idx) {
246  region_config = &msix_pba_configs[idx];
248  region_config->bar_id,
249  region_config->start_address,
250  region_config->size);
251  if (res != DOCA_SUCCESS) {
252  DOCA_LOG_ERR("Unable to set MSI-X pending bit array region at index %d: %s",
253  idx,
254  doca_error_get_descr(res));
255  return res;
256  }
257  }
258 
259  for (idx = 0; idx < PCI_TYPE_NUM_BAR_STATEFUL_REGIONS; ++idx) {
260  region_config = &stateful_configs[idx];
262  region_config->bar_id,
263  region_config->start_address,
264  region_config->size);
265  if (res != DOCA_SUCCESS) {
266  DOCA_LOG_ERR("Unable to set Stateful region at index %d: %s", idx, doca_error_get_descr(res));
267  return res;
268  }
269  }
270 
271  return DOCA_SUCCESS;
272 }
273 
274 doca_error_t configure_and_start_pci_type(struct doca_devemu_pci_type *pci_type, struct doca_dev *dev)
275 {
277 
278  result = set_pci_type_configurations(pci_type, dev);
279  if (result != DOCA_SUCCESS)
280  return result;
281 
283  if (result != DOCA_SUCCESS) {
284  DOCA_LOG_ERR("Unable to start PCI type: %s", doca_error_get_descr(result));
285  return result;
286  }
287 
288  return DOCA_SUCCESS;
289 }
290 
291 doca_error_t create_find_start_pci_type(char *dev_name, struct doca_devemu_pci_type **pci_type, struct doca_dev **dev)
292 {
293  doca_error_t ret;
294 
296  if (ret != DOCA_SUCCESS) {
297  DOCA_LOG_ERR("Failed to create pci type");
298  return ret;
299  }
300 
302 
303  if (ret != DOCA_SUCCESS) {
304  DOCA_LOG_ERR("Failed to find supported device");
305  cleanup_pci_resources(*pci_type, *dev);
306  return ret;
307  }
308 
309  ret = configure_and_start_pci_type(*pci_type, *dev);
310  if (ret != DOCA_SUCCESS) {
311  DOCA_LOG_ERR("Failed to configure and start pci device");
312  cleanup_pci_resources(*pci_type, *dev);
313  return ret;
314  }
315 
316  return DOCA_SUCCESS;
317 }
318 
319 void cleanup_pci_resources(struct doca_devemu_pci_type *pci_type, struct doca_dev *dev)
320 {
321  doca_error_t ret;
322  if (pci_type != NULL) {
323  ret = doca_devemu_pci_type_stop(pci_type);
324  if (ret != DOCA_SUCCESS)
325  DOCA_LOG_ERR("Failed to stop DOCA Emulated PCI Type: %s", doca_error_get_descr(ret));
326 
327  ret = doca_devemu_pci_type_destroy(pci_type);
328  if (ret != DOCA_SUCCESS)
329  DOCA_LOG_ERR("Failed to destroy DOCA Emulated PCI Type: %s", doca_error_get_descr(ret));
330  }
331 
332  if (dev != NULL) {
333  ret = doca_dev_close(dev);
334  if (ret != DOCA_SUCCESS)
335  DOCA_LOG_ERR("Failed to close DOCA device: %s", doca_error_get_descr(ret));
336  }
337 }
338 
340 {
341  switch (hotplug_state) {
343  return "DOCA_DEVEMU_PCI_HP_STATE_POWER_OFF";
345  return "DOCA_DEVEMU_PCI_HP_STATE_UNPLUG_IN_PROGRESS";
347  return "DOCA_DEVEMU_PCI_HP_STATE_PLUG_IN_PROGRESS";
349  return "DOCA_DEVEMU_PCI_HP_STATE_POWER_ON";
350  default:
351  return "UNKNOWN";
352  }
353 }
354 
355 #ifdef SPDK_APP_DEBUG
356 char *hex_dump(const void *data, size_t size)
357 {
358  /*
359  * <offset>: <Hex bytes: 1-8> <Hex bytes: 9-16> <Ascii>
360  * 00000000: 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 66 1234567890abcdef
361  * 8 2 8 * 3 1 8 * 3 1 16 1
362  */
363  const size_t line_size = 8 + 2 + 8 * 3 + 1 + 8 * 3 + 1 + 16 + 1;
364  size_t i, j, r, read_index;
365  size_t num_lines, buffer_size;
366  char *buffer, *write_head;
367  unsigned char cur_char, printable;
368  char ascii_line[17];
369  const unsigned char *input_buffer;
370 
371  /* Allocate a dynamic buffer to hold the full result */
372  num_lines = (size + 16 - 1) / 16;
373  buffer_size = num_lines * line_size + 1;
374  buffer = (char *)malloc(buffer_size);
375  if (buffer == NULL)
376  return NULL;
377  write_head = buffer;
378  input_buffer = data;
379  read_index = 0;
380 
381  for (i = 0; i < num_lines; i++) {
382  /* Offset */
383  snprintf(write_head, buffer_size, "%08lX: ", i * 16);
384  write_head += 8 + 2;
385  buffer_size -= 8 + 2;
386  /* Hex print - 2 chunks of 8 bytes */
387  for (r = 0; r < 2; r++) {
388  for (j = 0; j < 8; j++) {
389  /* If there is content to print */
390  if (read_index < size) {
391  cur_char = input_buffer[read_index++];
392  snprintf(write_head, buffer_size, "%02X ", cur_char);
393  /* Printable chars go "as-is" */
394  if (' ' <= cur_char && cur_char <= '~')
395  printable = cur_char;
396  /* Otherwise, use a '.' */
397  else
398  printable = '.';
399  /* Else, just use spaces */
400  } else {
401  snprintf(write_head, buffer_size, " ");
402  printable = ' ';
403  }
404  ascii_line[r * 8 + j] = printable;
405  write_head += 3;
406  buffer_size -= 3;
407  }
408  /* Spacer between the 2 hex groups */
409  snprintf(write_head, buffer_size, " ");
410  write_head += 1;
411  buffer_size -= 1;
412  }
413  /* Ascii print */
414  ascii_line[16] = '\0';
415  snprintf(write_head, buffer_size, "%s\n", ascii_line);
416  write_head += 16 + 1;
417  buffer_size -= 16 + 1;
418  }
419  /* No need for the last '\n' */
420  write_head[-1] = '\0';
421  return buffer;
422 }
423 #endif // SPDK_APP_DEBUG
#define NULL
Definition: __stddef_null.h:26
int32_t result
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_bar_stateful_region_conf(struct doca_devemu_pci_type *pci_type, uint8_t id, uint64_t start_addr, uint64_t size)
Set a stateful BAR region configuration for a BAR layout in a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_start(struct doca_devemu_pci_type *pci_type)
Start a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_create_rep_list(struct doca_devemu_pci_type *pci_type, struct doca_devinfo_rep ***dev_list_rep, uint32_t *nb_devs_rep)
Create list of available representor devices for a given DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_memory_bar_conf(struct doca_devemu_pci_type *pci_type, uint8_t id, uint8_t log_sz, enum doca_devemu_pci_bar_mem_type memory_type, uint8_t prefetchable)
Set a memory BAR layout configuration for DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_stop(struct doca_devemu_pci_type *pci_type)
Stop a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_class_code(struct doca_devemu_pci_type *pci_type, uint32_t class_code)
Set the PCI Class Code of a DOCA devemu PCI type to identify generic operation.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_revision_id(struct doca_devemu_pci_type *pci_type, uint8_t revision_id)
Set the PCI Revision ID of a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_device_id(struct doca_devemu_pci_type *pci_type, uint16_t device_id)
Set the PCI Device ID of a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_bar_db_region_by_offset_conf(struct doca_devemu_pci_type *pci_type, uint8_t id, uint64_t start_addr, uint64_t size, uint8_t log_db_size, uint8_t log_stride_size)
Set a doorbell BAR region configuration for a BAR layout in a DOCA devemu PCI type....
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_create(const char *name, struct doca_devemu_pci_type **pci_type)
Create a stopped DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_vendor_id(struct doca_devemu_pci_type *pci_type, uint16_t vendor_id)
Set the PCI Vendor ID of a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_bar_db_region_by_data_conf(struct doca_devemu_pci_type *pci_type, uint8_t id, uint64_t start_addr, uint64_t size, uint8_t log_db_size, uint16_t db_id_msbyte, uint16_t db_id_lsbyte)
Set a doorbell BAR region configuration for a BAR layout in a DOCA devemu PCI type....
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_num_msix(struct doca_devemu_pci_type *pci_type, uint16_t num_msix)
Set the size of the MSI-X Table from MSI-X Capability Registers (1 based) of a DOCA devemu PCI type....
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_subsystem_id(struct doca_devemu_pci_type *pci_type, uint16_t subsystem_id)
Set the PCI Subsystem ID of a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_destroy(struct doca_devemu_pci_type *pci_type)
Destroy a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_subsystem_vendor_id(struct doca_devemu_pci_type *pci_type, uint16_t subsystem_vid)
Set the PCI Subsystem Vendor ID of a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_bar_msix_pba_region_conf(struct doca_devemu_pci_type *pci_type, uint8_t id, uint64_t start_addr, uint64_t size)
Set a MSI-X PBA BAR region configuration for a BAR layout in a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_dev(struct doca_devemu_pci_type *pci_type, struct doca_dev *dev)
Set the DOCA device for a specific DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_type_set_bar_msix_table_region_conf(struct doca_devemu_pci_type *pci_type, uint8_t id, uint64_t start_addr, uint64_t size)
Set a MSI-X table BAR region configuration for a BAR layout in a DOCA devemu PCI type.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_cap_type_is_hotplug_supported(const struct doca_devinfo *devinfo, const struct doca_devemu_pci_type *pci_type, uint8_t *supported)
Get the hotplug capability of the device for a given DOCA devemu PCI type.
doca_devemu_pci_hotplug_state
DOCA devemu pci hotplug state.
@ DOCA_DEVEMU_PCI_HP_STATE_POWER_OFF
@ DOCA_DEVEMU_PCI_HP_STATE_UNPLUG_IN_PROGRESS
@ DOCA_DEVEMU_PCI_HP_STATE_PLUG_IN_PROGRESS
@ DOCA_DEVEMU_PCI_HP_STATE_POWER_ON
DOCA_STABLE doca_error_t doca_dev_rep_open(struct doca_devinfo_rep *devinfo, struct doca_dev_rep **dev_rep)
Initialize representor device for use.
DOCA_STABLE doca_error_t doca_devinfo_rep_destroy_list(struct doca_devinfo_rep **dev_list_rep)
Destroy list of representor device info structures.
DOCA_STABLE doca_error_t doca_devinfo_create_list(struct doca_devinfo ***dev_list, uint32_t *nb_devs)
Creates list of all available local devices.
DOCA_STABLE doca_error_t doca_devinfo_rep_get_vuid(const struct doca_devinfo_rep *devinfo_rep, char *rep_vuid, uint32_t size)
Get the Vendor Unique ID of a representor DOCA devinfo.
DOCA_STABLE doca_error_t doca_devinfo_get_ibdev_name(const struct doca_devinfo *devinfo, char *ibdev_name, uint32_t size)
Get the name of the IB device represented by a DOCA devinfo.
#define DOCA_DEVINFO_IBDEV_NAME_SIZE
Buffer size to hold Infiniband/RoCE device name. Including a null terminator.
Definition: doca_dev.h:309
#define DOCA_DEVINFO_REP_VUID_SIZE
Buffer size to hold VUID. Including a null terminator.
Definition: doca_dev.h:661
DOCA_STABLE doca_error_t doca_devinfo_destroy_list(struct doca_devinfo **dev_list)
Destroy list of local device info structures.
DOCA_STABLE doca_error_t doca_dev_open(struct doca_devinfo *devinfo, struct doca_dev **dev)
Initialize local device for use.
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_NOT_FOUND
Definition: doca_error.h:54
@ DOCA_ERROR_NOT_SUPPORTED
Definition: doca_error.h:42
@ DOCA_SUCCESS
Definition: doca_error.h:38
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
Definition: doca_log.h:466
#define DOCA_LOG_WARN(format,...)
Generates a WARNING application log message.
Definition: doca_log.h:476
char * hex_dump(const void *data, size_t size)
doca_error_t configure_and_start_pci_type(struct doca_devemu_pci_type *pci_type, struct doca_dev *dev)
void cleanup_pci_resources(struct doca_devemu_pci_type *pci_type, struct doca_dev *dev)
doca_error_t create_find_start_pci_type(char *dev_name, struct doca_devemu_pci_type **pci_type, struct doca_dev **dev)
const char * hotplug_state_to_string(enum doca_devemu_pci_hotplug_state hotplug_state)
static doca_error_t set_pci_type_configurations(struct doca_devemu_pci_type *pci_type, struct doca_dev *dev)
DOCA_LOG_REGISTER(NVME_PCI_COMMON)
doca_error_t find_emulated_device(struct doca_devemu_pci_type *pci_type, const char *vuid, struct doca_dev_rep **rep)
doca_error_t find_supported_device(const char *dev_name, const struct doca_devemu_pci_type *pci_type, emulation_supported_cb_t has_support, struct doca_dev **dev)
doca_error_t(* emulation_supported_cb_t)(const struct doca_devinfo *, const struct doca_devemu_pci_type *pci_type, uint8_t *is_supported)
#define PCI_TYPE_NUM_BAR_MSIX_PBA_REGIONS
#define PCI_TYPE_SUBSYSTEM_VENDOR_ID
#define PCI_TYPE_NUM_BAR_MSIX_TABLE_REGIONS
static const struct bar_memory_layout_config layout_configs[PCI_TYPE_NUM_BAR_MEMORY_LAYOUT]
#define PCI_TYPE_NUM_BAR_MEMORY_LAYOUT
static const struct bar_db_region_config db_configs[PCI_TYPE_NUM_BAR_DB_REGIONS]
#define PCI_TYPE_SUBSYSTEM_ID
#define PCI_TYPE_VENDOR_ID
#define NVME_TYPE_NAME
#define PCI_TYPE_DEVICE_ID
static const struct bar_region_config msix_pba_configs[PCI_TYPE_NUM_BAR_MSIX_PBA_REGIONS]
#define PCI_TYPE_NUM_BAR_DB_REGIONS
#define PCI_TYPE_NUM_BAR_STATEFUL_REGIONS
#define PCI_TYPE_REVISION_ID
static const struct bar_region_config msix_table_configs[PCI_TYPE_NUM_BAR_MSIX_TABLE_REGIONS]
#define PCI_TYPE_CLASS_CODE
static const struct bar_region_config stateful_configs[PCI_TYPE_NUM_BAR_STATEFUL_REGIONS]
#define PCI_TYPE_NUM_MSIX
struct bar_region_config region
enum doca_devemu_pci_bar_mem_type memory_type