svn commit: r279393 - head/sys/dev/ixgbe

Garrett Cooper ngie at FreeBSD.org
Sat Feb 28 14:57:58 UTC 2015


Author: ngie
Date: Sat Feb 28 14:57:57 2015
New Revision: 279393
URL: https://svnweb.freebsd.org/changeset/base/279393

Log:
  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 at 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

Modified:
  head/sys/dev/ixgbe/ixgbe.h

Modified: head/sys/dev/ixgbe/ixgbe.h
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.h	Sat Feb 28 12:02:32 2015	(r279392)
+++ head/sys/dev/ixgbe/ixgbe.h	Sat Feb 28 14:57:57 2015	(r279393)
@@ -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)


More information about the svn-src-all mailing list