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 29F1945E92 for ; 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 24955400D5; Fri, 13 Dec 2024 18:17:40 +0100 (CET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 1F6F84068E for ; Fri, 13 Dec 2024 18:17:39 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-21654fdd5daso18373855ad.1 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=lafV3tTyli0ZhStiPN70Nm7ULwl9q/Ta1PVz+BtdyY4g+ffppjkOPKyMmYSy0neCeh oa44b0VuGzbqFmVXOA9dfq9ioGxGAXAPtbTTNZS9peBKmjjMde6cbvL11jHXbbRM0uao 8iY5tgq+TOLlTRWB5TLldcFhrAmz7GaTsk/ryOi0bhy4Rk1eauQpCipfV43GY9fOAHfR 2bKEn+GjPJTPWfhpk2BjmkL69NxUGOgP5O5fVmhwvu4A2FAhBkAZlDm8gYiIWqNgSgRT fdOd+mN56taegN/runCx3+pFWg3+Fna0KuV7zUL562jxjbRjHyCNskhb3e5kuTnQri59 8Hsw== X-Forwarded-Encrypted: i=1; AJvYcCVWzg3xsSuPJ/jg5/RKoQh2Ofz/1sviE/CDc70zdPZWy6COSSKtI+iDJ6SwFMlOxl9VAa7umwQ=@dpdk.org X-Gm-Message-State: AOJu0YxwruDnKBnatql1N7KJ5tqw45TMQ7aNGNkIyO5TF4lWZZ7lZmme ifI8j8uFQJij0PIwfcSlmwr+NokK+RqXVR5ad5WV0mNxMt6tjhQ1ZqInLcIjT9M= X-Gm-Gg: ASbGncs5/h1v9voyOGXrN5jxkzpgofFhRSfMTd9ROqDyLj9VHSzDrz2I2FuKFUSLi1U p47kkQX2bcisCUXvJC4axqQY+njRb5ZNsfFbkx3pQahIUm24LvvjHDm8eq2JOgZkXpGCxsptxbu ZM38nIA1FMJPdQ6O3EyeYO8n+KGwNVgz4OT48fo0WI7qGK1bdPMlJGhkCOK4nXk3t+FtHtI8L4C X4vAo25WkYKVV8CXfbiJsEt/iCH5lPzQmtyLzNEGtGSsxgMF/uy3ixdRNB8QK5jqchgQB8L5ZbY N9xaVpvw8l+aUmIVQa1XDVoLbXsehshOSQ== 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: 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 --- 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