summaryrefslogtreecommitdiffstats
path: root/sys/dev/xen/netback
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2009-02-03 11:00:43 +0000
committerrrs <rrs@FreeBSD.org>2009-02-03 11:00:43 +0000
commit2688c691800f6933c6b9eeeb46cf522db6f1af5c (patch)
tree23b147e1d579bbf8d4eb4845fe7846b01184ffc7 /sys/dev/xen/netback
parent3091212869dee5f2673091658796eb1badc0135f (diff)
downloadFreeBSD-src-2688c691800f6933c6b9eeeb46cf522db6f1af5c.zip
FreeBSD-src-2688c691800f6933c6b9eeeb46cf522db6f1af5c.tar.gz
Adds support for SCTP checksum offload. This means
we, like TCP and UDP, move the checksum calculation into the IP routines when there is no hardware support we call into the normal SCTP checksum routine. The next round of SCTP updates will use this functionality. Of course the IGB driver needs a few updates to support the new intel controller set that actually does SCTP csum offload too. Reviewed by: gnn, rwatson, kmacy
Diffstat (limited to 'sys/dev/xen/netback')
-rw-r--r--sys/dev/xen/netback/netback.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/xen/netback/netback.c b/sys/dev/xen/netback/netback.c
index 950a68c..a6111e2 100644
--- a/sys/dev/xen/netback/netback.c
+++ b/sys/dev/xen/netback/netback.c
@@ -30,6 +30,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_sctp.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -57,6 +58,10 @@ __FBSDID("$FreeBSD$");
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
+#ifdef SCTP
+#include <netinet/sctp.h>
+#include <netinet/sctp_crc32.h>
+#endif
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
@@ -295,6 +300,11 @@ fixup_checksum(struct mbuf *m)
htons(IPPROTO_TCP + (iplen - iphlen)));
th->th_sum = in_cksum_skip(m, iplen + sizeof(*eh), sizeof(*eh) + iphlen);
m->m_pkthdr.csum_flags &= ~CSUM_TCP;
+#ifdef SCTP
+ } else if (sw_csum & CSUM_SCTP) {
+ sctp_delayed_cksum(m);
+ sw_csum &= ~CSUM_SCTP;
+#endif
} else {
u_short csum;
struct udphdr *uh = (struct udphdr *)((caddr_t)ip + iphlen);
@@ -908,7 +918,8 @@ netif_rx(netif_t *netif)
#ifdef XEN_NETBACK_FIXUP_CSUM
/* Check if we need to compute a checksum. This happens */
/* when bridging from one domain to another. */
- if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA))
+ if ((m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) ||
+ (m->m_pkthdr.csum_flags & CSUM_SCTP))
fixup_checksum(m);
#endif
OpenPOWER on IntegriCloud