[PATCH] mbuf: replace GCC marker extension with C11 anonymous unions

Bruce Richardson bruce.richardson at intel.com
Wed Jan 31 14:49:34 CET 2024


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 at 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.

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

/Bruce



More information about the dev mailing list