Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 2017 22:02:46 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326597 - head/sys/dev/vnic
Message-ID:  <201712052202.vB5M2kOH036986@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Tue Dec  5 22:02:46 2017
New Revision: 326597
URL: https://svnweb.freebsd.org/changeset/base/326597

Log:
  vnic: apply hardware L3 checksum only for IPv4
  
  Previously we set the csum_l3 flag for IPv4 and IPv6, but only IPv4
  should have header checksumming applied.
  
  Prompted by Linux commit fa6d7cb5d76cf0467c61420fc9238045aedfd379.
  
  Reviewed by:	bz
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D13366

Modified:
  head/sys/dev/vnic/nicvf_queues.c

Modified: head/sys/dev/vnic/nicvf_queues.c
==============================================================================
--- head/sys/dev/vnic/nicvf_queues.c	Tue Dec  5 21:42:09 2017	(r326596)
+++ head/sys/dev/vnic/nicvf_queues.c	Tue Dec  5 22:02:46 2017	(r326597)
@@ -1802,6 +1802,8 @@ nicvf_sq_add_hdr_subdesc(struct snd_queue *sq, int qen
 			if (mbuf == NULL)
 				return (ENOBUFS);
 		}
+		if (mbuf->m_pkthdr.csum_flags & CSUM_IP)
+			hdr->csum_l3 = 1; /* Enable IP csum calculation */
 
 		ip = (struct ip *)(mbuf->m_data + ehdrlen);
 		iphlen = ip->ip_hl << 2;
@@ -1809,13 +1811,10 @@ nicvf_sq_add_hdr_subdesc(struct snd_queue *sq, int qen
 		proto = ip->ip_p;
 		break;
 #endif
-	default:
-		hdr->csum_l3 = 0;
 	}
 
 #if defined(INET6) || defined(INET)
 	if (poff > 0 && mbuf->m_pkthdr.csum_flags != 0) {
-		hdr->csum_l3 = 1; /* Enable IP csum calculation */
 		switch (proto) {
 		case IPPROTO_TCP:
 			if ((mbuf->m_pkthdr.csum_flags & CSUM_TCP) == 0)



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