Skip to contentSkip to conversation

test/bonding: fix active backup rx test

PATCH Superseded Stephen Hemminger 3 participants 7 messages Dec 13, 2024 – Jan 22, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/bonding: fix active backup rx test

The test had incorrect assumptions about how active backup should work. When in active backup mode, the secondary (not primary) ports should be ignored. The test was always broken since initially written but earlier bug was masking the part of the test which tested non-primary ports.

Bugzilla ID: 1589

Fixes 112ce3917674 ("test/bonding: fix loop on members")
---
 app/test/test_link_bonding.c | 68 +++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 35 deletions(-)
app/test/test_link_bonding.c +33 -35
index b752a5ecbf..512e79365f 100644
@@ -2246,49 +2246,47 @@ test_activebackup_rx_burst(void)
 		virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i],
 				&gen_pkt_burst[0], burst_size);
 
+		/* Expect burst if this was the active port, zero otherwise */
+		unsigned int rx_expect = (test_params->member_port_ids[i] == primary_port) ? burst_size : 0;
+
 		/* Call rx burst on bonding device */
-		TEST_ASSERT_EQUAL(rte_eth_rx_burst(test_params->bonding_port_id, 0,
-				&rx_pkt_burst[0], MAX_PKT_BURST), burst_size,
-				"rte_eth_rx_burst failed");
+		unsigned int rx_count = rte_eth_rx_burst(test_params->bonding_port_id, 0,
+							 &rx_pkt_burst[0], MAX_PKT_BURST);
+		TEST_ASSERT_EQUAL(rx_count, rx_expect,
+				  "rte_eth_rx_burst (%u) not as expected (%u)",
+				  rx_count, rx_expect);
 
-		if (test_params->member_port_ids[i] == primary_port) {
-			/* Verify bonding device rx count */
-			rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
-			TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-					"Bonding Port (%d) ipackets value (%u) not as expected (%d)",
+		/* Verify bonding device rx count */
+		rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
+		TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+				  "Bonding Port (%d) ipackets value (%u) not as expected (%u)",
 					test_params->bonding_port_id,
-					(unsigned int)port_stats.ipackets, burst_size);
+				  (unsigned int)port_stats.ipackets, rx_expect);
 
-			/* Verify bonding member devices rx count */
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
-				if (i == j) {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets,
-							burst_size);
-				} else {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)\n",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets, 0);
-				}
-			}
-		} else {
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+		for (j = 0; j < test_params->bonding_member_count; j++) {
+			rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+			if (i == j) {
+				TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, rx_expect);
+
+				/* reset member device stats */
+				rte_eth_stats_reset(test_params->member_port_ids[j]);
+			} else {
 				TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-						"Member Port (%d) ipackets value (%u) not as expected "
-						"(%d)", test_params->member_port_ids[i],
-						(unsigned int)port_stats.ipackets, 0);
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, 0);
 			}
 		}
 
-		/* free mbufs */
-		rte_pktmbuf_free_bulk(rx_pkt_burst, burst_size);
+		/* extract packets queued to inactive member */
+		if (rx_count == 0)
+			rx_count = rte_eth_rx_burst(test_params->member_port_ids[i], 0,
+						    rx_pkt_burst, MAX_PKT_BURST);
+		if (rx_count > 0)
+			rte_pktmbuf_free_bulk(rx_pkt_burst, rx_count);
 
 		/* reset bonding device stats */
 		rte_eth_stats_reset(test_params->bonding_port_id);
Signature · 1 line
2.45.2
#1 lore raw

Hi Stephen,

This patch looks good to me.

But this test case still runs failure when I run "link_bonding_autotest" twice. like:
-->
...
EAL: Test assert configure_ethdev line 181 failed: rte_eth_dev_configure for port 7 failed
EAL: Test assert initialize_bonding_device_with_members line 1138 failed: Failed to configure bonding port (7) in mode 3 with (4) members.
EAL: Test assert test_broadcast_verify_member_link_status_change_behaviour line 4060 failed: Failed to initialise bonding device
 + TestCase [62] : test_broadcast_verify_member_link_status_change_behaviour failed
