[dpdk-dev] [PATCH] ethdev: fix variable length flow elements support

Gregory Etelson getelson at nvidia.com
Thu Nov 4 06:33:12 CET 2021


Hello Ferruh,

> >   lib/ethdev/rte_flow.c | 6 ++++--
> >   1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/ethdev/rte_flow.c
> b/lib/ethdev/rte_flow.c
> > index d268784532..a93f68abbc 100644
> > --- a/lib/ethdev/rte_flow.c
> > +++ b/lib/ethdev/rte_flow.c
> > @@ -54,11 +54,13 @@
> rte_flow_conv_copy(void *buf, const void *data,
> const size_t size,
> >       /**
> >        * Allow PMD private flow item
> >        */
> > -     size_t sz = type >= 0 ? desc[type].size :
> sizeof(void *);
> > +     bool rte_type = type >= 0;
> > +
> > +     size_t sz = rte_type ? desc[type].size :
> sizeof(void *);
> >       if (buf == NULL || data == NULL)
> >               return 0;
> >       rte_memcpy(buf, data, (size > sz ? sz :
> size));
> > -     if (desc[type].desc_fn)
> 
> Was this (possible) negative array index
> intentional, or are you fixing it?
> 

Negative type values assigned to PMD private items and actions. 
RTE allows private PMD types in flow rules since 
5d1bff8fe2 ethdev: allow negative values in flow rule types
We construct flow rules with private PMD types
to implement tunnel offload.
However, negative type must not be used as index in
rte_flow_desc_item[] and rte_flow_desc_action[] arrays.

> > +     if (rte_type && desc[type].desc_fn)
> >               sz += desc[type].desc_fn(size > 0 ? buf
> : NULL, data);
> >       return sz;
> >   }
> >



More information about the dev mailing list