From a6cff10f2a6e0d4f9bc32b78bd410af6fd5372c4 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Wed, 30 May 2012 20:56:07 +0000 Subject: [PATCH] Seperate SCTP checksum offloading for IPv4 and IPv6. While there: remove some trainling whitespaces. MFC after: 3 days X-MFC with: 236170 --- sys/net/if_loop.c | 2 +- sys/netinet/sctp_output.c | 8 ++++---- sys/netinet6/ip6_forward.c | 8 ++++---- sys/netinet6/ip6_output.c | 22 +++++++++++----------- sys/sys/mbuf.h | 16 ++++++++-------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 23eb450f3f4..8d371eb172e 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -92,7 +92,7 @@ #endif #define LO_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP) -#define LO_CSUM_FEATURES6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP) +#define LO_CSUM_FEATURES6 (CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_SCTP_IPV6) #define LO_CSUM_SET (CSUM_DATA_VALID | CSUM_DATA_VALID_IPV6 | \ CSUM_PSEUDO_HDR | \ CSUM_IP_CHECKED | CSUM_IP_VALID | \ diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 80d40755b2b..eab6fdb2d62 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -4478,7 +4478,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - m->m_pkthdr.csum_flags = CSUM_SCTP; + m->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; m->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -11072,7 +11072,7 @@ sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout->m_pkthdr.csum_flags = CSUM_SCTP; + mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -12179,7 +12179,7 @@ sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag, #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout->m_pkthdr.csum_flags = CSUM_SCTP; + mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -12443,7 +12443,7 @@ sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag, #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout->m_pkthdr.csum_flags = CSUM_SCTP; + mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; mout->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index 93c7bf21123..3321a95bf42 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -587,7 +587,7 @@ skip_routing: m->m_pkthdr.csum_data = 0xffff; } #ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP) + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif error = netisr_queue(NETISR_IPV6, m); @@ -607,9 +607,9 @@ skip_routing: m->m_pkthdr.csum_data = 0xffff; } #ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP) - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; -#endif + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) + m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif error = netisr_queue(NETISR_IPV6, m); goto out; } diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index fddb45b5276..df4e1b0b07f 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -508,7 +508,7 @@ skip_ipsec2:; #ifdef FLOWTABLE if (ro == &ip6route) { struct flentry *fle; - + /* * The flow table returns route entries valid for up to 30 * seconds; we rely on the remainder of ip_output() taking no @@ -521,7 +521,7 @@ skip_ipsec2:; flevalid = 1; } } -#endif +#endif again: /* * if specified, try to fill in the traffic class field. @@ -667,7 +667,7 @@ again: /* * The outgoing interface must be in the zone of source and - * destination addresses. + * destination addresses. */ origifp = ifp; @@ -693,7 +693,7 @@ again: goto badscope; } - /* We should use ia_ifp to support the case of + /* We should use ia_ifp to support the case of * sending packets to an address of our own. */ if (ia != NULL && ia->ia_ifp) @@ -891,7 +891,7 @@ again: m->m_pkthdr.csum_data = 0xffff; } #ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP) + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif error = netisr_queue(NETISR_IPV6, m); @@ -911,9 +911,9 @@ again: m->m_pkthdr.csum_data = 0xffff; } #ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP) + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; -#endif +#endif error = netisr_queue(NETISR_IPV6, m); goto done; } @@ -965,8 +965,8 @@ passout: in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); } #ifdef SCTP - if (sw_csum & CSUM_SCTP) { - sw_csum &= ~CSUM_SCTP; + if (sw_csum & CSUM_SCTP_IPV6) { + sw_csum &= ~CSUM_SCTP_IPV6; sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); } #endif @@ -1081,9 +1081,9 @@ passout: m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } #ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP) { + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { sctp_delayed_cksum(m, hlen); - m->m_pkthdr.csum_flags &= ~CSUM_SCTP; + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; } #endif mnext = &m->m_nextpkt; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 679f86e72a3..38adfaf2ffa 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -115,7 +115,7 @@ struct pkthdr { /* variables for ip and tcp reassembly */ void *header; /* pointer to packet header */ int len; /* total packet length */ - uint32_t flowid; /* packet's 4-tuple system + uint32_t flowid; /* packet's 4-tuple system * flow identifier */ /* variables for hardware checksum */ @@ -283,7 +283,7 @@ struct mbuf { #define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */ #define CSUM_TSO 0x0020 /* will do TSO */ #define CSUM_SCTP 0x0040 /* will csum SCTP */ -/* CSUM_SCTP_IPV6 0x0080 will csum IPv6/SCTP */ +#define CSUM_SCTP_IPV6 0x0080 /* will csum IPv6/SCTP */ #define CSUM_IP_CHECKED 0x0100 /* did csum IP */ #define CSUM_IP_VALID 0x0200 /* ... the csum is valid */ @@ -427,7 +427,7 @@ static __inline int m_gettype(int size) { int type; - + switch (size) { case MSIZE: type = EXT_MBUF; @@ -457,7 +457,7 @@ static __inline uma_zone_t m_getzone(int size) { uma_zone_t zone; - + switch (size) { case MCLBYTES: zone = zone_clust; @@ -639,7 +639,7 @@ m_free_fast(struct mbuf *m) if (m->m_flags & M_PKTHDR) KASSERT(SLIST_EMPTY(&m->m_pkthdr.tags), ("doing fast free of mbuf with tags")); #endif - + uma_zfree_arg(zone_mbuf, m, (void *)MB_NOTAGS); } @@ -699,7 +699,7 @@ m_cljset(struct mbuf *m, void *cl, int type) { uma_zone_t zone; int size; - + switch (type) { case EXT_CLUSTER: size = MCLBYTES; @@ -751,7 +751,7 @@ m_last(struct mbuf *m) extern void (*m_addr_chg_pf_p)(struct mbuf *m); -static __inline void +static __inline void m_addr_changed(struct mbuf *m) { @@ -1119,7 +1119,7 @@ m_tag_find(struct mbuf *m, int type, struct m_tag *start) #define M_SETFIB(_m, _fib) do { \ _m->m_flags &= ~M_FIB; \ _m->m_flags |= (((_fib) << M_FIBSHIFT) & M_FIB); \ -} while (0) +} while (0) #endif /* _KERNEL */