net/failsafe: fix state synchro cleanup

During a hotplug attempt, failsafe will try to bring a subdevice that
just appeared to its internal state. On error, the subdevice is marked
for removal and will be cleaned up.

However failsafe_dev_remove() only remove active devices. Devices that
failed during probe will be stuck in DEV_PARSED state repeatedly.

Consider all devices when doing a removal round, but limit burst control
and stats saving to active devices.

Fixes: 598fb8aec6 ("net/failsafe: support device removal")
Cc: stable@dpdk.org

Signed-off-by: Gaetan Rivet <grive@u256.net>
This commit is contained in:
Gaetan Rivet 2020-10-12 16:19:04 +02:00 committed by Ferruh Yigit
parent ee7a8fafba
commit 352074b3a4

View File

@ -383,14 +383,23 @@ failsafe_dev_remove(struct rte_eth_dev *dev)
struct sub_device *sdev;
uint8_t i;
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
if (sdev->remove && fs_rxtx_clean(sdev)) {
if (fs_lock(dev, 1) != 0)
return;
FOREACH_SUBDEV(sdev, i, dev) {
if (!sdev->remove)
continue;
/* Active devices must have finished their burst and
* their stats must be saved.
*/
if (sdev->state >= DEV_ACTIVE &&
fs_rxtx_clean(sdev) == 0)
continue;
if (fs_lock(dev, 1) != 0)
return;
if (sdev->state >= DEV_ACTIVE)
fs_dev_stats_save(sdev);
fs_dev_remove(sdev);
fs_unlock(dev, 1);
}
fs_dev_remove(sdev);
fs_unlock(dev, 1);
}
}
static int