diff options
author | Gaetan Rivet <gaetan.rivet@6wind.com> | 2017-07-18 14:48:15 +0200 |
---|---|---|
committer | Ferruh Yigit <ferruh.yigit@intel.com> | 2017-07-19 16:25:42 +0300 |
commit | ebea83f899d8739e7143209e7575aa97f4f3ab08 (patch) | |
tree | 6662e2aa8be1e629188f32d5069230966e3dff01 /drivers/net/failsafe/failsafe_eal.c | |
parent | a46f8d584eb88feb2a05ca3459d4a00b7d7654aa (diff) | |
download | dpdk-next-eventdev-ebea83f899d8739e7143209e7575aa97f4f3ab08.zip dpdk-next-eventdev-ebea83f899d8739e7143209e7575aa97f4f3ab08.tar.gz dpdk-next-eventdev-ebea83f899d8739e7143209e7575aa97f4f3ab08.tar.xz |
net/failsafe: add plug-in support
Periodically check for the existence of a device.
If a device has not been initialized and exists on the system, then it
is probed and configured.
The configuration process strives to synchronize the states between the
plugged-in sub-device and the fail-safe device.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
Diffstat (limited to 'drivers/net/failsafe/failsafe_eal.c')
-rw-r--r-- | drivers/net/failsafe/failsafe_eal.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c index a74edea..8a3836c 100644 --- a/drivers/net/failsafe/failsafe_eal.c +++ b/drivers/net/failsafe/failsafe_eal.c @@ -72,37 +72,14 @@ fs_bus_init(struct rte_eth_dev *dev) int failsafe_eal_init(struct rte_eth_dev *dev) { - struct sub_device *sdev; - uint8_t i; int ret; ret = fs_bus_init(dev); if (ret) return ret; - /* - * We only update TX_SUBDEV if we are not started. - * If a sub_device is emitting, we will switch the TX_SUBDEV to the - * preferred port only upon starting it, so that the switch is smoother. - */ - if (PREFERRED_SUBDEV(dev)->state >= DEV_PROBED) { - if (TX_SUBDEV(dev) != PREFERRED_SUBDEV(dev) && - (TX_SUBDEV(dev) == NULL || - (TX_SUBDEV(dev) && TX_SUBDEV(dev)->state < DEV_STARTED))) { - DEBUG("Switching tx_dev to preferred sub_device"); - PRIV(dev)->subs_tx = 0; - } - } else { - if ((TX_SUBDEV(dev) && TX_SUBDEV(dev)->state < DEV_PROBED) || - TX_SUBDEV(dev) == NULL) { - /* Using first probed device */ - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { - DEBUG("Switching tx_dev to sub_device %d", - i); - PRIV(dev)->subs_tx = i; - break; - } - } - } + if (PRIV(dev)->state < DEV_PROBED) + PRIV(dev)->state = DEV_PROBED; + fs_switch_dev(dev); return 0; } @@ -134,5 +111,6 @@ failsafe_eal_uninit(struct rte_eth_dev *dev) ret = fs_bus_uninit(dev); if (ret) return ret; + PRIV(dev)->state = DEV_PROBED - 1; return 0; } |