[dpdk-dev] [PATCH v5 1/6] librte_table: fix acl entry add and delete functions
Dumitrescu, Cristian
cristian.dumitrescu at intel.com
Wed Sep 20 14:21:11 CEST 2017
> -----Original Message-----
> From: Singh, Jasvinder
> Sent: Monday, September 18, 2017 4:30 PM
> To: Iremonger, Bernard <bernard.iremonger at intel.com>; dev at dpdk.org;
> Yigit, Ferruh <ferruh.yigit at intel.com>; Ananyev, Konstantin
> <konstantin.ananyev at intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu at intel.com>; adrien.mazarguil at 6wind.com
> Cc: Iremonger, Bernard <bernard.iremonger at intel.com>; stable at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v5 1/6] librte_table: fix acl entry add and
> delete functions
>
> Hi Bernard,
>
> <snip>
>
> > --- 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 == 0) {
> > *key_found = 1;
> > *entry_ptr = &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 = ctx;
> > *key_found = 0;
> > - *entry_ptr = &acl->memory[free_pos * acl->entry_size];
> > - memcpy(*entry_ptr, entry, acl->entry_size);
> > + *entry_ptr = &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 = ctx;
> > *key_found = 1;
> > if (entry != 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).
NACK
Fully agree with Jasvinder.
Existing code is correct, proposed code changes are wrong.
More information about the dev
mailing list