Author: royger
Date: Fri Dec 18 14:56:49 2015
New Revision: 292439
URL: https://svnweb.freebsd.org/changeset/base/292439

Log:
  MFC r291156:
  
  Ignore the inbound checksum flags when doing packet forwarding in netvsc
  driver.
  
  Sponsored by: Microsoft OSTC
  PR:           203630

Modified:
  stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c     Fri Dec 18 
14:52:12 2015        (r292438)
+++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c     Fri Dec 18 
14:56:49 2015        (r292439)
@@ -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;
                }
 
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to