From mboxrd@z Thu Jan 1 00:00:00 1970 From: "=?GBK?B?uunT4L/CKLrp0+C/wik=?=" Subject: =?utf-8?b?562U5aSNOiBbUEFUQ0hdIGxpYi9scG06Zml4IHR3byBp?= =?utf-8?q?ssues_in_the_delete=5Fdepth=5Fsmall=28=29?= Date: Wed, 28 Oct 2015 12:03:26 +0800 Message-ID: <00a201d11135$98e9e7e0$cabdb7a0$@alibaba-inc.com> References: <1446003855-5947-1-git-send-email-jijiang.liu@intel.com> Reply-To: =?GBK?B?uunT4L/CKLrp0+C/wik=?= Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org To: "=?GBK?B?xMfEyCi649TCKQ==?=" 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) In-Reply-To: Content-Language: zh-cn List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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