net/bonding: fix reset active slave

test_alb_reply_from_client test fails due to incorrect active slave
array's index. This was due to invalid active slave count.

Count of internals->active_slave is not updated even when active slave
is deactivated.
Hence active slave count always keeps incrementing beyond the actual
active slaves.

Fix is to set the internals->active_slave to starting index 0 whenever
it exceeds the number of slaves in active slave list and also update
the active slave count during slave de-activation.

Fixes: e1110e9776 ("net/bonding: fix Rx slave fairness")
Cc: stable@dpdk.org

Signed-off-by: Hari Kumar Vemula <hari.kumarx.vemula@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Chas Williams <chas3@att.com>
This commit is contained in:
Hari Kumar Vemula 2019-02-18 11:59:23 +00:00 committed by Ferruh Yigit
parent 90d2eb059e
commit 7f949ae391
2 changed files with 9 additions and 3 deletions

View File

@ -129,6 +129,12 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves));
internals->active_slave_count = active_count;
/* Resetting active_slave when reaches to max
* no of slaves in active list
*/
if (internals->active_slave >= active_count)
internals->active_slave = 0;
if (eth_dev->data->dev_started) {
if (internals->mode == BONDING_MODE_8023AD) {
bond_mode_8023ad_start(eth_dev);

View File

@ -84,7 +84,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
active_slave = 0;
}
if (++internals->active_slave == slave_count)
if (++internals->active_slave >= slave_count)
internals->active_slave = 0;
return num_rx_total;
}
@ -288,7 +288,7 @@ bond_ethdev_rx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,
active_slave = 0;
}
if (++internals->active_slave == slave_count)
if (++internals->active_slave >= slave_count)
internals->active_slave = 0;
return num_rx_total;
@ -474,7 +474,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
idx = 0;
}
if (++internals->active_slave == slave_count)
if (++internals->active_slave >= slave_count)
internals->active_slave = 0;
return num_rx_total;