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 662A545E92; Fri, 13 Dec 2024 18:17:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DE4F40E03; Fri, 13 Dec 2024 18:17:40 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 1E9FC400D5 for ; Fri, 13 Dec 2024 18:17:39 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-216728b1836so17390265ad.0 for ; Fri, 13 Dec 2024 09:17:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734110258; x=1734715058; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=himDkhPA/8tijRF1MD7UNUiRv+AQ77DAll87Mro1gx0=; b=U4e+hmnYQDrtGbEn2TmuGkCOeupux4FOdroCItWNM1tq3zGzoDCBhC9G7k5qQ+RzOR pfI4xCzNvOyRLxac/nXelHVgPgt1iH7PF3addnMKPJr4K84LJUf9APp7EyF+gSBQuvYq dAD3U6J+DatM4zupuqPsDxVZ7LatuyD/hhfZBVECOoThdasr92hpEw/OnkpnKRD36H1Q 6xQFUdNHlXnUh4QgbjZ6lA1s3rcRpH5T8uj59+ATTs1BF1fh75UfEcV4g+txtPLshP/E En7j8ej0PyCGqfRW1LnAr9QD/li9VXAHH/dxEjQ3Bu2QaAHENk8GqpfKrR7YshDCcV4u jtjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734110258; x=1734715058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=himDkhPA/8tijRF1MD7UNUiRv+AQ77DAll87Mro1gx0=; b=dSw2cxntd+m8JoyOFgdaEzKpV2Ue4TVTDbTpzFdkoN58Ibq5YdZrsr7GZHrwYL2o26 74TJRcCLTvLIifUtZVjorzNNJ0a6+QDFYq4NFC0kV0y6Ez5WDLvHR9SVTpmyiccrrVwb M+lpzsQEUuDoV3EL4loVTY9m+AiTKi3q15AYoF1ZfzjcguxOA79y+sV3EEExnjpcHWaL mLU1GsmhC4MwbBgB6cP4UOGX9Aaz6Y9wz4RD/18AoxaBkSHgsdnUNjZjwH5U2lnvmVyd 6jb35uTQp+EK5s4GivInhL3sy8VPPoQXntOLnC+LaFrXj+ZaVV6kofkyFC+PDKkm81My Z/Hg== X-Gm-Message-State: AOJu0Yz7nSiClhNHY1/G5PkGTLH/GYUNNEL84SaT/Y+iuCjnuUtK12Rh zMPr1bdS3SzJs+VDjX+mvXbPQoFQAUgA37Csug7VY7tZt8zCMOSqO4AdBfnoRqLQ81nZM+gBnPX I X-Gm-Gg: ASbGnctzmPPCE3V1Pq7k7TNW1wjOrqjnncudBfT+fu603SlQO0QIc60S9B5nhIo1aiq XXrxFGGBLK+7tFaq5KJKja0HGf371aJFV0ef6eYC0OJPpuPjFM0Oqt15s1Zwlq8T7vqS8TYGaiS LkW+Cu6tc3WI7MRBhbmlU4ucm6fSiJSBO4AU66ais9BrTDndhyOWfoFPQBdoNdDf2h+SC2Ow4y7 gj/q7f3ZvVLjtdC/36SfdxN3yavPei3YRS9EfH9/tJ3S38wjUrNSkVf2FVqazDOWxhdnabkzu7+ V2mUWTW685/jx7GBAL6FDJJrztH8NoV0vA== X-Google-Smtp-Source: AGHT+IEFXFHwoNUMHhkJoP/j94T8HJc3HWVyfsjjxsD8TPGq4CGhlqrgyk13aompr8Qfp3TFpnp1jQ== X-Received: by 2002:a17:902:da84:b0:216:6a4a:9a39 with SMTP id d9443c01a7336-21892a86816mr55666815ad.56.1734110258194; Fri, 13 Dec 2024 09:17:38 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1e6476csm53705ad.219.2024.12.13.09.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 09:17:37 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Chas Williams , "Min Hu (Connor)" , Bruce Richardson , Chengwen Feng Subject: [PATCH v2] test/bonding: fix active backup rx test Date: Fri, 13 Dec 2024 09:17:14 -0800 Message-ID: <20241213171713.13266-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241213015158.10174-1-stephen@networkplumber.org> References: <20241213015158.10174-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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); -- 2.45.2