Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Feb 2015 14:57:57 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279393 - head/sys/dev/ixgbe
Message-ID:  <201502281457.t1SEvv4Y009907@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502281457.t1SEvv4Y009907>