net/failsafe: fix Rx clean race

When removing a device, the fail-safe checks that it is not within its
datapath before cleaning it.

When checking whether an Rx burst should be performed on a device, the
remove flag is not checked. Thus the port could still enter its datapath
and miss a removal round. Furthermore, there is a race between the
thread removing the device and the polling thread.

Check the remove flag before entering a sub-device Rx burst when in safe
mode. This check mitigates the aforementioned race condition.

Fixes: 72a57bfd9a ("net/failsafe: add fast burst functions")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
This commit is contained in:
Matan Azrad 2017-10-22 05:51:08 +00:00 committed by Ferruh Yigit
parent 1f148d8eaf
commit 295f7ed2dd

View File

@ -43,7 +43,8 @@ fs_rx_unsafe(struct sub_device *sdev)
{
return (ETH(sdev) == NULL) ||
(ETH(sdev)->rx_pkt_burst == NULL) ||
(sdev->state != DEV_STARTED);
(sdev->state != DEV_STARTED) ||
(sdev->remove != 0);
}
static inline int