> -----Original Message-----
> From: Ferruh Yigit <ferruh.yi...@amd.com>
> Sent: Wednesday, January 31, 2024 7:54 PM
>
> On 1/31/2024 5:43 PM, Ori Kam wrote:
> >
> >
> >> -----Original Message-----
> >> From: Ferruh Yigit <ferruh.yi...@amd.com>
> >> Sent: Wednesday, January 31, 2024 6:46 PM
> >> Subject: Re: [PATCH v3 2/3] ethdev: add compare item
> >>
> >> On 1/31/2024 3:56 PM, Ori Kam wrote:
> >>> Hi
> >>>
> >>>> -----Original Message-----
> >>>> From: Suanming Mou <suanmi...@nvidia.com>
> >>>> Sent: Wednesday, January 31, 2024 4:48 AM
> >>>>
> >>>> Hi,
> >>>>
> >>>>> -----Original Message-----
> >>>>> From: Ferruh Yigit <ferruh.yi...@amd.com>
> >>>>> Sent: Wednesday, January 31, 2024 1:34 AM
> >>>>> To: Suanming Mou <suanmi...@nvidia.com>; Ori Kam
> >>>> <or...@nvidia.com>;
> >>>>> Aman Singh <aman.deep.si...@intel.com>; Yuying Zhang
> >>>>> <yuying.zh...@intel.com>; NBU-Contact-Thomas Monjalon
> (EXTERNAL)
> >>>>> <tho...@monjalon.net>; Andrew Rybchenko
> >>>>> <andrew.rybche...@oktetlabs.ru>
> >>>>> Cc: dev@dpdk.org
> >>>>> Subject: Re: [PATCH v3 2/3] ethdev: add compare item
> >>>>>
> >>>>> On 1/15/2024 9:13 AM, Suanming Mou wrote:
> >>>>>> The new item type is added for the case user wants to match traffic
> >>>>>> based on packet field compare result with other fields or immediate
> >>>>>> value.
> >>>>>>
> >>>>>> e.g. take advantage the compare item user will be able to accumulate
> a
> >>>>>> IPv4/TCP packet's TCP data_offset and IPv4 IHL field to a tag
> >>>>>> register, then compare the tag register with IPv4 header total length
> >>>>>> to understand the packet has payload or not.
> >>>>>>
> >>>>>
> >>>>> ack, above sample makes it easier to understand.
> >>>>>
> >>>>> This patch is adding testpmd commands, can you please provide some
> >>>> sample
> >>>>> commands in commit log?
> >>>>> The more samples are better, as far as I remember there was a
> testpmd
> >>>>> documentation that documents the sample usages, can you please
> check
> >>>> for it?
> >>>
> >>> [Snip ..]
> >>>
> >>>>>
> >>>>>> +/**
> >>>>>> + * @warning
> >>>>>> + * @b EXPERIMENTAL: this structure may change without prior
> notice
> >>>>>> + *
> >>>>>> + * Field description for packet field.
> >>>>>> + */
> >>>>>> +struct rte_flow_field_data {
> >>>>>> + enum rte_flow_field_id field; /**< Field or memory type ID.
> */
> >>>>>> + union {
> >>>>>> + struct {
> >>>>>> + /** Encapsulation level and tag index or flex
> item
> >>>>> handle. */
> >>>>>> + union {
> >>>>>> + struct {
> >>>>>> + /**
> >>>>>> + * Packet encapsulation level
> >>>> containing
> >>>>>> + * the field to modify.
> >>>>>> + *
> >>>>>> + * - @p 0 requests the default
> >>>> behavior.
> >>>>>> + * Depending on the packet
> type, it
> >>>>>> + * can mean outermost,
> innermost
> >>>> or
> >>>>>> + * anything in between.
> >>>>>> + *
> >>>>>> + * It basically stands for the
> >>>>>> + * innermost encapsulation
> level.
> >>>>>> + * Modification can be
> performed
> >>>>>> + * according to PMD and
> device
> >>>>>> + * capabilities.
> >>>>>> + *
> >>>>>> + * - @p 1 requests
> modification to be
> >>>>>> + * performed on the
> outermost
> >>>> packet
> >>>>>> + * encapsulation level.
> >>>>>> + *
> >>>>>> + * - @p 2 and subsequent
> values
> >>>>> request
> >>>>>> + * modification to be
> performed on
> >>>>>> + * the specified inner packet
> >>>>>> + * encapsulation level, from
> >>>>>> + * outermost to innermost
> (lower to
> >>>>>> + * higher values).
> >>>>>> + *
> >>>>>> + * Values other than @p 0 are
> not
> >>>>>> + * necessarily supported.
> >>>>>> + *
> >>>>>> + * @note that for MPLS field,
> >>>>>> + * encapsulation level also
> include
> >>>>>> + * tunnel since MPLS may
> appear in
> >>>>>> + * outer, inner or tunnel.
> >>>>>> + */
> >>>>>> + uint8_t level;
> >>>>>> + union {
> >>>>>> + /**
> >>>>>> + * Tag index array
> inside
> >>>>>> + * encapsulation level.
> >>>>>> + * Used for VLAN,
> MPLS or
> >>>> TAG
> >>>>> types.
> >>>>>> + */
> >>>>>> + uint8_t tag_index;
> >>>>>> + /**
> >>>>>> + * Geneve option
> identifier.
> >>>>>> + * Relevant only for
> >>>>>> + *
> >>>>> RTE_FLOW_FIELD_GENEVE_OPT_XXXX
> >>>>>> + * modification type.
> >>>>>> + */
> >>>>>> + struct {
> >>>>>> + /**
> >>>>>> + * Geneve
> option
> >>>> type.
> >>>>>> + */
> >>>>>> + uint8_t type;
> >>>>>> + /**
> >>>>>> + * Geneve
> option
> >>>> class.
> >>>>>> + */
> >>>>>> + rte_be16_t
> class_id;
> >>>>>> + };
> >>>>>> + };
> >>>>>> + };
> >>>>>> + struct rte_flow_item_flex_handle
> >>>> *flex_handle;
> >>>>>> + };
> >>>>>> + /** Number of bits to skip from a field. */
> >>>>>> + uint32_t offset;
> >>>>>> + };
> >>>>>> + /**
> >>>>>> + * Immediate value for RTE_FLOW_FIELD_VALUE,
> presented
> >>>> in
> >>>>> the
> >>>>>> + * same byte order and length as in relevant
> >>>> rte_flow_item_xxx.
> >>>>>> + * The immediate source bitfield offset is inherited
> from
> >>>>>> + * the destination's one.
> >>>>>> + */
> >>>>>> + uint8_t value[16];
> >>>>>> + /**
> >>>>>> + * Memory address for RTE_FLOW_FIELD_POINTER,
> memory
> >>>>> layout
> >>>>>> + * should be the same as for relevant field in the
> >>>>>> + * rte_flow_item_xxx structure.
> >>>>>> + */
> >>>>>> + void *pvalue;
> >>>>>> + };
> >>>>>> +};
> >>>>>> +
> >>>>>>
> >>>>>
> >>>>> I am aware that you are just moving the above struct, but it is nested
> too
> >>>> much
> >>>>> which is making it hard to read.
> >>>>>
> >>>>> As you are touching it, can we extract some structs and make this
> struct
> >> less
> >>>>> nested, what do you think?
> >>>>> Of course it needs to be done in separate patch, as a
> preperation/clean-
> >> up
> >>>> patch
> >>>>> before moving it around.
> >>>>
> >>>> Agree the struct maybe a bit nested. But not sure how it was discussed
> >>>> before during the last new member was added... @Ori, Do you have
> any
> >> idea
> >>>> about this?
> >>>>
> >>>
> >>> As far as I remember, it was never discussed,
> >>>
> >>> I think for this series we should keep it as is, and revise it later.
> >>>
> >>
> >> If you don't want to make this set more complex with this, that is OK as
> >> long as it is addressed at some point.
> >
> > Agree,
> > If you have suggestions, I will be more than happy to hear.
> >
>
> For the struct?
> Simply extracting the inner structs as named structs to reduce the
> nested structs, does this make sense?
>
Yes that make sense.