From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0FAC343A20;
	Wed, 31 Jan 2024 21:46:00 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id EE89C406B7;
	Wed, 31 Jan 2024 21:45:59 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id 0202D4026C
 for <dev@dpdk.org>; Wed, 31 Jan 2024 21:45:59 +0100 (CET)
Received: by linux.microsoft.com (Postfix, from userid 1086)
 id 4E8B92057C20; Wed, 31 Jan 2024 12:45:58 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4E8B92057C20
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1706733958;
 bh=1oQSOwuR9VuH7r62xX0YsaxDKw3S6OKnceokIoyTvzw=;
 h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
 b=M4BIeD6HJeUFCbJ1q3EPmlTMka2dYnZFFbh00pWM2aYlTV3XnHYsnnSLDtCd1HJD0
 rigUTP77+fkbC2YViRPeRgD+DHAvfE0G/jcsP9qQwUwY0XLulffO3MCYhAMcnRIWDo
 SVYtr+b2L9LAHwyIxv1lyjlcObn9km68dAQbxTTY=
Date: Wed, 31 Jan 2024 12:45:58 -0800
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, Andrew Boyer <andrew.boyer@amd.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 Chenbo Xia <chenbox@nvidia.com>,
 Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
 Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: Re: [PATCH] mbuf: replace GCC marker extension with C11 anonymous
 unions
Message-ID: <20240131204558.GC11576@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com>
 <1706657173-26166-2-git-send-email-roretzla@linux.microsoft.com>
 <ZbpP7n0AePyXrpeh@bricha3-MOBL.ger.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <ZbpP7n0AePyXrpeh@bricha3-MOBL.ger.corp.intel.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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Wed, Jan 31, 2024 at 01:49:34PM +0000, Bruce Richardson wrote:
> On Tue, Jan 30, 2024 at 03:26:13PM -0800, Tyler Retzlaff wrote:
> > Replace the use of RTE_MARKER<x> with C11 anonymous unions to improve
> > code portability between toolchains.
> > 
> > Update use of rte_mbuf rearm_data field in net/ionic, net/sfc and
> > net/virtio which were accessing field as a zero-length array.
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> >  drivers/net/ionic/ionic_lif.c               |   8 +-
> >  drivers/net/ionic/ionic_rxtx_sg.c           |   4 +-
> >  drivers/net/ionic/ionic_rxtx_simple.c       |   2 +-
> >  drivers/net/sfc/sfc_ef100_rx.c              |   8 +-
> >  drivers/net/sfc/sfc_ef10_rx.c               |  12 +--
> >  drivers/net/virtio/virtio_rxtx_packed_avx.h |   8 +-
> >  lib/mbuf/rte_mbuf_core.h                    | 135 +++++++++++++++-------------
> >  7 files changed, 94 insertions(+), 83 deletions(-)
> > 
> <snip>
> @@ -464,9 +464,10 @@ enum {
> >   * The generic rte_mbuf, containing a packet mbuf.
> >   */
> >  struct rte_mbuf {
> > -	RTE_MARKER cacheline0;
> > -
> > -	void *buf_addr;           /**< Virtual address of segment buffer. */
> > +	union {
> > +	    void *cacheline0;
> > +	    void *buf_addr;           /**< Virtual address of segment buffer. */
> > +	};
> 
> This marker is never used, so we should just look to drop it. I think it
> was originally added to have an equivalent to the cacheline1 marker.

it's actually got a use in one location.

rte_mbuf.h:

static inline void
rte_mbuf_prefetch_part1(struct rte_mbuf *m)
{
        rte_prefetch0(&m->cacheline0);
}

> However, that would be an ABI change, so I'm ok to have this as-is for now.

do you mean api change? just asking to make sure i understand what i'm
doing.

as i understand how this extension (marker) works removing the
cacheline0 marker would not alter the layout of the struct. that is the
sizeof the struct, sizeof any field nor the offset of any field changes
would change by the marker removal.

> 
> /Bruce