From: "lihuisong (C)" <lihuisong@huawei.com>
To: Stephen Hemminger <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: <stable@dpdk.org>, Chas Williams <chas3@att.com>,
"Min Hu (Connor)" <humin29@huawei.com>,
Bruce Richardson <bruce.richardson@intel.com>,
"Chengwen Feng" <fengchengwen@huawei.com>
Subject: Re: [PATCH v2] test/bonding: fix active backup rx test
Date: Mon, 16 Dec 2024 09:53:10 +0800 [thread overview]
Message-ID: <3483838a-d878-7d7b-7ee6-2ba34c98586a@huawei.com> (raw)
In-Reply-To: <20241213171713.13266-2-stephen@networkplumber.org>
LGTM
Acked-by: Huisong Li <lihuisong@huawei.com>
Tested-by: Huisong Li <lihuisong@huawei.com>
在 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 <stephen@networkplumber.org>
> ---
> 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);
prev parent reply other threads:[~2024-12-16 1:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 1:51 [PATCH] " Stephen Hemminger
2024-12-13 6:57 ` lihuisong (C)
2024-12-13 16:56 ` Stephen Hemminger
2024-12-16 1:50 ` lihuisong (C)
2024-12-13 17:17 ` [PATCH v2] " Stephen Hemminger
2024-12-16 1:53 ` lihuisong (C) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3483838a-d878-7d7b-7ee6-2ba34c98586a@huawei.com \
--to=lihuisong@huawei.com \
--cc=bruce.richardson@intel.com \
--cc=chas3@att.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=humin29@huawei.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).