From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4133-50.mail.aliyun.com (out4133-50.mail.aliyun.com [42.120.133.50]) by dpdk.org (Postfix) with ESMTP id 130805A64 for ; Wed, 28 Oct 2015 05:03:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1446005007; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=/7oicAGhcd7avyqVgt4Y9s8uL3kYno6gtRBmOC1vyTA=; b=MkAiJjBNxSFBjmQmID3iWv7T5NzG9WCfJY/AvAKmkHtBk7njNlgRhA7iD046ke8t8etac8zWoTN23bzff/ju0dLAKp9lwWSkBpOZfdnf+hgjGaZh9714f3Ws00xuAH03Zh/ZoDvd4p8b8YhgcR4hdJm/c/+3nBr/zGyBKmDN6MI= X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R151e4; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e02c03267; MF=yuke.hyk@alibaba-inc.com; NM=1; PH=DS; RN=3; SR=0; Received: from ali65416n(mailfrom:yuke.hyk@alibaba-inc.com ip:42.120.74.159) by smtp.aliyun-inc.com(127.0.0.1); Wed, 28 Oct 2015 12:03:26 +0800 From: "=?GBK?B?uunT4L/CKLrp0+C/wik=?=" To: "=?GBK?B?xMfEyCi649TCKQ==?=" References: <1446003855-5947-1-git-send-email-jijiang.liu@intel.com> In-Reply-To: Date: Wed, 28 Oct 2015 12:03:26 +0800 Message-ID: <00a201d11135$98e9e7e0$cabdb7a0$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQEeSk+lSapCqZ0YqpfghUwaBOq7DwFT0dWdn9s35iA= Content-Language: zh-cn X-Mailman-Approved-At: Thu, 29 Oct 2015 08:37:49 +0100 Cc: dev@dpdk.org Subject: [dpdk-dev] =?utf-8?b?562U5aSNOiBbUEFUQ0hdIGxpYi9scG06Zml4IHR3byBp?= =?utf-8?q?ssues_in_the_delete=5Fdepth=5Fsmall=28=29?= X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: =?GBK?B?uunT4L/CKLrp0+C/wik=?= List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Oct 2015 04:03:29 -0000 Acked by=EF=BC=9A yuke.hyk@alibaba-inc.com -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- =E5=8F=91=E4=BB=B6=E4=BA=BA: nana.nn [mailto:nana.nn@alibaba-inc.com]=20 =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: = 2015=E5=B9=B410=E6=9C=8828=E6=97=A5 12:02 =E6=94=B6=E4=BB=B6=E4=BA=BA: = "=E6=B4=AA=E4=BD=99=E6=9F=AF(=E9=A3=8E=E6=9D=BE)" =E6=8A=84=E9=80=81: dev@dpdk.org; Jijiang Liu =E4=B8=BB=E9=A2=98: Re: [PATCH] lib/lpm:fix two issues in the = delete_depth_small() HI: yuke=EF=BC=8Cplease acked-by~=20 On Oct 28, 2015, at 11:44 AM, Jijiang Liu wrote: > Fix two issues in the delete_depth_small() function. >=20 > 1> The control is not strict in this function. >=20 > In the following structure, > struct rte_lpm_tbl24_entry { > union { > uint8_t next_hop; > uint8_t tbl8_gindex; > }; > uint8_t ext_entry :1; > } >=20 > When ext_entry =3D 0, use next_hop.only to process = rte_lpm_tbl24_entry. >=20 > When ext_entry =3D 1, use tbl8_gindex to process the = rte_lpm_tbl8_entry. >=20 > When using LPM24 + 8 algorithm, it will use ext_entry to decide to = process rte_lpm_tbl24_entry structure or rte_lpm_tbl8_entry structure.=20 > If a route is deleted, the prefix of previous route is used to = override the deleted route. when (lpm->tbl24[i].ext_entry =3D=3D 0 && = lpm->tbl24[i].depth > depth)=20 > it should be ignored, but due to the incorrect logic, the next_hop is = used as tbl8_gindex and will process the rte_lpm_tbl8_entry. >=20 > 2> Initialization of rte_lpm_tbl8_entry is incorrect in this function=20 >=20 > In this function, use new rte_lpm_tbl8_entry we call A to replace the = old rte_lpm_tbl8_entry. But the valid_group do not set VALID, so it will = be INVALID. > Then when adding a new route which depth is > 24,the tbl8_alloc() = function will search the rte_lpm_tbl8_entrys to find INVALID = valid_group,=20 > and it will return the A to the add_depth_big function, so A's data is = overridden. >=20 > Signed-off-by: NaNa >=20 > --- > lib/librte_lpm/rte_lpm.c | 7 +++---- > 1 files changed, 3 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c > index 163ba3c..3981452 100644 > --- a/lib/librte_lpm/rte_lpm.c > +++ b/lib/librte_lpm/rte_lpm.c > @@ -734,8 +734,7 @@ delete_depth_small(struct rte_lpm *lpm, uint32_t = ip_masked, > if (lpm->tbl24[i].ext_entry =3D=3D 0 && > lpm->tbl24[i].depth <=3D depth ) { > lpm->tbl24[i].valid =3D INVALID; > - } > - else { > + } else if (lpm->tbl24[i].ext_entry =3D=3D 1) { > /* > * If TBL24 entry is extended, then there has > * to be a rule with depth >=3D 25 in the > @@ -770,6 +769,7 @@ delete_depth_small(struct rte_lpm *lpm, uint32_t = ip_masked, >=20 > struct rte_lpm_tbl8_entry new_tbl8_entry =3D { > .valid =3D VALID, > + .valid_group =3D VALID, > .depth =3D sub_rule_depth, > .next_hop =3D lpm->rules_tbl > [sub_rule_index].next_hop, > @@ -780,8 +780,7 @@ delete_depth_small(struct rte_lpm *lpm, uint32_t = ip_masked, > if (lpm->tbl24[i].ext_entry =3D=3D 0 && > lpm->tbl24[i].depth <=3D depth ) { > lpm->tbl24[i] =3D new_tbl24_entry; > - } > - else { > + } else if (lpm->tbl24[i].ext_entry =3D=3D 1) { > /* > * If TBL24 entry is extended, then there has > * to be a rule with depth >=3D 25 in the > --=20 > 1.7.7.6