From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 72CE2A058A; Fri, 17 Apr 2020 16:04:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C2B4F1E8D0; Fri, 17 Apr 2020 16:04:49 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id EE8861E8C9 for ; Fri, 17 Apr 2020 16:04:47 +0200 (CEST) IronPort-SDR: 1vB5x6H6m4Lie67VPAtJMDaNUiSNuxxM3kRYMoEAqIaDQJPnG6Musr2uosIIN4FTQWDOUxc/Qk UceXMY2LLGrA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2020 07:04:47 -0700 IronPort-SDR: kg/QZC1t7kX9omM5SBfkJ9dAVWv/J0PTXkYTqi/NaELhv5PYyLUnCO+Pa4T4t5svleAVvO1YVU CsxwLaX3Ms0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,395,1580803200"; d="scan'208";a="333200638" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga001.jf.intel.com with ESMTP; 17 Apr 2020 07:04:46 -0700 Received: from irsmsx602.ger.corp.intel.com (163.33.146.8) by IRSMSX106.ger.corp.intel.com (163.33.3.31) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 17 Apr 2020 15:01:57 +0100 Received: from irsmsx605.ger.corp.intel.com (163.33.146.138) by irsmsx602.ger.corp.intel.com (163.33.146.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 17 Apr 2020 15:01:57 +0100 Received: from irsmsx605.ger.corp.intel.com ([163.33.146.138]) by IRSMSX605.ger.corp.intel.com ([163.33.146.138]) with mapi id 15.01.1713.004; Fri, 17 Apr 2020 15:01:57 +0100 From: "Medvedkin, Vladimir" To: Yangchao Zhou , "dev@dpdk.org" CC: "Richardson, Bruce" Thread-Topic: [PATCH] lpm: skip table entries update if rules found Thread-Index: AQHWFL7pyRvHUxGxK065N9lFqllbHah9Vl2Q Date: Fri, 17 Apr 2020 14:01:57 +0000 Message-ID: References: <20200417134830.13600-1-zhouyates@gmail.com> In-Reply-To: <20200417134830.13600-1-zhouyates@gmail.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows x-originating-ip: [163.33.253.164] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] lpm: skip table entries update if rules found X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hi Zhou, NACK. This patch makes lpm inconsistent.=20 >From the programmers guide "If a rule with the same prefix is already present in the table, the next h= op of the rule is updated." So, here in case of presence of a route, next hop will be updated only in r= ules_table which is helper data struct, but won't be updated in lpm data pl= ane struct. -----Original Message----- From: Yangchao Zhou =20 Sent: Friday, April 17, 2020 2:49 PM To: dev@dpdk.org Cc: Richardson, Bruce ; Medvedkin, Vladimir Subject: [PATCH] lpm: skip table entries update if rules found Table entries do not need to be updated if the same rules can be found. Signed-off-by: Yangchao Zhou --- lib/librte_lpm/rte_lpm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 2687= 56419..ee44fc4e5 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -287,7 +287,7 @@ rule_add(struct rte_lpm *lpm, uint32_t ip_masked, uint8= _t depth, if (lpm->rules_tbl[rule_index].ip =3D=3D ip_masked) { lpm->rules_tbl[rule_index].next_hop =3D next_hop; =20 - return rule_index; + return -EEXIST; } } =20 @@ -674,6 +674,10 @@ rte_lpm_add(struct rte_lpm *lpm, uint32_t ip, uint8_t = depth, /* Add the rule to the rule table. */ rule_index =3D rule_add(lpm, ip_masked, depth, next_hop); =20 + /* Skip table entries update if rule is found in rule table */ + if (rule_index =3D=3D -EEXIST) + return 0; + /* If the is no space available for new rule return error. */ if (rule_index < 0) { return rule_index; -- 2.17.1