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 2FC9243CAD; Thu, 14 Mar 2024 17:51:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B352142E74; Thu, 14 Mar 2024 17:51:33 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8609140297; Thu, 14 Mar 2024 17:51:31 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id CABA820B74C0; Thu, 14 Mar 2024 09:51:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CABA820B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710435090; bh=SmAYKpsOMuvEk0cSVoY0Cn6G0TjNmGw6AiOxmf+M+z8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YQ3H/1tg90I9hHH1oQbz5JBuI8G/rU3dpTYxNa3H/4PXloumMuLM7bd3BDjroAFfV CRbIRsvUYbqMRMy5p5F4iJVVcUTQN+WTrMxtb8CR94Sh7ukPwhpgB1Ynb2E6zV9oAA bXONsHPz3FA0SpIoQdwYrahk3gskNdXzozEGTn0Q= Date: Thu, 14 Mar 2024 09:51:30 -0700 From: Tyler Retzlaff To: dev@dpdk.org, techboard@dpdk.org Cc: Ajit Khaparde , Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Chengwen Feng , Dariusz Sosnowski , David Christensen , Hyong Youb Kim , Jerin Jacob , Jie Hai , Jingjing Wu , John Daley , Kevin Laatz , Kiran Kumar K , Konstantin Ananyev , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nithin Dabilpuram , Ori Kam , Ruifeng Wang , Satha Rao , Somnath Kotur , Suanming Mou , Sunil Kumar Kori , Viacheslav Ovsiienko , Yisen Zhuang , Yuying Zhang , mb@smartsharesystems.com Subject: Re: [PATCH v6 02/23] mbuf: consolidate driver asserts for mbuf struct Message-ID: <20240314165130.GA30010@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-3-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1709012499-12813-3-git-send-email-roretzla@linux.microsoft.com> 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 We've gone around in circles a little on this series. Let's discuss it at the next techboard meeting, please put it on the agenda. Summary MSVC does not support the typedef of zero-sized typed arrays used in struct rte_mbuf and a handful of other structs built on Windows. Better known as ``RTE_MARKER`` fields. There are two competing solutions we would like to know which to move forward with. 1. Use C11 anonymous unions and anonymous struct extensions to replace the RTE_MARKER fields which can maintain ABI and API compatibility. 2. Provide inline accessors for struct rte_mbuf for some fields and removing others which maintains ABI but breaks API. I'm proposing a mix of 1 & 2 to maintain ABI and some API for struct rte_mbuf fields but remove (API breaking) cacheline{0,1} RTE_MARKER fields in favor of existing inline functions for prefetching. Thanks! On Mon, Feb 26, 2024 at 09:41:18PM -0800, Tyler Retzlaff wrote: > Collect duplicated RTE_BUILD_BUG_ON checks from drivers and place them > at global scope with struct rte_mbuf definition using static_assert. > > Signed-off-by: Tyler Retzlaff > --- > lib/mbuf/rte_mbuf_core.h | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h > index 7000c04..36551c2 100644 > --- a/lib/mbuf/rte_mbuf_core.h > +++ b/lib/mbuf/rte_mbuf_core.h > @@ -16,8 +16,11 @@ > * New fields and flags should fit in the "dynamic space". > */ > > +#include > +#include > #include > > +#include > #include > #include > > @@ -673,6 +676,37 @@ struct rte_mbuf { > uint32_t dynfield1[9]; /**< Reserved for dynamic fields. */ > } __rte_cache_aligned; > > +static_assert(!(offsetof(struct rte_mbuf, ol_flags) != > + offsetof(struct rte_mbuf, rearm_data) + 8), "ol_flags"); > +static_assert(!(offsetof(struct rte_mbuf, rearm_data) != > + RTE_ALIGN(offsetof(struct rte_mbuf, rearm_data), 16)), "rearm_data"); > +static_assert(!(offsetof(struct rte_mbuf, data_off) != > + offsetof(struct rte_mbuf, rearm_data)), "data_off"); > +static_assert(!(offsetof(struct rte_mbuf, data_off) < > + offsetof(struct rte_mbuf, rearm_data)), "data_off"); > +static_assert(!(offsetof(struct rte_mbuf, refcnt) < > + offsetof(struct rte_mbuf, rearm_data)), "refcnt"); > +static_assert(!(offsetof(struct rte_mbuf, nb_segs) < > + offsetof(struct rte_mbuf, rearm_data)), "nb_segs"); > +static_assert(!(offsetof(struct rte_mbuf, port) < > + offsetof(struct rte_mbuf, rearm_data)), "port"); > +static_assert(!(offsetof(struct rte_mbuf, data_off) - > + offsetof(struct rte_mbuf, rearm_data) > 6), "data_off"); > +static_assert(!(offsetof(struct rte_mbuf, refcnt) - > + offsetof(struct rte_mbuf, rearm_data) > 6), "refcnt"); > +static_assert(!(offsetof(struct rte_mbuf, nb_segs) - > + offsetof(struct rte_mbuf, rearm_data) > 6), "nb_segs"); > +static_assert(!(offsetof(struct rte_mbuf, port) - > + offsetof(struct rte_mbuf, rearm_data) > 6), "port"); > +static_assert(!(offsetof(struct rte_mbuf, pkt_len) != > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4), "pkt_len"); > +static_assert(!(offsetof(struct rte_mbuf, data_len) != > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8), "data_len"); > +static_assert(!(offsetof(struct rte_mbuf, vlan_tci) != > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 10), "vlan_tci"); > +static_assert(!(offsetof(struct rte_mbuf, hash) != > + offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12), "hash"); > + > /** > * Function typedef of callback to free externally attached buffer. > */ > -- > 1.8.3.1