Skip to contentSkip to conversation

net/bonding: fix reset active slave

PATCH Applied Hari Kumar Vemula 5 participants 7 messages Feb 18, 2019 – Feb 22, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 e1110e977648 ("net/bonding: fix Rx slave fairness")
---
 drivers/net/bonding/rte_eth_bond_api.c | 6 ++++++
 drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +6 -0
index e5e146540..ac084c4fd 100644
@@ -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);
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
index 23cec2549..319215c0b 100644
@@ -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;
Signature · 1 line
2.17.2
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Hari Kumar Vemula

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.

Quoted 6 lines
Fixes e1110e977648 ("net/bonding: fix Rx slave fairness")

---

Acked-by Radu Nicolau <[email protected] <mailto:[email protected]>>
#2 lore raw
Quoted 15 lines · Radu Nicolau
Quoted 12 lines · Hari Kumar Vemula

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.

Quoted 8 lines
Quoted 6 lines
Fixes e1110e977648 ("net/bonding: fix Rx slave fairness")

---

<mailto:[email protected]>>

Hi Radu, Hari,

There is another bonding patch, can you please check how related are they and if are these fixing same root cause:

net/bonding: avoid the next active slave going out of bound
https://patches.dpdk.org/patch/49573/

#3 lore raw
Quoted 23 lines · Ferruh Yigit
Quoted 14 lines · Radu Nicolau
Quoted 12 lines · Hari Kumar Vemula

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.

Quoted 8 lines
Quoted 6 lines
Fixes e1110e977648 ("net/bonding: fix Rx slave fairness")

---

<mailto:[email protected]>>

Quoted 8 lines

Hi Radu, Hari,

There is another bonding patch, can you please check how related are they and if are these fixing same root cause:

net/bonding: avoid the next active slave going out of bound
https://patches.dpdk.org/patch/49573/

Hi, it's a similar fix for the same root cause, but this one covers more (or all) situations that can cause active_slave to go out of bounds.

#4 lore raw
Quoted 28 lines · Radu Nicolau
Quoted 25 lines · Ferruh Yigit
Quoted 14 lines · Radu Nicolau
Quoted 12 lines · Hari Kumar Vemula

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.

Quoted 8 lines
Quoted 6 lines
Fixes e1110e977648 ("net/bonding: fix Rx slave fairness")

---

<mailto:[email protected]>>

Hi Radu, Hari,

Quoted 8 lines
Quoted 6 lines

There is another bonding patch, can you please check how related are they and if are these fixing same root cause:

net/bonding: avoid the next active slave going out of bound
https://patches.dpdk.org/patch/49573/

Hi, it's a similar fix for the same root cause, but this one covers more (or all) situations that can cause active_slave to go out of bounds.

If it covers more cases, please go with the new patch and drop mine. I just want to see the issue fixed :-)

Thanks.
-Hyong

Acked-by
#5 lore raw
Quoted 19 lines · Hyong Youb Kim
Quoted 18 lines · Radu Nicolau
Quoted 15 lines · Ferruh Yigit
Quoted 14 lines · Radu Nicolau
Quoted 12 lines · Hari Kumar Vemula

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.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Fixes e1110e977648 ("net/bonding: fix Rx slave fairness")

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

<mailto:[email protected]>>

Hi Radu, Hari,

There is another bonding patch, can you please check how related are they and if are these fixing same root cause:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

net/bonding: avoid the next active slave going out of bound
https://patches.dpdk.org/patch/49573/

Hi, it's a similar fix for the same root cause, but this one covers more (or all) situations that can cause active_slave to go out of bounds.

If it covers more cases, please go with the new patch and drop mine. I just want to see the issue fixed :-)

Yes, it does cover a few more cases. There really isn't any coordination between slave activation/deactivation and the rx/tx burst routines. So checking at the beginning or the end of the various routines is about the same.

Quoted 3 lines

Thanks.
-Hyong

Applied
#6 lore raw
Quoted 25 lines · Chas Williams
Quoted 22 lines · Hyong Youb Kim
Quoted 21 lines · Radu Nicolau
Quoted 18 lines · Ferruh Yigit
Quoted 17 lines · Radu Nicolau
Quoted 15 lines · Hari Kumar Vemula

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 e1110e977648 ("net/bonding: fix Rx slave fairness")
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

---

Applied to dpdk-next-net/master, thanks.