The corrupted code couldn't recognize that all sub devices
were not ready for Tx traffic when failsafe PMD was trying
to switch device because of an unreachable condition using.
Hence, the current Tx sub device variable was not updated
correctly.
The fix removed the unreachable branch and added new one
in the right place respecting the original intent.
Fixes:
ebea83f899d8 ("net/failsafe: add plug-in support")
Fixes:
598fb8aec6f6 ("net/failsafe: support device removal")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
} else if ((txd && txd->state < req_state) ||
txd == NULL ||
txd == banned) {
- struct sub_device *sdev;
+ struct sub_device *sdev = NULL;
uint8_t i;
/* Using acceptable device */
PRIV(dev)->subs_tx = i;
break;
}
- } else if (txd && txd->state < req_state) {
- DEBUG("No device ready, deactivating tx_dev");
- PRIV(dev)->subs_tx = PRIV(dev)->subs_tail;
+ if (i >= PRIV(dev)->subs_tail || sdev == NULL) {
+ DEBUG("No device ready, deactivating tx_dev");
+ PRIV(dev)->subs_tx = PRIV(dev)->subs_tail;
+ }
} else {
return;
}