svn commit: r347233 - head/sys/dev/virtio/network

Michael Tuexen tuexen at FreeBSD.org
Tue May 7 20:28:13 UTC 2019


Author: tuexen
Date: Tue May  7 20:28:12 2019
New Revision: 347233
URL: https://svnweb.freebsd.org/changeset/base/347233

Log:
  Remove non-functional SCTP checksum offload support for virtio.
  
  Checksum offloading for SCTP is not currently specified for virtio.
  If the hypervisor announces checksum offloading support, it means TCP
  and UDP checksum offload. If an SCTP packet is sent and the host announced
  checksum offload support, the hypervisor inserts the IP checksum (16-bit)
  at the correct offset, but this is not the right checksum, which is a CRC32c.
  This results in all outgoing packets having the wrong checksum and therefore
  breaking SCTP based communications.
  
  This patch removes SCTP checksum offloading support from the virtio
  network interface.
  
  Thanks to Felix Weinrank for making me aware of the issue.
  
  Reviewed by:		bryanv@
  MFC after:		1 week
  Differential Revision:	https://reviews.freebsd.org/D20147

Modified:
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/dev/virtio/network/if_vtnetvar.h

Modified: head/sys/dev/virtio/network/if_vtnet.c
==============================================================================
--- head/sys/dev/virtio/network/if_vtnet.c	Tue May  7 19:48:39 2019	(r347232)
+++ head/sys/dev/virtio/network/if_vtnet.c	Tue May  7 20:28:12 2019	(r347233)
@@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$");
 #include <netinet6/ip6_var.h>
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
-#include <netinet/sctp.h>
 #include <netinet/netdump/netdump.h>
 
 #include <machine/bus.h>
@@ -1525,9 +1524,6 @@ vtnet_rxq_csum_by_offset(struct vtnet_rxq *rxq, struct
 		m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
 		m->m_pkthdr.csum_data = 0xFFFF;
 		break;
-	case offsetof(struct sctphdr, checksum):
-		m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
-		break;
 	default:
 		sc->vtnet_stats.rx_csum_bad_offset++;
 		return (1);
@@ -1584,11 +1580,6 @@ vtnet_rxq_csum_by_parse(struct vtnet_rxq *rxq, struct 
 			return (1);
 		m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
 		m->m_pkthdr.csum_data = 0xFFFF;
-		break;
-	case IPPROTO_SCTP:
-		if (__predict_false(m->m_len < offset + sizeof(struct sctphdr)))
-			return (1);
-		m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
 		break;
 	default:
 		/*

Modified: head/sys/dev/virtio/network/if_vtnetvar.h
==============================================================================
--- head/sys/dev/virtio/network/if_vtnetvar.h	Tue May  7 19:48:39 2019	(r347232)
+++ head/sys/dev/virtio/network/if_vtnetvar.h	Tue May  7 20:28:12 2019	(r347233)
@@ -268,8 +268,8 @@ struct vtnet_mac_filter {
 CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE);
 
 #define VTNET_TX_TIMEOUT	5
-#define VTNET_CSUM_OFFLOAD	(CSUM_TCP | CSUM_UDP | CSUM_SCTP)
-#define VTNET_CSUM_OFFLOAD_IPV6	(CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6)
+#define VTNET_CSUM_OFFLOAD	(CSUM_TCP | CSUM_UDP)
+#define VTNET_CSUM_OFFLOAD_IPV6	(CSUM_TCP_IPV6 | CSUM_UDP_IPV6)
 
 #define VTNET_CSUM_ALL_OFFLOAD	\
     (VTNET_CSUM_OFFLOAD | VTNET_CSUM_OFFLOAD_IPV6 | CSUM_TSO)


More information about the svn-src-all mailing list