51 if (signum == SIGINT || signum == SIGTERM) {
52 DOCA_LOG_INFO(
"Signal %d received, preparing to exit", signum);
100 DOCA_LOG_ERR(
"Unable to allocate emulated PCI device hotplug state change event : %s",
119 struct timespec ts = {
125 bool destroy_rep =
false;
163 if (unplug_vuid !=
NULL) {
167 DOCA_LOG_ERR(
"Unable to find PCI emulated device representor: %s",
176 DOCA_LOG_ERR(
"Unable to create PCI emulated device representor: %s",
222 DOCA_LOG_INFO(
"Current hotplug state of emulated device is %s",
225 if (unplug_vuid !=
NULL) {
228 DOCA_LOG_INFO(
"Hotunplug initiated waiting for host to release device");
232 DOCA_LOG_INFO(
"Hotplug initiated waiting for host to notice new device");
void devemu_resources_cleanup(struct devemu_resources *resources, bool destroy_rep)
static doca_error_t register_to_hotplug_state_change_events(struct doca_devemu_pci_dev *pci_dev, void *cookie)
doca_error_t devemu_pci_device_hotplug(const char *pci_address, const char *unplug_vuid)
DOCA_LOG_REGISTER(DPU_DEVEMU_PCI_DEVICE_HOTPLUG)
static void hotplug_event_handler_cb(struct doca_devemu_pci_dev *pci_dev, union doca_data user_data)
static void signal_handler(int signum)
struct rdma_resources resources
DOCA_STABLE doca_error_t doca_ctx_start(struct doca_ctx *ctx)
Finalizes all configurations, and starts the DOCA CTX.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_create_rep(const struct doca_devemu_pci_type *pci_type, struct doca_dev_rep **dev_rep)
Create a new representor device for a given 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.
#define DOCA_DEVEMU_PCI_TYPE_NAME_LEN
Maximal length for the NULL terminated string that describe the name of the emulated PCI device 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_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_hotplug(struct doca_devemu_pci_dev *pci_dev)
Issue hotplug procedure of the DOCA devemu PCI device.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_get_hotplug_state(struct doca_devemu_pci_dev *pci_dev, enum doca_devemu_pci_hotplug_state *state)
Get the hotplug state of the DOCA devemu PCI device.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_create(struct doca_devemu_pci_type *pci_type, struct doca_dev_rep *dev_rep, struct doca_pe *progress_engine, struct doca_devemu_pci_dev **pci_dev)
Allocate DOCA devemu PCI device.
doca_devemu_pci_hotplug_state
DOCA devemu pci hotplug state.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_event_hotplug_state_change_register(struct doca_devemu_pci_dev *pci_dev, doca_devemu_pci_dev_event_hotplug_state_change_handler_cb_t handler, union doca_data user_data)
Register to hotplug state changes.
DOCA_EXPERIMENTAL struct doca_ctx * doca_devemu_pci_dev_as_ctx(struct doca_devemu_pci_dev *pci_dev)
Convert DOCA devemu PCI device instance into DOCA context.
DOCA_EXPERIMENTAL doca_error_t doca_devemu_pci_dev_hotunplug(struct doca_devemu_pci_dev *pci_dev)
Issue hot unplug procedure of the DOCA devemu PCI device.
@ DOCA_DEVEMU_PCI_HP_STATE_POWER_OFF
@ DOCA_DEVEMU_PCI_HP_STATE_POWER_ON
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.
#define DOCA_DEVINFO_REP_VUID_SIZE
Buffer size to hold VUID. Including a null terminator.
DOCA_STABLE struct doca_devinfo_rep * doca_dev_rep_as_devinfo(struct doca_dev_rep *dev_rep)
Get representor device info from device. This should be useful when wanting to query information abou...
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_name(doca_error_t error)
Returns the string representation of an error code name.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
DOCA_STABLE uint8_t doca_pe_progress(struct doca_pe *pe)
Run the progress engine.
DOCA_STABLE doca_error_t doca_pe_create(struct doca_pe **pe)
Creates DOCA progress engine.
doca_error_t configure_and_start_pci_type(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)
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)
struct doca_devemu_pci_dev * pci_dev
enum doca_devemu_pci_hotplug_state hotplug_state
Convenience type for representing opaque data.