mbuf(9): Fix size of mbuf for all 32-bit platforms (i386, ARM, PowerPC and RISCV)

Do this by reducing the size of the MBUF_PEXT_MAX_PGS, causing "struct mbuf" to
be bigger than M_SIZE, and also add a missing padding field to ensure 64-bit
alignment.

Reviewed by:	gallatin@
Reported by:	Elliott Mitchell
Differential revision:	https://reviews.freebsd.org/D35339
MFC after:	1 week
Sponsored by:	NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2022-06-07 21:55:01 +02:00
parent 5d7c65ff36
commit b8394039dc
2 changed files with 7 additions and 4 deletions

View File

@ -184,12 +184,12 @@ CTASSERT(sizeof(struct pkthdr) == 64);
CTASSERT(sizeof(struct m_ext) == 160);
#else
CTASSERT(offsetof(struct mbuf, m_dat) == 24);
CTASSERT(sizeof(struct pkthdr) == 52);
CTASSERT(sizeof(struct pkthdr) == 56);
#if defined(__powerpc__) && defined(BOOKE)
/* PowerPC booke has 64-bit physical pointers. */
CTASSERT(sizeof(struct m_ext) == 184);
CTASSERT(sizeof(struct m_ext) == 176);
#else
CTASSERT(sizeof(struct m_ext) == 180);
CTASSERT(sizeof(struct m_ext) == 172);
#endif
#endif

View File

@ -180,6 +180,9 @@ struct pkthdr {
uint16_t fibnum; /* this packet should use this fib */
uint8_t numa_domain; /* NUMA domain of recvd pkt */
uint8_t rsstype; /* hash type */
#if !defined(__LP64__)
uint32_t pad; /* pad for 64bit alignment */
#endif
union {
uint64_t rcv_tstmp; /* timestamp in ns */
struct {
@ -245,7 +248,7 @@ struct pkthdr {
#if defined(__LP64__)
#define MBUF_PEXT_MAX_PGS (40 / sizeof(vm_paddr_t))
#else
#define MBUF_PEXT_MAX_PGS (72 / sizeof(vm_paddr_t))
#define MBUF_PEXT_MAX_PGS (64 / sizeof(vm_paddr_t))
#endif
#define MBUF_PEXT_MAX_BYTES \