NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
devemu_vfs_device_hotplug_unplug_sample.c File Reference
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <doca_ctx.h>
#include <doca_devemu_pci.h>
#include <doca_dev.h>
#include <doca_error.h>
#include <doca_log.h>
#include <doca_devemu_vfs_type.h>
#include <doca_devemu_vfs.h>
Include dependency graph for devemu_vfs_device_hotplug_unplug_sample.c:

Go to the source code of this file.

Data Structures

struct  program_state
 

Macros

#define SLEEP_IN_MICROS   (10) /* Sample the task every 10 microseconds */
 
#define SLEEP_IN_NANOS   (SLEEP_IN_MICROS * 1000)
 
#define TIMEOUT_IN_MICROS   (5 * 1000 * 1000) /* Set timeout to 5 seconds */
 
#define VFS_DEVICE_QUEUE_SIZE   64
 
#define VFS_DEVICE_NUM_QUEUES   16
 

Functions

 DOCA_LOG_REGISTER (DPU_DEVEMU_VFS_DEVICE_CREATE)
 
static void signal_handler (int signum)
 
static void state_cleanup (struct program_state *state)
 
static bool device_has_pci_addr (const struct doca_devinfo *devinfo, const char *pci_address)
 
static doca_error_t find_doca_device (const char *pci_address, struct doca_dev **dev)
 
static void hotplug_event_handler_cb (struct doca_devemu_pci_dev *pci_dev, union doca_data user_data)
 
static doca_error_t register_to_hotplug_state_change_events (struct doca_devemu_pci_dev *pci_dev, void *cookie)
 
doca_error_t devemu_vfs_device_create (const char *pci_address)
 

Variables

static const char tag [DOCA_VFS_TAG_SIZE+1] = "virtiofs-sample-tag"
 
static bool unplug_requested
 

Macro Definition Documentation

◆ SLEEP_IN_MICROS

#define SLEEP_IN_MICROS   (10) /* Sample the task every 10 microseconds */

Definition at line 43 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ SLEEP_IN_NANOS

#define SLEEP_IN_NANOS   (SLEEP_IN_MICROS * 1000)

Definition at line 44 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ TIMEOUT_IN_MICROS

#define TIMEOUT_IN_MICROS   (5 * 1000 * 1000) /* Set timeout to 5 seconds */

Definition at line 45 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ VFS_DEVICE_NUM_QUEUES

#define VFS_DEVICE_NUM_QUEUES   16

Definition at line 48 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ VFS_DEVICE_QUEUE_SIZE

#define VFS_DEVICE_QUEUE_SIZE   64

Definition at line 47 of file devemu_vfs_device_hotplug_unplug_sample.c.

Function Documentation

◆ devemu_vfs_device_create()

doca_error_t devemu_vfs_device_create ( const char *  pci_address)

Definition at line 252 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ device_has_pci_addr()

static bool device_has_pci_addr ( const struct doca_devinfo *  devinfo,
const char *  pci_address 
)
static

Definition at line 130 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( DPU_DEVEMU_VFS_DEVICE_CREATE  )

◆ find_doca_device()

static doca_error_t find_doca_device ( const char *  pci_address,
struct doca_dev **  dev 
)
static

Definition at line 147 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ hotplug_event_handler_cb()

static void hotplug_event_handler_cb ( struct doca_devemu_pci_dev *  pci_dev,
union doca_data  user_data 
)
static

Definition at line 187 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ register_to_hotplug_state_change_events()

static doca_error_t register_to_hotplug_state_change_events ( struct doca_devemu_pci_dev *  pci_dev,
void *  cookie 
)
static

Definition at line 230 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ signal_handler()

static void signal_handler ( int  signum)
static

Definition at line 68 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ state_cleanup()

static void state_cleanup ( struct program_state state)
static

Definition at line 81 of file devemu_vfs_device_hotplug_unplug_sample.c.

Variable Documentation

◆ tag

const char tag[DOCA_VFS_TAG_SIZE+1] = "virtiofs-sample-tag"
static

Definition at line 50 of file devemu_vfs_device_hotplug_unplug_sample.c.

◆ unplug_requested

bool unplug_requested
static

Definition at line 61 of file devemu_vfs_device_hotplug_unplug_sample.c.