DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Gregory Etelson" <getelson@nvidia.com>, <dev@dpdk.org>
Cc: <mkashani@nvidia.com>, <bruce.richardson@intel.com>,
	<jasvinder.singh@intel.com>, <konstantin.v.ananyev@yandex.ru>,
	<ruifeng.wang@arm.com>, <andrew.rybchenko@oktetlabs.ru>,
	<cristian.dumitrescu@intel.com>, <ferruh.yigit@amd.com>,
	<orika@nvidia.com>, <thomas@monjalon.net>
Subject: RE: [PATCH] net: add bit fields to IPv6 header definition
Date: Tue, 18 Jun 2024 09:02:25 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F52A@smartserver.smartshare.dk> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F528@smartserver.smartshare.dk>

> From: Morten Brørup [mailto:mb@smartsharesystems.com]
> 
> > From: Gregory Etelson [mailto:getelson@nvidia.com]
> > Sent: Tuesday, 18 June 2024 07.18
> >
> > DPDK IPv6 header definition combined the `version`, `traffic class`
> > and `flow label` header fields into a single 32 bits structure member
> > `vtc_flow`.
> >
> > The patch expands IPv6 header definition with dedicated structure
> > members for the `version`, `traffic class` and `flow label` fields.
> > The patch also preserves existing `vtc_flow` structure member for
> > backward compatibility.
> 
> Good addition.
> I had been wondering why we didn't have this already. :-)
> 
> >
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > ---
> >  lib/net/rte_ip.h | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
> > index 0d103d4127..26e78a6624 100644
> > --- a/lib/net/rte_ip.h
> > +++ b/lib/net/rte_ip.h
> > @@ -524,7 +524,21 @@ rte_ipv4_udptcp_cksum_mbuf_verify(const struct rte_mbuf
> > *m,
> >   * IPv6 Header
> >   */
> >  struct rte_ipv6_hdr {
> > -	rte_be32_t vtc_flow;	/**< IP version, traffic class & flow label.
> > */
> > +	__extension__
> > +	union {
> > +		rte_be32_t vtc_flow;        /**< IP version, traffic class & flow
> > label. */
> 
> The mbuf structure [1] has __extension__ here,
> i.e. preceding the structure following the integer field,
> instead of preceding the union.
> 
> [1]: https://git.dpdk.org/dpdk/tree/lib/mbuf/rte_mbuf_core.h#n520
> 
> > +		struct {
> > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> > +			uint32_t flow_label:24; /**< flow label */
> 
> Flow Label is 20 bits, not 24.

I forgot to mention that the flow_label field should be rte_be32_t instead of uint32_t.

> 
> > +			uint32_t tc:4;     /**< traffic class */
> 
> TC is 8 bits, not 4.

While you are at it, please also expand the "tc" field to another union with dedicated fields for "dscp:6" and "ecn:2", keeping the combined "tc" field too. The same goes for the IPv4 "type_of_service" field. This expansion could go into a separate patch, possibly in the same series.

> 
> > +			uint32_t version:4; /**< version */
> > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > +			uint8_t version:4; /**< version */
> > +			uint8_t tc:4;     /**< traffic class */
> 
> :8, not :4.
> 
> > +			uint32_t flow_label:24; /**< flow label */
> 
> :20, not :24.
> 
> > +#endif
> > +		};
> > +	};
> >  	rte_be16_t payload_len;	/**< IP payload size, including ext. headers
> > */
> >  	uint8_t  proto;		/**< Protocol, next header. */
> >  	uint8_t  hop_limits;	/**< Hop limits. */
> > --
> > 2.43.0


  reply	other threads:[~2024-06-18  7:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18  5:17 Gregory Etelson
2024-06-18  6:42 ` Morten Brørup
2024-06-18  7:02   ` Morten Brørup [this message]
2024-06-18  8:07     ` Etelson, Gregory
2024-06-19  0:11   ` Tyler Retzlaff
2024-06-19  4:31     ` Etelson, Gregory
2024-06-18  7:58 ` [PATCH v2] " Gregory Etelson
2024-06-18  8:11   ` Morten Brørup
2024-06-18  9:51 ` [PATCH v3] " Gregory Etelson
2024-06-18 10:47   ` Morten Brørup
2024-06-18 12:18 ` [PATCH v4] " Gregory Etelson
2024-06-18 12:44   ` Morten Brørup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35E9F52A@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=getelson@nvidia.com \
    --cc=jasvinder.singh@intel.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=mkashani@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).