From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1AD794549D; Wed, 19 Jun 2024 02:11:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4AC14021D; Wed, 19 Jun 2024 02:11:06 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6C3B44014F for ; Wed, 19 Jun 2024 02:11:05 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8978920B7004; Tue, 18 Jun 2024 17:11:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8978920B7004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1718755864; bh=4Aiu5eLDu6AVygw990iMFAiX8N8MgibDj0835/Y3XTg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=krTj2mAXmSDaLgKqj6hF+balFK5kfhWex8OzfFpihJSSxw44oHnhWMv+a0/yvVvld pkJRTGhMBx4ERNRxEwOWfxbXbYur4rBu5aWYcf09EjxK00p1eZ6QurlqhwIKQQiGXj GXZidSsO10Xsl3AwhWl9thx+VRfz9vPLkYYp/jM8= Date: Tue, 18 Jun 2024 17:11:04 -0700 From: Tyler Retzlaff To: Morten =?iso-8859-1?Q?Br=F8rup?= Cc: Gregory Etelson , dev@dpdk.org, 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 Message-ID: <20240619001104.GA13189@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20240618051751.220610-1-getelson@nvidia.com> <98CBD80474FA8B44BF855DF32C47DC35E9F528@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F528@smartserver.smartshare.dk> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Jun 18, 2024 at 08:42:53AM +0200, Morten Brørup wrote: > > 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 > > --- > > 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 +1 anonymous unions are standard C so __extension__ is not necessary, it is necessary for an anonymous struct. > > > + struct { > > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN > > + uint32_t flow_label:24; /**< flow label */ > > Flow Label is 20 bits, not 24. > > > + uint32_t tc:4; /**< traffic class */ > > TC is 8 bits, not 4. > > > + 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 >