Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2018 19:10:43 +0000 (UTC)
From:      Eric Joyner <erj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340256 - head/sys/dev/ixl
Message-ID:  <201811081910.wA8JAh2E004677@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: erj
Date: Thu Nov  8 19:10:43 2018
New Revision: 340256
URL: https://svnweb.freebsd.org/changeset/base/340256

Log:
  ixl/iavf(4): Fix TSO offloads when TXCSUM is disabled
  
  From Jake:
  The iflib stack does not disable TSO automatically when TXCSUM is
  disabled, instead assuming that the driver will correctly handle TSOs
  even when CSUM_IP is not set.
  
  This results in iflib calling ixl_isc_txd_encap with packets which have
  CSUM_IP_TSO, but do not have CSUM_IP or CSUM_IP_TCP set. Because of
  this, ixl_tx_setup_offload will not setup the IPv4 checksum offloading.
  
  This results in bad TSO packets being sent if a user disables TXCSUM
  without disabling TSO.
  
  Fix this by updating the ixl_tx_setup_offload function to check both
  CSUM_IP and CSUM_IP_TSO when deciding whether to enable IPv4 checksums.
  
  Once this is corrected, another issue for TSO packets is revealed. The
  driver sets IFLIB_NEED_ZERO_CSUM in order to enable a work around that
  causes the ip->sum field to be zero'd. This is necessary for ixl
  hardware to correctly perform TSOs.
  
  However, if TXCSUM is disabled, then the work around is not enabled, as
  CSUM_IP will not be set when the iflib stack checks to see if it should
  clear the sum field.
  
  Fix this by adding IFLIB_TSO_INIT_IP to the iflib flags for the iavf and
  ixl interface files.
  
  It is uncertain if the hardware needs IFLIB_NEED_ZERO_CSUM for any other
  case besides TSO, so leave that flag assigned. It may be worth
  investigating to see if this work around flag could be disabled in
  a future change.
  
  Once both of these changes are made, the ixl driver should correctly
  offload TSO packets when TSO4 offload is enabled, regardless of whether
  TXCSUM is enabled or disabled.
  
  Submitted by:	Jacob Keller <jacob.e.keller@intel.com>
  Reviewed by:	erj@, shurd@
  MFC after:	0 days
  Sponsored by:	Intel Corporation
  Differential Revision:	https://reviews.freebsd.org/D17900

Modified:
  head/sys/dev/ixl/if_iavf.c
  head/sys/dev/ixl/if_ixl.c
  head/sys/dev/ixl/ixl.h
  head/sys/dev/ixl/ixl_txrx.c

Modified: head/sys/dev/ixl/if_iavf.c
==============================================================================
--- head/sys/dev/ixl/if_iavf.c	Thu Nov  8 17:20:00 2018	(r340255)
+++ head/sys/dev/ixl/if_iavf.c	Thu Nov  8 19:10:43 2018	(r340256)
@@ -260,7 +260,7 @@ static struct if_shared_ctx iavf_sctx_init = {
 	.isc_vendor_info = iavf_vendor_info_array,
 	.isc_driver_version = IAVF_DRIVER_VERSION_STRING,
 	.isc_driver = &iavf_if_driver,
-	.isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | IFLIB_IS_VF,
+	.isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | IFLIB_TSO_INIT_IP | IFLIB_IS_VF,
 
 	.isc_nrxd_min = {IXL_MIN_RING},
 	.isc_ntxd_min = {IXL_MIN_RING},

Modified: head/sys/dev/ixl/if_ixl.c
==============================================================================
--- head/sys/dev/ixl/if_ixl.c	Thu Nov  8 17:20:00 2018	(r340255)
+++ head/sys/dev/ixl/if_ixl.c	Thu Nov  8 19:10:43 2018	(r340256)
@@ -323,7 +323,7 @@ static struct if_shared_ctx ixl_sctx_init = {
 	.isc_vendor_info = ixl_vendor_info_array,
 	.isc_driver_version = IXL_DRIVER_VERSION_STRING,
 	.isc_driver = &ixl_if_driver,
-	.isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | IFLIB_ADMIN_ALWAYS_RUN,
+	.isc_flags = IFLIB_NEED_SCRATCH | IFLIB_NEED_ZERO_CSUM | IFLIB_TSO_INIT_IP | IFLIB_ADMIN_ALWAYS_RUN,
 
 	.isc_nrxd_min = {IXL_MIN_RING},
 	.isc_ntxd_min = {IXL_MIN_RING},

Modified: head/sys/dev/ixl/ixl.h
==============================================================================
--- head/sys/dev/ixl/ixl.h	Thu Nov  8 17:20:00 2018	(r340255)
+++ head/sys/dev/ixl/ixl.h	Thu Nov  8 19:10:43 2018	(r340256)
@@ -258,6 +258,8 @@
 	(CSUM_IP_UDP|CSUM_IP6_UDP)
 #define IXL_CSUM_SCTP \
 	(CSUM_IP_SCTP|CSUM_IP6_SCTP)
+#define IXL_CSUM_IPV4 \
+	(CSUM_IP|CSUM_IP_TSO)
 
 /* Pre-11 counter(9) compatibility */
 #if __FreeBSD_version >= 1100036

Modified: head/sys/dev/ixl/ixl_txrx.c
==============================================================================
--- head/sys/dev/ixl/ixl_txrx.c	Thu Nov  8 17:20:00 2018	(r340255)
+++ head/sys/dev/ixl/ixl_txrx.c	Thu Nov  8 19:10:43 2018	(r340256)
@@ -225,7 +225,7 @@ ixl_tx_setup_offload(struct ixl_tx_queue *que,
 	switch (pi->ipi_etype) {
 #ifdef INET
 		case ETHERTYPE_IP:
-			if (pi->ipi_csum_flags & CSUM_IP)
+			if (pi->ipi_csum_flags & IXL_CSUM_IPV4)
 				*cmd |= I40E_TX_DESC_CMD_IIPT_IPV4_CSUM;
 			else
 				*cmd |= I40E_TX_DESC_CMD_IIPT_IPV4;



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