ETHDEV: Invalid port_id=7
EAL: Test assert configure_ethdev line 181 failed: rte_eth_dev_configure for port 7 failed
EAL: Test assert test_reconfigure_bonding_device line 4162 failed: failed to reconfigure bonding device
 + TestCase [63] : test_reconfigure_bonding_device failed
ETHDEV: Invalid port_id=7
 + TestCase [64] : test_close_bonding_device succeeded
ETHDEV: Invalid port_id=7
EAL: Test assert remove_members_and_stop_bonding_device line 659 failed: Failed to stop bonding port 7
 + ------------------------------------------------------- +
 + Test Suite Summary : Link Bonding Unit Test Suite
 + ------------------------------------------------------- +
 + Tests Total :       65
 + Tests Skipped :      0
 + Tests Executed :    65
 + Tests Unsupported:   0
 + Tests Passed :       5
 + Tests Failed :      60
 + ------------------------------------------------------- +
Test Failed

I guess the bonding use case needs to close all bonding devices.

/Huisong

Quoted 102 lines · Stephen Hemminger

The test had incorrect assumptions about how active backup should work. When in active backup mode, the secondary (not primary) ports should be ignored. The test was always broken since initially written but earlier bug was masking the part of the test which tested non-primary ports.

Bugzilla ID: 1589

Fixes 112ce3917674 ("test/bonding: fix loop on members")
---
  app/test/test_link_bonding.c | 68 +++++++++++++++++-------------------
  1 file changed, 33 insertions(+), 35 deletions(-)
app/test/test_link_bonding.c +33 -35
index b752a5ecbf..512e79365f 100644
@@ -2246,49 +2246,47 @@ test_activebackup_rx_burst(void)
  		virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i],
  				&gen_pkt_burst[0], burst_size);
 
+		/* Expect burst if this was the active port, zero otherwise */
+		unsigned int rx_expect = (test_params->member_port_ids[i] == primary_port) ? burst_size : 0;
+
  		/* Call rx burst on bonding device */
-		TEST_ASSERT_EQUAL(rte_eth_rx_burst(test_params->bonding_port_id, 0,
-				&rx_pkt_burst[0], MAX_PKT_BURST), burst_size,
-				"rte_eth_rx_burst failed");
+		unsigned int rx_count = rte_eth_rx_burst(test_params->bonding_port_id, 0,
+							 &rx_pkt_burst[0], MAX_PKT_BURST);
+		TEST_ASSERT_EQUAL(rx_count, rx_expect,
+				  "rte_eth_rx_burst (%u) not as expected (%u)",
+				  rx_count, rx_expect);
 
-		if (test_params->member_port_ids[i] == primary_port) {
-			/* Verify bonding device rx count */
-			rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
-			TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-					"Bonding Port (%d) ipackets value (%u) not as expected (%d)",
+		/* Verify bonding device rx count */
+		rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
+		TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+				  "Bonding Port (%d) ipackets value (%u) not as expected (%u)",
  					test_params->bonding_port_id,
-					(unsigned int)port_stats.ipackets, burst_size);
+				  (unsigned int)port_stats.ipackets, rx_expect);
 
-			/* Verify bonding member devices rx count */
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
-				if (i == j) {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets,
-							burst_size);
-				} else {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)\n",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets, 0);
-				}
-			}
-		} else {
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+		for (j = 0; j < test_params->bonding_member_count; j++) {
+			rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+			if (i == j) {
+				TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, rx_expect);
+
+				/* reset member device stats */
+				rte_eth_stats_reset(test_params->member_port_ids[j]);
+			} else {
  				TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-						"Member Port (%d) ipackets value (%u) not as expected "
-						"(%d)", test_params->member_port_ids[i],
-						(unsigned int)port_stats.ipackets, 0);
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, 0);
  			}
  		}
 
-		/* free mbufs */
-		rte_pktmbuf_free_bulk(rx_pkt_burst, burst_size);
+		/* extract packets queued to inactive member */
+		if (rx_count == 0)
+			rx_count = rte_eth_rx_burst(test_params->member_port_ids[i], 0,
+						    rx_pkt_burst, MAX_PKT_BURST);
+		if (rx_count > 0)
+			rte_pktmbuf_free_bulk(rx_pkt_burst, rx_count);
 
  		/* reset bonding device stats */
  		rte_eth_stats_reset(test_params->bonding_port_id);
