svn commit: r291156 - head/sys/dev/hyperv/netvsc

Wei Hu whu at FreeBSD.org
Sun Nov 22 05:26:15 UTC 2015


Author: whu
Date: Sun Nov 22 05:26:13 2015
New Revision: 291156
URL: https://svnweb.freebsd.org/changeset/base/291156

Log:
  Ignore the inbound checksum flags when doing packet forwarding in netvsc driver.
  
  PR: 20363
  Submitted by: whu
  Reviewed by: royger, whu
  Approved by: royger
  MFC after: 1 week
  Relnotes: No
  Sponsored by: Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D4131

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Sun Nov 22 02:43:14 2015	(r291155)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Sun Nov 22 05:26:13 2015	(r291156)
@@ -128,6 +128,15 @@ __FBSDID("$FreeBSD$");
 #define HV_NV_SC_PTR_OFFSET_IN_BUF         0
 #define HV_NV_PACKET_OFFSET_IN_BUF         16
 
+/*
+ * A unified flag for all outbound check sum flags is useful,
+ * and it helps avoiding unnecessary check sum calculation in
+ * network forwarding scenario.
+ */
+#define HV_CSUM_FOR_OUTBOUND						\
+    (CSUM_IP|CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP|CSUM_IP_TSO|		\
+    CSUM_IP_ISCSI|CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP|		\
+    CSUM_IP6_TSO|CSUM_IP6_ISCSI)
 
 /*
  * Data types
@@ -570,7 +579,8 @@ hn_start_locked(struct ifnet *ifp)
 			    packet->vlan_tci & 0xfff;
 		}
 
-		if (0 == m_head->m_pkthdr.csum_flags) {
+		/* Only check the flags for outbound and ignore the ones for inbound */
+		if (0 == (m_head->m_pkthdr.csum_flags & HV_CSUM_FOR_OUTBOUND)) {
 			goto pre_send;
 		}
 


More information about the svn-src-head mailing list