BR

Rongwei

 



From: Thomas Monjalon <thomas@monjalon.net>
Sent: Wednesday, June 5, 2024 15:13
To: Dariusz Sosnowski <dsosnowski@nvidia.com>; rongwei liu <rongweil@nvidia.com>
Cc: dev@dpdk.org <dev@dpdk.org>; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang <yuying.zhang@intel.com>; Ferruh Yigit <ferruh.yigit@amd.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [PATCH v4 2/3] ethdev: add VXLAN last reserved field
 
External email: Use caution opening links or attachments


05/06/2024 03:16, rongwei liu:
> From: Thomas Monjalon <thomas@monjalon.net>
> > 04/06/2024 18:40, Dariusz Sosnowski:
> > > > > 04/06/2024 14:38, Rongwei Liu:
> > > > > > --- a/app/test-pmd/cmdline_flow.c
> > > > > > +++ b/app/test-pmd/cmdline_flow.c
> > > > > > @@ -1006,6 +1006,7 @@ static const char *const flow_field_ids[] =
> > > > > > {
> > > > > >
> > > > > >       "ipv6_flow_label", "ipv6_traffic_class",
> > > > > >       "esp_spi", "esp_seq_num", "esp_proto",
> > > > > >       "random",
> > > > > >
> > > > > > +     "vxlan_last_rsvd",
> > > > > >
> > > > > >       NULL
> > > > > >
> > > > > >  };
> > > > >
> > > > > How vxlan_last_rsvd is linked to RTE_FLOW_FIELD_VXLAN_RSVD1 in
> > > > > testpmd?
> > > > > Just because it is the same order?
> > >
> > > Yes, it's because of the order.
> > > We should refactor this to use array designators.
> > >
> > > > > > --- a/lib/ethdev/rte_flow.h
> > > > > > +++ b/lib/ethdev/rte_flow.h
> > > > > > @@ -2428,6 +2428,7 @@ enum rte_flow_field_id {
> > > > > >
> > > > > >       RTE_FLOW_FIELD_ESP_SEQ_NUM,     /**< ESP Sequence Number. */
> > > > > >       RTE_FLOW_FIELD_ESP_PROTO,       /**< ESP next protocol
> > > > > >       value. */
> > > > > >       RTE_FLOW_FIELD_RANDOM,          /**< Random value. */
> > > > > >
> > > > > > +     RTE_FLOW_FIELD_VXLAN_RSVD1,     /**< VXLAN last reserved
> > > > > > byte. */
> > > > > >
> > > > > >  };
> > > > >
> > > > > I think we should use the same naming as in testpmd.
> > > > > What about RTE_FLOW_FIELD_VXLAN_LAST_RSVD?
> > > >
> > > > To be honest, no strong objection per my personal thought.
> > > > Considering the API "vxlan_hdr" names this field as "uint8_t rsvd1",
> > > > maybe RTE_FLOW_FIELD_VXLAN_RSVD1 will be clearer for user as 1 vs 1
> > > > mapping?> > >
> > > +1 on using RSVD1 so it matches rte_vxlan_hdr definition.
> > >
> > > In this patch, "vxlan_last_rsvd" is used in testpmd, so it matches
> > > existing "last_rsvd" field in VXLAN item. If we choose to use "rsvd1",
> > > we should probably rename all other instances of "last_rsvd" to match.> >
> > I prefer "vxlan_last_rsvd" for 2 reasons:
> >         - it is more meaningful
> >         - we are adding first, second and third reserved fields to match
> >         the 3 bytes of rsvd0 (patch to come)
>
> Sound clear and reasonable. I would like to propose the alignment between rte_flow_field_id and rte_vxlan_hdr:
>
>   1.
> RTE_FLOW_FIELD_VXLAN_RSVD1  ---> RTE_FLOW_FIELD_VXLAN_LAST_RSVD
>   2.
> "uint8_t rsvd1"  ---->  "uint8_t last_rsvd"

We don't change rte_vxlan_hdr, because we avoid breaking compatibility.

How about to add a new union:

union {
    uint8_t rsvd1;
    uint8_t last_rsvd;
}
 RTE_FLOW_FIELD_VXLAN_LAST_RSVD will perfectly match the rte_vxlan_hdr definition.