aboutsummaryrefslogtreecommitdiff
path: root/website/static/security/patches/EN-16:05/hv_netvsc.patch
blob: d7c19e908c6917c82d0fa8ae4c3680b77a4c1ce5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c.orig
+++ sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -128,6 +128,15 @@
 #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 @@
 			    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;
 		}