From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EF10645EB3; Mon, 16 Dec 2024 02:53:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A967B402B5; Mon, 16 Dec 2024 02:53:17 +0100 (CET) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id 7209D4025A; Mon, 16 Dec 2024 02:53:14 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4YBNFC716Pz1T78B; Mon, 16 Dec 2024 09:50:39 +0800 (CST) Received: from dggemv704-chm.china.huawei.com (unknown [10.3.19.47]) by mail.maildlp.com (Postfix) with ESMTPS id 43F231402DB; Mon, 16 Dec 2024 09:53:12 +0800 (CST) Received: from kwepemn100009.china.huawei.com (7.202.194.112) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 16 Dec 2024 09:53:12 +0800 Received: from [10.67.121.59] (10.67.121.59) by kwepemn100009.china.huawei.com (7.202.194.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 16 Dec 2024 09:53:11 +0800 Message-ID: <3483838a-d878-7d7b-7ee6-2ba34c98586a@huawei.com> Date: Mon, 16 Dec 2024 09:53:10 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2] test/bonding: fix active backup rx test To: Stephen Hemminger , CC: , Chas Williams , "Min Hu (Connor)" , Bruce Richardson , "Chengwen Feng" References: <20241213015158.10174-1-stephen@networkplumber.org> <20241213171713.13266-2-stephen@networkplumber.org> From: "lihuisong (C)" In-Reply-To: <20241213171713.13266-2-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.121.59] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemn100009.china.huawei.com (7.202.194.112) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org LGTM Acked-by: Huisong Li Tested-by: Huisong Li 在 2024/12/14 1:17, 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") > Cc: stable@dpdk.org > > Signed-off-by: Stephen Hemminger > --- > v2 - fix checkpatch warning from long line > > app/test/test_link_bonding.c | 69 ++++++++++++++++++------------------ > 1 file changed, 34 insertions(+), 35 deletions(-) > > diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c > index b752a5ecbf..19b064771a 100644 > --- a/app/test/test_link_bonding.c > +++ b/app/test/test_link_bonding.c > @@ -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);