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 A07304626B for ; Wed, 19 Feb 2025 18:34:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A7F94028B; Wed, 19 Feb 2025 18:34:36 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id B50684028B for ; Wed, 19 Feb 2025 18:34:34 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-220c665ef4cso106644185ad.3 for ; Wed, 19 Feb 2025 09:34:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1739986474; x=1740591274; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mnQNTk792prjnT0/8kp1R4qF4fBuSGy8qL6CMcx5EH4=; b=2tv2lgehDpsRuNbaQX2/GlsEZ6dDwS5/yl6HSI2VwYUwkLka8ncF2/mPoigHirSUJW R7R/ubcEnJhCXn4ahtBjbBpV4m8uDUbUEStsNE/zeZ7bsLkZ9wGHX7ErEEVuQnn+D9+p cU5LuMaCtVENRf5/eDwAWhkWxTUhSbPMb8D4Tnd0ftiaRXLnGXZSDWZrJ9z2VIuhCPbP 0jtfSc3J8sGgbZT4RItyx9N6owsaUJIFtvKO4c9UivljSDnelecjszh2eBrsjH0gccHc iBeyevYWZ5dpF4jyNbLF3sZoVbmIOtDA2zik+zL6w8uWrrFO0hbvHNuJ4Dn6+fB9qFxG eXvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739986474; x=1740591274; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mnQNTk792prjnT0/8kp1R4qF4fBuSGy8qL6CMcx5EH4=; b=qozqwmwrBOtvs0XySvOHKvFdUW894p25ygCoIsHeWhe4uVt+iB5w1dHvbKyGMniElS 1wy5ZV9ThC6RDB3B7+P7c26pxIbF7voW7lSSC9zbXhAzoj9e+t6HTEv30IWLpetkUtYk O2QcxvbBCzWFItCGRVID5/vS4X+yrSBicEXOyu7dnbOH34gPtvRSMISKmSUI2vMX9dDz RI8TId4NsI+/ICdpON95NMoQHdTjOu/uUU24DLLOEZ7bXF4GA886kn2lyjnzHwyKCPhS RKoLlLhwWamp7XRjhXlS0rWmRHiuvxYciJ2PJZprrc+wYT7i7a1/dof7BzDc2bpg5ZgO cO6w== X-Gm-Message-State: AOJu0YyydEZNKPCQw7uZPjQZEjnsLdWFJiE5tiKp2n6JrbKxE3TorOWQ bnvAB6bFukFWVh5pmDTAgUHDEfROT1vkwW8/HgM7pEuooki+S94GOnYeTwnPyytqs2zTR9D9/JY dAys= X-Gm-Gg: ASbGncv0PSk+LHQ/e1dbzjoH127lXI0e9LSREp9NwYjUqIgbTj4uyQEP6qxfe1DNrUs fQp0xp4NwHEPFDIVt19lQI4toqOTf1LO4sgQkdnihTSRgjNPPP+QStiV+r7mTII4e2cenZirJL7 dyWp+pxR7rcgYaBfDCVYrbx4YHrbS2jHRfBcO9H+cxxSZtPLCeyB6w+tbT3YRBZ0So1ogP+/orE yytrKp+gISI6NcCt93hltFs2dYUG75NRwHZ6zppkIXvJtyLYCaT0z+GJseyt64pO3HJ+IAfe5Lb 3U7b6b9fpM+40RAMEzxRV5Q6Gbp+an/v8AcAgp7SvoGe3YofC0l48XMZV/1IRbss1PoH X-Google-Smtp-Source: AGHT+IGVKinFsuSADHB80THby7iotXr+5JiVbnre6SdEJZVv2DLEajlZjUJKeDkIUcBwxUDpeZCyzA== X-Received: by 2002:a05:6a20:d80d:b0:1ee:d7fa:5d8f with SMTP id adf61e73a8af0-1eed7fa61e4mr5077102637.27.1739986473771; Wed, 19 Feb 2025 09:34:33 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-adb5a92d385sm11191930a12.76.2025.02.19.09.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2025 09:34:33 -0800 (PST) From: Stephen Hemminger To: stable@dpdk.org Cc: Stephen Hemminger , Huisong Li Subject: [PATCH 22.11] test/bonding: fix active backup receive test Date: Wed, 19 Feb 2025 09:34:10 -0800 Message-ID: <20250219173423.596916-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.47.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit eb29e625ce41b50898efc8e2618b7eeb128460ed ] 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") Signed-off-by: Stephen Hemminger Acked-by: Huisong Li Tested-by: Huisong Li --- app/test/test_link_bonding.c | 77 +++++++++++++++++------------------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 53f5c13a24..2ea4393476 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -2226,51 +2226,48 @@ test_activebackup_rx_burst(void) virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[i], &gen_pkt_burst[0], burst_size); - /* Call rx burst on bonded device */ - TEST_ASSERT_EQUAL(rte_eth_rx_burst(test_params->bonded_port_id, 0, - &rx_pkt_burst[0], MAX_PKT_BURST), burst_size, - "rte_eth_rx_burst failed"); - - if (test_params->slave_port_ids[i] == primary_port) { - /* Verify bonded device rx count */ - rte_eth_stats_get(test_params->bonded_port_id, &port_stats); - TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size, - "Bonded Port (%d) ipackets value (%u) not as expected (%d)", - test_params->bonded_port_id, - (unsigned int)port_stats.ipackets, 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 */ + 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); + + /* 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, rx_expect); + + 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); - /* Verify bonded slave devices rx count */ - for (j = 0; j < test_params->bonded_slave_count; j++) { - rte_eth_stats_get(test_params->slave_port_ids[j], &port_stats); - if (i == j) { - TEST_ASSERT_EQUAL(port_stats.ipackets, (uint64_t)burst_size, - "Slave Port (%d) ipackets value (%u) not as " - "expected (%d)", test_params->slave_port_ids[i], - (unsigned int)port_stats.ipackets, burst_size); - } else { - TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as " - "expected (%d)\n", test_params->slave_port_ids[i], - (unsigned int)port_stats.ipackets, 0); - } - } - } else { - for (j = 0; j < test_params->bonded_slave_count; j++) { - rte_eth_stats_get(test_params->slave_port_ids[j], &port_stats); + /* reset member device stats */ + rte_eth_stats_reset(test_params->member_port_ids[j]); + } else { TEST_ASSERT_EQUAL(port_stats.ipackets, 0, - "Slave Port (%d) ipackets value (%u) not as expected " - "(%d)", test_params->slave_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 */ - for (i = 0; i < MAX_PKT_BURST; i++) { - if (rx_pkt_burst[i] != NULL) { - rte_pktmbuf_free(rx_pkt_burst[i]); - rx_pkt_burst[i] = NULL; - } - } + /* 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 bonded device stats */ rte_eth_stats_reset(test_params->bonded_port_id); -- 2.47.2