[dpdk-dev] [EXT] Re: [PATCH 1/3] mbuf: add Tx offloads for packet marking

Ananyev, Konstantin konstantin.ananyev at intel.com
Wed Jun 3 12:31:35 CEST 2020


> > > > > > I also share Olivier's concern about consuming 3 bits in ol_flags for that feature.
> > > > > > Can it probably be squeezed somehow?
> > > > > > Let say we reserve one flag that this information is present or not, and
> > > > > > re-use one of rx-only fields for store additional information (packet_type, or so).
> > > > > > Or might be some other approach.
> > > > >
> > > > > We are fine with this approach where we define one bit in Tx offloads for pkt
> > > > > marking and and 3 bits reused from Rx offload flags area.
> > > > >
> > > > > For example:
> > > > >
> > > > > @@ -186,10 +186,16 @@ extern "C" {
> > > > >
> > > > >  /* add new RX flags here, don't forget to update PKT_FIRST_FREE */
> > > > >
> > > > > +/* Reused Rx offload bits for Tx offloads */
> > > > > +#define PKT_X_TX_MARK_VLAN_DEI         (1ULL << 0)
> > > > > +#define PKT_X_TX_MARK_IP_DSCP          (1ULL << 1)
> > > > > +#define PKT_X_TX_MARK_IP_ECN           (1ULL << 2)
> > > > > +
> > > > >  #define PKT_FIRST_FREE (1ULL << 23)
> > > > > -#define PKT_LAST_FREE (1ULL << 40)
> > > > > +#define PKT_LAST_FREE (1ULL << 39)
> > > > >
> > > > >  /* add new TX flags here, don't forget to update PKT_LAST_FREE  */
> > > > > +#define PKT_TX_MARK_EN         (1ULL << 40)
> > > > >
> > > > > Is this fine ?
> > > >
> > > > Any thoughts on this approach which uses only 1 bit in Tx flags out of 18
> > > > and reuse unused Rx flag bits ?
> >
> > My thought was not about re-defining the flags (I think it is better to keep them intact),
> > but adding a union for one of rx-only fields (packet_type/rss/timestamp).
> 
> Ok. Adding a union field at packet_type field is also fine like below.
> 
> @@ -187,9 +187,10 @@ extern "C" {
>  /* add new RX flags here, don't forget to update PKT_FIRST_FREE */
> 
>  #define PKT_FIRST_FREE (1ULL << 23)
> -#define PKT_LAST_FREE (1ULL << 40)
> +#define PKT_LAST_FREE (1ULL << 39)
> 
>  /* add new TX flags here, don't forget to update PKT_LAST_FREE  */
> +#define PKT_TX_MARK_EN		(1ULL << 40)
> 
>  /**
>   * Outer UDP checksum offload flag. This flag is used for enabling
> @@ -461,6 +462,14 @@ enum {
>  #endif
>  };
> 
> +/* Tx packet marking flags in rte_mbuf::tx_mark.
> + * Valid only when PKT_TX_MARK_EN is set in
> + * rte_mbuf::ol_flags.
> + */
> +#define TX_MARK_VLAN_DEI	(1ULL << 0)
> +#define TX_MARK_IP_DSCP	(1ULL << 1)
> +#define TX_MARK_IP_ECN		(1ULL << 2)
> +
>  /**
>   * The generic rte_mbuf, containing a packet mbuf.
>   */
> @@ -543,6 +552,10 @@ struct rte_mbuf {
>  			};
>  			uint32_t inner_l4_type:4; /**< Inner L4 type. */
>  		};
> +		struct {
> +			uint32_t reserved:29;
> +			uint32_t tx_mark:3;
> +		};
>  	};
> 
> 
> 
> Please correct me if this is not what you mean.
> 

Yes, I thought about something like that.


More information about the dev mailing list