From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 8731658D8 for ; Mon, 1 Aug 2016 15:49:17 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 01 Aug 2016 06:49:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,455,1464678000"; d="scan'208";a="1006304301" Received: from dpdk2.bj.intel.com ([172.16.182.189]) by orsmga001.jf.intel.com with ESMTP; 01 Aug 2016 06:49:15 -0700 From: Wei Dai To: dev@dpdk.org Cc: Wei Dai Date: Mon, 1 Aug 2016 21:47:44 +0800 Message-Id: <1470059264-29772-1-git-send-email-wei.dai@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [dpdk-dev] [PATCH] lpm: remove redundant check when adding lpm rule X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 13:49:18 -0000 When a rule with depth > 24 is added into an existing rule with depth <=24, a new tbl8 is allocated, the existing rule first fulfill whole new tbl8, so the filed vaild of each entry in this tbl8 is always true and depth of each entry is always < 24 before adding new rule with depth > 24. Signed-off-by: Wei Dai --- lib/librte_lpm/rte_lpm.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 24fec4b..5bdc23f 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -1071,14 +1071,9 @@ add_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth, /* Insert new rule into the tbl8 entry. */ for (i = tbl8_index; i < tbl8_index + tbl8_range; i++) { - if (!lpm->tbl8[i].valid || - lpm->tbl8[i].depth <= depth) { - lpm->tbl8[i].valid = VALID; - lpm->tbl8[i].depth = depth; - lpm->tbl8[i].next_hop = next_hop; - - continue; - } + lpm->tbl8[i].valid = VALID; + lpm->tbl8[i].depth = depth; + lpm->tbl8[i].next_hop = next_hop; } /* -- 2.5.5