Date: Wed, 13 May 2015 10:43:50 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r282847 - in stable/9/sys: dev/ixgbe sys Message-ID: <201505131043.t4DAhoqA001446@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Wed May 13 10:43:49 2015 New Revision: 282847 URL: https://svnweb.freebsd.org/changeset/base/282847 Log: MFstable/10 r281951,r281954: r281951: Backport MHSIZE/MPKTHSIZE equivalents from head These macros are equivalent to the ones on head, except they are only exposed when _KERNEL is defined, i.e. to kernel code, whereas the code on head is exposed to userland as well This is for improved forwards compatibility with mbuf(9) macros in head@r277203+, and is required for a clean MFC of r279393 This is a direct commit to stable/10 Differential Revision: https://reviews.freebsd.org/D2126 Reviewed by: glebius, rwatson Sponsored by: EMC / Isilon Storage Division r281954: MFC r279393: 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 Approved/Reviewed by: erj, jfv Sponsored by: EMC / Isilon Storage Division Modified: stable/9/sys/dev/ixgbe/ixgbe.h stable/9/sys/sys/mbuf.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/dev/ixgbe/ixgbe.h ============================================================================== --- stable/9/sys/dev/ixgbe/ixgbe.h Wed May 13 10:35:34 2015 (r282846) +++ stable/9/sys/dev/ixgbe/ixgbe.h Wed May 13 10:43:49 2015 (r282847) @@ -160,8 +160,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) Modified: stable/9/sys/sys/mbuf.h ============================================================================== --- stable/9/sys/sys/mbuf.h Wed May 13 10:35:34 2015 (r282846) +++ stable/9/sys/sys/mbuf.h Wed May 13 10:43:49 2015 (r282847) @@ -174,6 +174,16 @@ struct mbuf { #define m_pktdat M_dat.MH.MH_dat.MH_databuf #define m_dat M_dat.M_databuf +/* + * NOTE: forwards compatibility definitions for mbuf(9) + * + * These aren't 1:1 with the macros in r277203; in particular they're exposed + * to both userland and kernel, whereas this is exposed to just _KERNEL -- to + * avoid disruption with existing KBI/KPIs + */ +#define MHSIZE offsetof(struct mbuf, m_dat) +#define MPKTHSIZE offsetof(struct mbuf, m_pktdat) + /* * mbuf flags. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505131043.t4DAhoqA001446>