summaryrefslogtreecommitdiffstats
path: root/sys/dev/ixgbe/ixgbe.h
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-02-28 14:57:57 +0000
committerngie <ngie@FreeBSD.org>2015-02-28 14:57:57 +0000
commit645eb89370cf61d556157c5e79e9021c74ef336e (patch)
treea55cfebf20ac3b5fb20df62e77a0ab40ea156836 /sys/dev/ixgbe/ixgbe.h
parent8f6e16a6825f63f55594b1cb1bea3910ede52b43 (diff)
downloadFreeBSD-src-645eb89370cf61d556157c5e79e9021c74ef336e.zip
FreeBSD-src-645eb89370cf61d556157c5e79e9021c74ef336e.tar.gz
Pad RX copy alignment calculation to avoid illegal memory accesses
The optimization made in r239940 is valid for struct mbuf's current structure and size in FreeBSD, but hardcodes assumptions about sizes of struct mbuf, which are unfortunately broken if additional data is added to the beginning of struct mbuf X-MFC note (discussed with rwatson): This change requires the MPKTHSIZE definition, which is only available after head@r277203 and will not be MFCed as it breaks mbuf(9) KPI. A direct commit to stable/10 and merges to other branches to add the necessary definitions to work with the code as-is will be done to facilitate this MFC PR: 194314 MFC after: 2 weeks Approved/Reviewed by: erj, jfv Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/dev/ixgbe/ixgbe.h')
-rw-r--r--sys/dev/ixgbe/ixgbe.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h
index f7e9efa..b69274a 100644
--- a/sys/dev/ixgbe/ixgbe.h
+++ b/sys/dev/ixgbe/ixgbe.h
@@ -162,8 +162,9 @@
* modern Intel CPUs, results in 40 bytes wasted and a significant drop
* in observed efficiency of the optimization, 97.9% -> 81.8%.
*/
-#define IXGBE_RX_COPY_LEN 160
-#define IXGBE_RX_COPY_ALIGN (MHLEN - IXGBE_RX_COPY_LEN)
+#define IXGBE_RX_COPY_HDR_PADDED ((((MPKTHSIZE - 1) / 32) + 1) * 32)
+#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED)
+#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE)
/* Keep older OS drivers building... */
#if !defined(SYSCTL_ADD_UQUAD)
OpenPOWER on IntegriCloud