From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Iremonger, Bernard" Subject: Re: [PATCH v5 1/6] librte_table: fix acl entry add and delete functions Date: Fri, 29 Sep 2017 08:25:46 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C24E04BA3D@IRSMSX108.ger.corp.intel.com> References: <1504693668-2062-1-git-send-email-bernard.iremonger@intel.com> <1504802598-27296-2-git-send-email-bernard.iremonger@intel.com> <54CBAA185211B4429112C315DA58FF6D33253912@IRSMSX103.ger.corp.intel.com> <3EB4FA525960D640B5BDFFD6A3D891267BABCE7F@IRSMSX108.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "stable@dpdk.org" To: "Dumitrescu, Cristian" , "Singh, Jasvinder" , "dev@dpdk.org" , "Yigit, Ferruh" , "Ananyev, Konstantin" , "adrien.mazarguil@6wind.com" Return-path: In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891267BABCE7F@IRSMSX108.ger.corp.intel.com> Content-Language: en-US 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 Cristian, > -----Original Message----- > From: Dumitrescu, Cristian > Sent: Wednesday, September 20, 2017 1:21 PM > To: Singh, Jasvinder ; Iremonger, Bernard > ; dev@dpdk.org; Yigit, Ferruh > ; Ananyev, Konstantin > ; adrien.mazarguil@6wind.com > Cc: Iremonger, Bernard ; stable@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v5 1/6] librte_table: fix acl entry add an= d > delete functions >=20 >=20 >=20 > > -----Original Message----- > > From: Singh, Jasvinder > > Sent: Monday, September 18, 2017 4:30 PM > > To: Iremonger, Bernard ; dev@dpdk.org; > > Yigit, Ferruh ; Ananyev, Konstantin > > ; Dumitrescu, Cristian > > ; adrien.mazarguil@6wind.com > > Cc: Iremonger, Bernard ; > stable@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH v5 1/6] librte_table: fix acl entry add > > and delete functions > > > > Hi Bernard, > > > > > > > > > --- a/lib/librte_table/rte_table_acl.c > > > +++ b/lib/librte_table/rte_table_acl.c > > > @@ -316,8 +316,7 @@ struct rte_table_acl { > > > if (status =3D=3D 0) { > > > *key_found =3D 1; > > > *entry_ptr =3D &acl->memory[i * acl->entry_size]; > > > - memcpy(*entry_ptr, entry, acl->entry_size); > > > - > > > + memcpy(entry, *entry_ptr, acl->entry_size); > > > return 0; > > > } > > > } > > > > In this case, table entry which is being added already presents in the = table. > > So, first the pointer to that entry from the memory[] that stores the > > pipeline table data(struct rte_pipeline_table_entry) associated with > > key is retrieved and the changes (action and metadara) are stored in > > the internal table pointed by action_table. So, above fix doesn't seem > correct. > > > > > @@ -353,8 +352,8 @@ struct rte_table_acl { > > > rte_acl_free(acl->ctx); > > > acl->ctx =3D ctx; > > > *key_found =3D 0; > > > - *entry_ptr =3D &acl->memory[free_pos * acl->entry_size]; > > > - memcpy(*entry_ptr, entry, acl->entry_size); > > > + *entry_ptr =3D &acl->acl_rule_memory[free_pos * acl->entry_size]; > > > + memcpy(entry, *entry_ptr, acl->entry_size); > > > > > > return 0; > > > } > > > @@ -435,7 +434,7 @@ struct rte_table_acl { > > > acl->ctx =3D ctx; > > > *key_found =3D 1; > > > if (entry !=3D NULL) > > > - memcpy(entry, &acl->memory[pos * acl->entry_size], > > > + memcpy(entry, &acl->acl_rule_memory[pos * acl- > > > >entry_size], > > > acl->entry_size); > > > > > > Above fixes also seems not correct. As per documentation, *entry_ptr > > is intended to store the handle to the pipeline table entry containing > > the data associated with the current key instead of pointing to memory > > used to store the acl rules, etc. Please refer rte_table_acl_create() > > where memory is initialized and organized to stores different types of > > internal tables (pointed by action_table, acl_rule_list and > acl_rule_memory). >=20 > NACK >=20 > Fully agree with Jasvinder. >=20 > Existing code is correct, proposed code changes are wrong. I will drop this patch and send a v6 patchset. Regards, Bernard.