From owner-svn-src-all@FreeBSD.ORG Wed May 13 10:43:51 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E884DE40; Wed, 13 May 2015 10:43:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D598B12E7; Wed, 13 May 2015 10:43:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4DAhoQY001448; Wed, 13 May 2015 10:43:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4DAhoqA001446; Wed, 13 May 2015 10:43:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201505131043.t4DAhoqA001446@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 13 May 2015 10:43:50 +0000 (UTC) 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 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 May 2015 10:43:51 -0000 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. */