From 2688c691800f6933c6b9eeeb46cf522db6f1af5c Mon Sep 17 00:00:00 2001 From: rrs Date: Tue, 3 Feb 2009 11:00:43 +0000 Subject: 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 --- sys/dev/xen/netback/netback.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys/dev/xen/netback') 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 __FBSDID("$FreeBSD$"); +#include "opt_sctp.h" #include #include @@ -57,6 +58,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef SCTP +#include +#include +#endif #include #include @@ -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 -- cgit v1.1