git: 59481c7db234 - main - LinuxKPI: skbuff: fix types, shuffle fields

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Tue, 22 Apr 2025 23:46:17 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=59481c7db2340c9e64f9d3d9d05dafc2d72c157e

commit 59481c7db2340c9e64f9d3d9d05dafc2d72c157e
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-04-14 21:05:38 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-04-22 23:45:49 +0000

    LinuxKPI: skbuff: fix types, shuffle fields
    
    Fix the types of a few remaining fields.
    Shuffle the fields around so the important ones align to 64byte on a
    64bit platform.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/include/linux/skbuff.h | 45 ++++++++++++++---------
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index 7a8521e6fd38..8fe6bf158bc6 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -154,37 +154,46 @@ struct sk_buff {
 		};
 		struct list_head	list;
 	};
+
+	uint8_t			*head;			/* Head of buffer. */
+	uint8_t			*data;			/* Head of data. */
+	uint8_t			*tail;			/* End of data. */
+	uint8_t			*end;			/* End of buffer. */
+
 	uint32_t		len;		/* ? */
 	uint32_t		data_len;	/* ? If we have frags? */
+	union {
+		__wsum			csum;
+		struct {
+			uint16_t	csum_offset;
+			uint16_t	csum_start;
+		};
+	};
+	uint16_t		protocol;
+	uint8_t			ip_summed;
+	/* uint8_t */
+
+	/* "Scratch" area for layers to store metadata. */
+	/* ??? I see sizeof() operations so probably an array. */
+	uint8_t			cb[64] __aligned(CACHE_LINE_SIZE);
+
+	struct skb_shared_info	*shinfo	__aligned(CACHE_LINE_SIZE);
+
 	uint32_t		truesize;	/* The total size of all buffers, incl. frags. */
-	uint16_t		mac_len;	/* Link-layer header length. */
-	__sum16			csum;
-	uint16_t		l3hdroff;	/* network header offset from *head */
-	uint16_t		l4hdroff;	/* transport header offset from *head */
 	uint32_t		priority;
 	uint16_t		qmap;		/* queue mapping */
 	uint16_t		_flags;		/* Internal flags. */
 #define	_SKB_FLAGS_SKBEXTFRAG	0x0001
-	enum sk_buff_pkt_type	pkt_type;
+	uint16_t		l3hdroff;	/* network header offset from *head */
+	uint16_t		l4hdroff;	/* transport header offset from *head */
 	uint16_t		mac_header;	/* offset of mac_header */
+	uint16_t		mac_len;	/* Link-layer header length. */
+	enum sk_buff_pkt_type	pkt_type;
 	refcount_t		refcnt;
 
-	/* "Scratch" area for layers to store metadata. */
-	/* ??? I see sizeof() operations so probably an array. */
-	uint8_t			cb[64] __aligned(CACHE_LINE_SIZE);
-
 	struct net_device	*dev;
 	void			*sk;		/* XXX net/sock.h? */
 
-	int		csum_offset, csum_start, ip_summed, protocol;
-
-	uint8_t			*head;			/* Head of buffer. */
-	uint8_t			*data;			/* Head of data. */
-	uint8_t			*tail;			/* End of data. */
-	uint8_t			*end;			/* End of buffer. */
-
-	struct skb_shared_info	*shinfo;
-
 	/* FreeBSD specific bandaid (see linuxkpi_kfree_skb). */
 	void			*m;
 	void(*m_free_func)(void *);