Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Aug 2020 09:40:19 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363759 - head/sys/dev/neta
Message-ID:  <202008010940.0719eJM0057883@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mw
Date: Sat Aug  1 09:40:19 2020
New Revision: 363759
URL: https://svnweb.freebsd.org/changeset/base/363759

Log:
  Fix TX csum handling in if_mvneta
  
  The mvneta device requires MVNETA_TX_CMD_L4_CHECKSUM_NONE bit to be set in the tx descriptor is checksum not required. However, mvneta_tx_set_csumflag() is not setting this flag currently, causing the hardware to randomly corrupt IP header during transmission.
  
  This affects injected IPv4 packets that skips kernel IP stack processing (e.g. DHCP), as well as all IPv6 packets, since the driver currently does not offload csum for IPv6.
  
  The fix is to remove all the early return paths from mvneta_tx_set_csumflag() which do not set the MVNETA_TX_CMD_L4_CHECKSUM_NONE flag.
  
  PR: 248306
  Submitted by: Mike Cui <cuicui@gmail.com>
  Reported by: Mike Cui <cuicui@gmail.com>

Modified:
  head/sys/dev/neta/if_mvneta.c

Modified: head/sys/dev/neta/if_mvneta.c
==============================================================================
--- head/sys/dev/neta/if_mvneta.c	Sat Aug  1 09:06:16 2020	(r363758)
+++ head/sys/dev/neta/if_mvneta.c	Sat Aug  1 09:40:19 2020	(r363759)
@@ -2828,18 +2828,15 @@ mvneta_tx_set_csumflag(struct ifnet *ifp,
 	csum_flags = ifp->if_hwassist & m->m_pkthdr.csum_flags;
 	eh = mtod(m, struct ether_header *);
 
-	if (csum_flags == 0)
-		return;
-
 	switch (ntohs(eh->ether_type)) {
 	case ETHERTYPE_IP:
 		ipoff = ETHER_HDR_LEN;
 		break;
-	case ETHERTYPE_IPV6:
-		return;
 	case ETHERTYPE_VLAN:
 		ipoff = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
 		break;
+	default:
+		csum_flags = 0;
 	}
 
 	if (__predict_true(csum_flags & (CSUM_IP|CSUM_IP_TCP|CSUM_IP_UDP))) {



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