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 2262545E89 for ; Fri, 13 Dec 2024 02:52:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18772402EE; Fri, 13 Dec 2024 02:52:12 +0100 (CET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by mails.dpdk.org (Postfix) with ESMTP id 36ADA40263 for ; Fri, 13 Dec 2024 02:52:10 +0100 (CET) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2ee709715d9so853887a91.3 for ; Thu, 12 Dec 2024 17:52:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734054729; x=1734659529; 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=AJqi+r4IXv6bSKPESikzKyM1FyNLYXuX05y8CJLiIBo=; b=urj3Weq9o8mj8jcipVUQdURyP1ev9w23aRo9qnCKh5rC9x1AMmCpF7wWrk84cuwd0o miKYdudFmm4fPxfCwKtMtxMRrN0CESSloTRycCL+UnPF4NNXezEGztD39azYz9z8haAy i01pNABLITUrMqMSKK8E3k9iPUF0bKZS1z3Fesei/Fch8tdgo5hYnZQlOBD/zOufIRrY 9DpwELoBDrpCAiq8QklNCf+eyv6QpSqY2zIQuuLgOS/hNhyZxvP2JVhfPK86ltZwsQcF yXE/i6NpeHVQyA277zdaNs/m5hh8ey2YscfoPy1Zt6B6KLpkfNs9WCZI4AJkCHoxeJFm 9Keg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734054729; x=1734659529; 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=AJqi+r4IXv6bSKPESikzKyM1FyNLYXuX05y8CJLiIBo=; b=JAEjr+iWad1qef99b/a32zKJX9syKO4Ixk4ixIyeRBu2wMGugMIJ+lPaZg4bPyU6Wd Gtf/41lPhQhRCXvccFJVgO1CFwIkOasxfDBHmsnBTjCjtFauSUk5D6bWR5swtUs5/6Ke ob9aJcuDIArCZGLzaQ70iTAZPXvsuHvjwYdMe/JbnoWGdqgTQpl+hU3g/aXo13W3Wv6g hRCjLdJ4ewhrsrNONTqusARwbQ6z6hnIu6m49/eTYemKWFib18JqhkFvV7iRlRKjck1a DQF5N1YuR3bK9JFln7hZTKizh37s5JwcEkFj6vaw22hZJXFy2CrTPjI1McMl96Pnnk+k nXvQ== X-Forwarded-Encrypted: i=1; AJvYcCU0JYpzIewjrY1EsyxokkKkibGmWBhruCREo/OGlyu9Z4aiAIvDmoe2V4ID8Vkl/zyBfi+e5pE=@dpdk.org X-Gm-Message-State: AOJu0YwZ/VxVZMkRI0WN9E8ZJr94dCVo6bzXR7coDETktaqjJcQ1LBsk 3ZR8oZc4AFEHzK0XiQn034f/YNDNRZIp6fYmvKpFEMe9I8MvS/ngwVvI58FABUQ= X-Gm-Gg: ASbGncuEZe1Up9vo2ErOSCKreSfHEggkrRx6v5P/S2kM3xc7hDfgQbTTcu4296vRikj anRWOcww7vxWNqP/FRQyJdXc9LbOaTM83nJuHRIub1eAjNNWA4Ozm1uI5N3QqDfKlQG+r97C9c5 naYypal0W2Pj68XjMYWduLm1p2tWq3Bsfo/lDoBHLRim3uFEVXMHJ1+a8CUyPc9dAZwkJ6t8H06 vQMrFcKEbDYJvHKs0YsiuyQjVd5+P3Nlrpz1TxFccyGYn2lnQ4pHStqoqexdIovermvL4wC6sMc 42ApRltpl84o9bo0msZLgizhRJQX7lZ1PA== X-Google-Smtp-Source: AGHT+IGo0iY+zPx3pcPVktAkwy5E/m3qND3SnqDaKO7lAV/RxAWv5heyEs46W49umNNe9ahGsPgS3g== X-Received: by 2002:a17:90b:3891:b0:2ee:f19b:86e5 with SMTP id 98e67ed59e1d1-2f28fb6d11fmr1493671a91.14.1734054728856; Thu, 12 Dec 2024 17:52:08 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142de33basm2011122a91.23.2024.12.12.17.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 17:52:08 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Chas Williams , "Min Hu (Connor)" , Chengwen Feng , Bruce Richardson Subject: [PATCH] test/bonding: fix active backup rx test Date: Thu, 12 Dec 2024 17:51:58 -0800 Message-ID: <20241213015158.10174-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.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 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 --- app/test/test_link_bonding.c | 68 +++++++++++++++++------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index b752a5ecbf..512e79365f 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -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); -- 2.45.2