From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 756E7A0524; Fri, 8 Jan 2021 09:22:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3735140E71; Fri, 8 Jan 2021 09:22:23 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 04BF6140E6D for ; Fri, 8 Jan 2021 09:22:23 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7EA8131B; Fri, 8 Jan 2021 00:22:22 -0800 (PST) Received: from net-arm-n1amp-01.shanghai.arm.com (net-arm-n1amp-01.shanghai.arm.com [10.169.208.220]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B97073F70D; Fri, 8 Jan 2021 00:22:19 -0800 (PST) From: Ruifeng Wang To: Bruce Richardson , Vladimir Medvedkin Cc: dev@dpdk.org, nd@arm.com, jerinj@marvell.com, drc@linux.vnet.ibm.com, honnappa.nagarahalli@arm.com, Ruifeng Wang Date: Fri, 8 Jan 2021 08:21:26 +0000 Message-Id: <20210108082127.1061538-5-ruifeng.wang@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210108082127.1061538-1-ruifeng.wang@arm.com> References: <20210108082127.1061538-1-ruifeng.wang@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 4/4] test/lpm: improve coverage on tbl8 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 Sender: "dev" Existing test cases create 256 tbl8 groups for testing. The number covers only 8 bit next_hop/group field. Since the next_hop/group field had been extended to 24-bits, creating more than 256 groups in tests can improve the coverage. Coverage was not expanded to reach the max supported group number, because it would take too much time to run for this fast-test. Signed-off-by: Ruifeng Wang --- app/test/test_lpm.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c index 258b2f67c..ee6c4280b 100644 --- a/app/test/test_lpm.c +++ b/app/test/test_lpm.c @@ -993,7 +993,7 @@ test13(void) } /* - * Fore TBL8 extension exhaustion. Add 256 rules that require a tbl8 extension. + * For TBL8 extension exhaustion. Add 512 rules that require a tbl8 extension. * No more tbl8 extensions will be allowed. Now add one more rule that required * a tbl8 extension and get fail. * */ @@ -1008,28 +1008,34 @@ test14(void) struct rte_lpm_config config; config.max_rules = 256 * 32; - config.number_tbl8s = NUMBER_TBL8S; + config.number_tbl8s = 512; config.flags = 0; - uint32_t ip, next_hop_add, next_hop_return; + uint32_t ip, next_hop_base, next_hop_return; uint8_t depth; int32_t status = 0; + xmm_t ipx4; + uint32_t hop[4]; /* Add enough space for 256 rules for every depth */ lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); depth = 32; - next_hop_add = 100; + next_hop_base = 100; ip = RTE_IPV4(0, 0, 0, 0); /* Add 256 rules that require a tbl8 extension */ - for (; ip <= RTE_IPV4(0, 0, 255, 0); ip += 256) { - status = rte_lpm_add(lpm, ip, depth, next_hop_add); + for (; ip <= RTE_IPV4(0, 1, 255, 0); ip += 256) { + status = rte_lpm_add(lpm, ip, depth, next_hop_base + ip); TEST_LPM_ASSERT(status == 0); status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && - (next_hop_return == next_hop_add)); + (next_hop_return == next_hop_base + ip)); + + ipx4 = vect_set_epi32(ip + 3, ip + 2, ip + 1, ip); + rte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX); + TEST_LPM_ASSERT(hop[0] == next_hop_base + ip); } /* All tbl8 extensions have been used above. Try to add one more and @@ -1037,7 +1043,7 @@ test14(void) ip = RTE_IPV4(1, 0, 0, 0); depth = 32; - status = rte_lpm_add(lpm, ip, depth, next_hop_add); + status = rte_lpm_add(lpm, ip, depth, next_hop_base + ip); TEST_LPM_ASSERT(status < 0); rte_lpm_free(lpm); -- 2.25.1