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 6AB2DA058A; Fri, 17 Apr 2020 17:07:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 476441E93B; Fri, 17 Apr 2020 17:07:34 +0200 (CEST) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id CCDD81E92D for ; Fri, 17 Apr 2020 17:07:32 +0200 (CEST) Received: by mail-io1-f65.google.com with SMTP id i3so2584873ioo.13 for ; Fri, 17 Apr 2020 08:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:cc; bh=l4rK/MV5Glv4gH6qTLYRHVNSi0cS3aUtMlIVF1oJWrY=; b=S6+dnmGTHWRfEhOcyiMzGFQVoJCRr/3s8DGrGjCSJ5wlNEEkBe8chuxq5OctRilCpZ 7yLp2lQgaiE3G/Iw+QpG2GhNCLfmJAhsKec6tRU2fERzicXUPykUHEPkO6mWIqc1XKkw TvaqxvVHaEjR5+OjCATtOtr3QwGs1XDspW5e090ABylnmjUq1ixD44dxARD63uVTfgRa M5eTgXbqIz8Z+5Xn2RZmiDv5vENTfE8HdwB/fXHqDvVCcDn0fX3lTiznMArWfkmAy4Iy G5+99g0XVKh0j0JUMDXYkzK3n2Mcm2cNvFu6JQri35J3UMMQFzS1YH2Mg2eeUmbV98JK WAGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:cc; bh=l4rK/MV5Glv4gH6qTLYRHVNSi0cS3aUtMlIVF1oJWrY=; b=NxW1CyLWa1u2nawkt4x1bgWVH5VwQKCLM6B02ZorHn2/rk8Kp28SVfNsPe8bYxgJAr lBlxtw/YQ4Er/dDGXl8bl4lgX6Zd/wC27VfWLY3wA9mUUAL8WlOYNz3QTHpdpW1ujb/m Oh4Ybg5xEAxaY9F+XX07wK9H3+8Vyjm1c9b1iyavQGt5WP/ybs2ItJGz38Pr2MgYRTZ0 +B86XH26yAn5HWvqQA/icP+tNKTl6BKxPO3pNVRC4k00gAwHph1+cbUWsrfNq6e43dig GFaE9+WZ3MOROgv3IPL1AlNbFuaHuOSYBDr0HW3U6Vj1X4bKihqW30LZ2y9itzjTCiKp o3NQ== X-Gm-Message-State: AGi0Pua87qB2G1oVQU/creUvJsmk9aqXboaTIqBVrjo4OE4jMGkHve0/ QWnTtcMjayuLqsMPmbXQ0ARX4uMO4E32wtpgsXdnuQ== X-Received: by 2002:a02:211a:: with SMTP id e26mt3769100jaa.141.1587136050747; Fri, 17 Apr 2020 08:07:30 -0700 (PDT) MIME-Version: 1.0 References: <20200417134830.13600-1-zhouyates@gmail.com> In-Reply-To: From: Yangchao Zhou Date: Fri, 17 Apr 2020 23:07:19 +0800 Message-ID: Cc: "dev@dpdk.org" , "Richardson, Bruce" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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" ++ dev@dpdk.org On Fri, Apr 17, 2020 at 10:38 PM Yangchao Zhou wrote: > Hi Vladimir, > > Thanks, you are right. I saw that the next hop is also in lpm table > entries. > On the basis of the same route, skiping the table entries update only if > the next hop is also the same. > > On Fri, Apr 17, 2020 at 10:04 PM Medvedkin, Vladimir < > vladimir.medvedkin@intel.com> wrote: > >> Hi Zhou, >> >> NACK. >> This patch makes lpm inconsistent. >> From the programmers guide >> "If a rule with the same prefix is already present in the table, the next >> hop of the rule is updated." >> So, here in case of presence of a route, next hop will be updated only in >> rules_table which is helper data struct, but won't be updated in lpm data >> plane struct. >> >> -----Original Message----- >> From: Yangchao Zhou >> Sent: Friday, April 17, 2020 2:49 PM >> To: dev@dpdk.org >> Cc: Richardson, Bruce ; Medvedkin, Vladimir < >> vladimir.medvedkin@intel.com> >> 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 >> 268756419..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 == ip_masked) { >> lpm->rules_tbl[rule_index].next_hop = >> next_hop; >> >> - return rule_index; >> + return -EEXIST; >> } >> } >> >> @@ -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 = rule_add(lpm, ip_masked, depth, next_hop); >> >> + /* Skip table entries update if rule is found in rule table */ >> + if (rule_index == -EEXIST) >> + return 0; >> + >> /* If the is no space available for new rule return error. */ >> if (rule_index < 0) { >> return rule_index; >> -- >> 2.17.1 >> >>