pad out m_hdr to make pkthdr word-aligned

shuffle pkthdr.len so that pkthdr.header is aligned without compiler added padding

Reviewed by: rwatson, andre, sam
This commit is contained in:
Kip Macy 2007-04-14 19:42:20 +00:00
parent d0cf96b407
commit 38073c4181

View File

@ -77,6 +77,12 @@ struct mb_args {
}; };
#endif /* _KERNEL */ #endif /* _KERNEL */
#if defined(__LP64__)
#define M_HDR_PAD 6
#else
#define M_HDR_PAD 2
#endif
/* /*
* Header present at the beginning of every mbuf. * Header present at the beginning of every mbuf.
*/ */
@ -87,6 +93,7 @@ struct m_hdr {
int mh_len; /* amount of data in this mbuf */ int mh_len; /* amount of data in this mbuf */
int mh_flags; /* flags; see below */ int mh_flags; /* flags; see below */
short mh_type; /* type of data in this mbuf */ short mh_type; /* type of data in this mbuf */
uint8_t pad[M_HDR_PAD];/* word align */
}; };
/* /*
@ -105,9 +112,9 @@ struct m_tag {
*/ */
struct pkthdr { struct pkthdr {
struct ifnet *rcvif; /* rcv interface */ struct ifnet *rcvif; /* rcv interface */
int len; /* total packet length */
/* variables for ip and tcp reassembly */ /* variables for ip and tcp reassembly */
void *header; /* pointer to packet header */ void *header; /* pointer to packet header */
int len; /* total packet length */
/* variables for hardware checksum */ /* variables for hardware checksum */
int csum_flags; /* flags regarding checksum */ int csum_flags; /* flags regarding checksum */
int csum_data; /* data field used by csum routines */ int csum_data; /* data field used by csum routines */