Author: tuexen
Date: Wed May 30 20:56:07 2012
New Revision: 236332
URL: http://svn.freebsd.org/changeset/base/236332

Log:
  Seperate SCTP checksum offloading for IPv4 and IPv6.
  While there: remove some trainling whitespaces.
  
  MFC after: 3 days
  X-MFC with: 236170

Modified:
  head/sys/net/if_loop.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet6/ip6_forward.c
  head/sys/netinet6/ip6_output.c
  head/sys/sys/mbuf.h

Modified: head/sys/net/if_loop.c
==============================================================================
--- head/sys/net/if_loop.c      Wed May 30 20:49:28 2012        (r236331)
+++ head/sys/net/if_loop.c      Wed May 30 20:56:07 2012        (r236332)
@@ -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 | \

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c      Wed May 30 20:49:28 2012        
(r236331)
+++ head/sys/netinet/sctp_output.c      Wed May 30 20:56:07 2012        
(r236332)
@@ -4478,7 +4478,7 @@ sctp_lowlevel_chunk_output(struct sctp_i
 #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
 #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 iphl
 #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 i
 #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

Modified: head/sys/netinet6/ip6_forward.c
==============================================================================
--- head/sys/netinet6/ip6_forward.c     Wed May 30 20:49:28 2012        
(r236331)
+++ head/sys/netinet6/ip6_forward.c     Wed May 30 20:56:07 2012        
(r236332)
@@ -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;
        }

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c      Wed May 30 20:49:28 2012        
(r236331)
+++ head/sys/netinet6/ip6_output.c      Wed May 30 20:56:07 2012        
(r236332)
@@ -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;

Modified: head/sys/sys/mbuf.h
==============================================================================
--- head/sys/sys/mbuf.h Wed May 30 20:49:28 2012        (r236331)
+++ head/sys/sys/mbuf.h Wed May 30 20:56:07 2012        (r236332)
@@ -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 t
 {
        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, str
 #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 */
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to