#4 lore raw

PATCH v2 1/1 test/bonding: fix active backup rx test

In reply to Stephen Hemminger

The test had incorrect assumptions about how active backup should work. When in active backup mode, the secondary (not primary) ports should be ignored. The test was always broken since initially written but earlier bug was masking the part of the test which tested non-primary ports.

Bugzilla ID: 1589

Fixes 112ce3917674 ("test/bonding: fix loop on members")

---
v2 - fix checkpatch warning from long line

 app/test/test_link_bonding.c | 69 ++++++++++++++++++------------------
 1 file changed, 34 insertions(+), 35 deletions(-)
app/test/test_link_bonding.c +34 -35
index b752a5ecbf..19b064771a 100644
@@ -2246,49 +2246,48 @@ test_activebackup_rx_burst(void)
 		virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i],
 				&gen_pkt_burst[0], burst_size);
 
+		/* Expect burst if this was the active port, zero otherwise */
+		unsigned int rx_expect
+			= (test_params->member_port_ids[i] == primary_port) ? burst_size : 0;
+
 		/* Call rx burst on bonding device */
-		TEST_ASSERT_EQUAL(rte_eth_rx_burst(test_params->bonding_port_id, 0,
-				&rx_pkt_burst[0], MAX_PKT_BURST), burst_size,
-				"rte_eth_rx_burst failed");
+		unsigned int rx_count = rte_eth_rx_burst(test_params->bonding_port_id, 0,
+							 &rx_pkt_burst[0], MAX_PKT_BURST);
+		TEST_ASSERT_EQUAL(rx_count, rx_expect,
+				  "rte_eth_rx_burst (%u) not as expected (%u)",
+				  rx_count, rx_expect);
 
-		if (test_params->member_port_ids[i] == primary_port) {
-			/* Verify bonding device rx count */
-			rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
-			TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-					"Bonding Port (%d) ipackets value (%u) not as expected (%d)",
+		/* Verify bonding device rx count */
+		rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
+		TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+				  "Bonding Port (%d) ipackets value (%u) not as expected (%u)",
 					test_params->bonding_port_id,
-					(unsigned int)port_stats.ipackets, burst_size);
+				  (unsigned int)port_stats.ipackets, rx_expect);
 
-			/* Verify bonding member devices rx count */
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
-				if (i == j) {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets,
-							burst_size);
-				} else {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)\n",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets, 0);
-				}
-			}
-		} else {
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+		for (j = 0; j < test_params->bonding_member_count; j++) {
+			rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+			if (i == j) {
+				TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, rx_expect);
+
+				/* reset member device stats */
+				rte_eth_stats_reset(test_params->member_port_ids[j]);
+			} else {
 				TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-						"Member Port (%d) ipackets value (%u) not as expected "
-						"(%d)", test_params->member_port_ids[i],
-						(unsigned int)port_stats.ipackets, 0);
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, 0);
 			}
 		}
 
-		/* free mbufs */
-		rte_pktmbuf_free_bulk(rx_pkt_burst, burst_size);
+		/* extract packets queued to inactive member */
+		if (rx_count == 0)
+			rx_count = rte_eth_rx_burst(test_params->member_port_ids[i], 0,
+						    rx_pkt_burst, MAX_PKT_BURST);
+		if (rx_count > 0)
+			rte_pktmbuf_free_bulk(rx_pkt_burst, rx_count);
 
 		/* reset bonding device stats */
 		rte_eth_stats_reset(test_params->bonding_port_id);
Signature · 1 line
2.45.2
#2 lore raw
In reply to lihuisong (C)
Quoted 41 lines · On Fri, 13 Dec 2024 14:57:23 +0800 "lihuisong (C)" <[email protected]> wrote:

Hi Stephen,

This patch looks good to me.

But this test case still runs failure when I run "link_bonding_autotest" twice. like:
-->
...
EAL: Test assert configure_ethdev line 181 failed: rte_eth_dev_configure for port 7 failed
EAL: Test assert initialize_bonding_device_with_members line 1138
failed: Failed to configure bonding port (7) in mode 3 with (4) members.
EAL: Test assert test_broadcast_verify_member_link_status_change_behaviour line 4060
failed: Failed to initialise bonding device
 + TestCase [62] :
