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 5B5664548C; Tue, 18 Jun 2024 12:47:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2446E40DD5; Tue, 18 Jun 2024 12:47:57 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id A655B40684 for ; Tue, 18 Jun 2024 12:47:56 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 6A12F213FE; Tue, 18 Jun 2024 12:47:56 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: RE: [PATCH v3] net: add bit fields to IPv6 header definition Content-Transfer-Encoding: quoted-printable Date: Tue, 18 Jun 2024 12:47:55 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F531@smartserver.smartshare.dk> In-Reply-To: <20240618095141.290673-1-getelson@nvidia.com> X-MimeOLE: Produced By Microsoft Exchange V6.5 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v3] net: add bit fields to IPv6 header definition Thread-Index: AdrBZTy4COQoz01GQaeS2spUa4xH2AABwlZQ References: <20240618051751.220610-1-getelson@nvidia.com> <20240618095141.290673-1-getelson@nvidia.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Gregory Etelson" , Cc: , , , , , , , , , 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 > struct rte_ipv6_hdr { > - rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. > */ > + union { > + rte_be32_t vtc_flow; /**< IP version, traffic class & flow > label. */ > + __extension__ > + struct { > +#if RTE_BYTE_ORDER =3D=3D RTE_LITTLE_ENDIAN > + rte_be32_t flow_label:20; /**< flow label */ I played around with this in Godbolt, and __attribute__((__packed__)) = only packs bytes, not bits, so the packed structure grows from 4 to 5 = bytes, because the compiler adds 4 bits of padding here, to byte align = the union holding "tc". Please revert to v2. Sorry about the noise. ;-) > + union { > + rte_be32_t tc:8; > + struct { > + rte_be32_t ecn:2; /**< ECN */ > + rte_be32_t ds:6; /**< differentiated > services */ > + }; > + };