summaryrefslogtreecommitdiff
path: root/drivers/net/failsafe/failsafe_eal.c
diff options
context:
space:
mode:
authorMatan Azrad <matan@mellanox.com>2018-01-22 16:38:22 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-01-31 20:49:42 +0100
commitdcd0c9c32b8d6c360af1fc8ff2f92bb713faae8e (patch)
treecac3a97dac3142cfdf6e9337872b55ddb0df2d8c /drivers/net/failsafe/failsafe_eal.c
parentfac0ae546e5f205bf08f9f0f530ccd0c28271c6e (diff)
downloaddpdk-next-eventdev-dcd0c9c32b8d6c360af1fc8ff2f92bb713faae8e.zip
dpdk-next-eventdev-dcd0c9c32b8d6c360af1fc8ff2f92bb713faae8e.tar.gz
dpdk-next-eventdev-dcd0c9c32b8d6c360af1fc8ff2f92bb713faae8e.tar.xz
net/failsafe: use ownership mechanism for slaves
Fail-safe PMD sub devices management is based on ethdev port mechanism. So, the sub-devices management structures are exposed to other DPDK entities which may use them in parallel to fail-safe PMD. Use the new port ownership mechanism to avoid multiple managments of fail-safe PMD sub-devices. Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Diffstat (limited to 'drivers/net/failsafe/failsafe_eal.c')
-rw-r--r--drivers/net/failsafe/failsafe_eal.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 33a5adf..3994661 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -106,6 +106,22 @@ fs_bus_init(struct rte_eth_dev *dev)
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;