ret = failsafe_args_parse(dev, params);
if (ret)
goto free_subs;
+ ret = rte_eth_dev_owner_new(&priv->my_owner.id);
+ if (ret) {
+ ERROR("Failed to get unique owner identifier");
+ goto free_args;
+ }
+ snprintf(priv->my_owner.name, sizeof(priv->my_owner.name),
+ FAILSAFE_OWNER_NAME);
ret = failsafe_eal_init(dev);
if (ret)
goto free_args;
INFO("Taking control of a probed sub device"
" %d named %s", i, da->name);
}
+ ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner);
+ if (ret) {
+ INFO("sub_device %d owner set failed (%s),"
+ " will try again later", i, strerror(ret));
+ continue;
+ } else if (strncmp(rte_eth_devices[pid].device->name, da->name,
+ strlen(da->name)) != 0) {
+ /*
+ * The device probably was removed and its port id was
+ * reallocated before ownership set.
+ */
+ rte_eth_dev_owner_unset(pid, PRIV(dev)->my_owner.id);
+ INFO("sub_device %d was probably removed before taking"
+ " ownership, will try again later", i);
+ continue;
+ }
ETH(sdev) = &rte_eth_devices[pid];
SUB_ID(sdev) = i;
sdev->fs_dev = dev;
#include <rte_interrupts.h>
#define FAILSAFE_DRIVER_NAME "Fail-safe PMD"
+#define FAILSAFE_OWNER_NAME "Fail-safe"
#define PMD_FAILSAFE_MAC_KVARG "mac"
#define PMD_FAILSAFE_HOTPLUG_POLL_KVARG "hotplug_poll"
uint32_t mac_addr_pool[FAILSAFE_MAX_ETHADDR];
/* current capabilities */
struct rte_eth_dev_info infos;
+ struct rte_eth_dev_owner my_owner; /* Unique owner. */
struct rte_intr_handle intr_handle; /* Port interrupt handle. */
/*
* Fail-safe state machine.