svn commit: r363759 - head/sys/dev/neta

Marcin Wojtas mw at FreeBSD.org
Sat Aug 1 09:40:20 UTC 2020


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 at gmail.com>
  Reported by: Mike Cui <cuicui at 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))) {


More information about the svn-src-head mailing list