test_broadcast_verify_member_link_status_change_behaviour failed
ETHDEV: Invalid port_id=7
EAL: Test assert configure_ethdev line 181 failed: rte_eth_dev_configure for port 7 failed
EAL: Test assert test_reconfigure_bonding_device line 4162 failed:
failed to reconfigure bonding device
 + TestCase [63] : test_reconfigure_bonding_device failed
ETHDEV: Invalid port_id=7
 + TestCase [64] : test_close_bonding_device succeeded
ETHDEV: Invalid port_id=7
EAL: Test assert remove_members_and_stop_bonding_device line 659 failed:
Failed to stop bonding port 7
 + ------------------------------------------------------- +
 + Test Suite Summary : Link Bonding Unit Test Suite
 + ------------------------------------------------------- +
 + Tests Total :       65
 + Tests Skipped :      0
 + Tests Executed :    65
 + Tests Unsupported:   0
 + Tests Passed :       5
 + Tests Failed :      60
 + ------------------------------------------------------- +
Test Failed

Quoted 1 line

I guess the bonding use case needs to close all bonding devices.

The test has lots of issues that would make it bad to run twice. Like leaking mbufs, etc.
But these always existed and will leave that to bonding maintainers to fix.

#3 lore raw
Quoted 44 lines · Stephen Hemminger
Quoted 41 lines · On Fri, 13 Dec 2024 14:57:23 +0800 "lihuisong (C)" <[email protected]> wrote:

Hi Stephen,

This patch looks good to me.

But this test case still runs failure when I run "link_bonding_autotest" twice. like:
-->
...
EAL: Test assert configure_ethdev line 181 failed: rte_eth_dev_configure for port 7 failed
EAL: Test assert initialize_bonding_device_with_members line 1138
failed: Failed to configure bonding port (7) in mode 3 with (4) members.
EAL: Test assert test_broadcast_verify_member_link_status_change_behaviour line 4060
failed: Failed to initialise bonding device
 + TestCase [62] :
test_broadcast_verify_member_link_status_change_behaviour failed
ETHDEV: Invalid port_id=7
EAL: Test assert configure_ethdev line 181 failed: rte_eth_dev_configure for port 7 failed
EAL: Test assert test_reconfigure_bonding_device line 4162 failed:
failed to reconfigure bonding device
 + TestCase [63] : test_reconfigure_bonding_device failed
ETHDEV: Invalid port_id=7
 + TestCase [64] : test_close_bonding_device succeeded
ETHDEV: Invalid port_id=7
EAL: Test assert remove_members_and_stop_bonding_device line 659 failed:
Failed to stop bonding port 7
 + ------------------------------------------------------- +
 + Test Suite Summary : Link Bonding Unit Test Suite
 + ------------------------------------------------------- +
 + Tests Total :       65
 + Tests Skipped :      0
 + Tests Executed :    65
 + Tests Unsupported:   0
 + Tests Passed :       5
 + Tests Failed :      60
 + ------------------------------------------------------- +
Test Failed

Quoted 5 lines
Quoted 1 line

I guess the bonding use case needs to close all bonding devices.

The test has lots of issues that would make it bad to run twice. Like leaking mbufs, etc.
But these always existed and will leave that to bonding maintainers to fix.

ok, these issues aren't related to this patch and can be be fixed later.

Quoted 1 line

.

Acked-by Tested-by on v2 1/1
#5 lore raw
In reply to Stephen Hemminger

LGTM

Quoted 105 lines · Stephen Hemminger

The test had incorrect assumptions about how active backup should work. When in active backup mode, the secondary (not primary) ports should be ignored. The test was always broken since initially written but earlier bug was masking the part of the test which tested non-primary ports.

Bugzilla ID: 1589

Fixes 112ce3917674 ("test/bonding: fix loop on members")

---
v2 - fix checkpatch warning from long line

  app/test/test_link_bonding.c | 69 ++++++++++++++++++------------------
  1 file changed, 34 insertions(+), 35 deletions(-)
app/test/test_link_bonding.c +34 -35
index b752a5ecbf..19b064771a 100644
@@ -2246,49 +2246,48 @@ test_activebackup_rx_burst(void)
  		virtual_ethdev_add_mbufs_to_rx_queue(test_params->member_port_ids[i],
  				&gen_pkt_burst[0], burst_size);
 
+		/* Expect burst if this was the active port, zero otherwise */
+		unsigned int rx_expect
+			= (test_params->member_port_ids[i] == primary_port) ? burst_size : 0;
+
  		/* Call rx burst on bonding device */
-		TEST_ASSERT_EQUAL(rte_eth_rx_burst(test_params->bonding_port_id, 0,
-				&rx_pkt_burst[0], MAX_PKT_BURST), burst_size,
-				"rte_eth_rx_burst failed");
+		unsigned int rx_count = rte_eth_rx_burst(test_params->bonding_port_id, 0,
+							 &rx_pkt_burst[0], MAX_PKT_BURST);
+		TEST_ASSERT_EQUAL(rx_count, rx_expect,
+				  "rte_eth_rx_burst (%u) not as expected (%u)",
+				  rx_count, rx_expect);
 
-		if (test_params->member_port_ids[i] == primary_port) {
-			/* Verify bonding device rx count */
-			rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
-			TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-					"Bonding Port (%d) ipackets value (%u) not as expected (%d)",
+		/* Verify bonding device rx count */
+		rte_eth_stats_get(test_params->bonding_port_id, &port_stats);
+		TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+				  "Bonding Port (%d) ipackets value (%u) not as expected (%u)",
  					test_params->bonding_port_id,
-					(unsigned int)port_stats.ipackets, burst_size);
+				  (unsigned int)port_stats.ipackets, rx_expect);
 
-			/* Verify bonding member devices rx count */
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
-				if (i == j) {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets,
-							burst_size);
-				} else {
-					TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-							"Member Port (%d) ipackets value (%u) not as "
-							"expected (%d)\n",
-							test_params->member_port_ids[i],
-							(unsigned int)port_stats.ipackets, 0);
-				}
-			}
-		} else {
-			for (j = 0; j < test_params->bonding_member_count; j++) {
-				rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+		for (j = 0; j < test_params->bonding_member_count; j++) {
+			rte_eth_stats_get(test_params->member_port_ids[j], &port_stats);
+			if (i == j) {
+				TEST_ASSERT_EQUAL(port_stats.ipackets, rx_expect,
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, rx_expect);
+
+				/* reset member device stats */
+				rte_eth_stats_reset(test_params->member_port_ids[j]);
+			} else {
  				TEST_ASSERT_EQUAL(port_stats.ipackets, 0,
-						"Member Port (%d) ipackets value (%u) not as expected "
-						"(%d)", test_params->member_port_ids[i],
-						(unsigned int)port_stats.ipackets, 0);
+					  "Member Port (%d) ipackets (%u) not as expected (%d)",
+					  test_params->member_port_ids[i],
+					  (unsigned int)port_stats.ipackets, 0);
  			}
  		}
 
-		/* free mbufs */
-		rte_pktmbuf_free_bulk(rx_pkt_burst, burst_size);
+		/* extract packets queued to inactive member */
+		if (rx_count == 0)
+			rx_count = rte_eth_rx_burst(test_params->member_port_ids[i], 0,
+						    rx_pkt_burst, MAX_PKT_BURST);
+		if (rx_count > 0)
+			rte_pktmbuf_free_bulk(rx_pkt_burst, rx_count);
 
  		/* reset bonding device stats */
  		rte_eth_stats_reset(test_params->bonding_port_id);
Tested-by on v2 1/1
#6 lore raw
In reply to Stephen Hemminger
Quoted 16 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Saturday, December 14, 2024 1:17 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; [email protected]; Chas Williams <[email protected]>; Min Hu (Connor) <[email protected]>; Richardson, Bruce <[email protected]>; Chengwen Feng <[email protected]>
Subject: [PATCH v2] test/bonding: fix active backup rx test

The test had incorrect assumptions about how active backup should work. When in active backup mode, the secondary (not primary) ports should be ignored. The test was always broken since initially written but earlier bug was masking the part of the test which tested non-primary ports.

Quoted 7 lines

Bugzilla ID: 1589

Fixes 112ce3917674 ("test/bonding: fix loop on members")

---