Author: kmacy
Date: Fri Apr 10 06:16:14 2009
New Revision: 190880
URL: http://svn.freebsd.org/changeset/base/190880

Log:
  Import "flowid" support for serializing flows across transmit queues
  
  Reviewed by:  rwatson and jeli

Modified:
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_output.c
  head/sys/netinet/tcp_input.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_sge.c        Fri Apr 10 05:26:14 2009        
(r190879)
+++ head/sys/dev/cxgb/cxgb_sge.c        Fri Apr 10 06:16:14 2009        
(r190880)
@@ -2879,6 +2879,7 @@ process_responses(adapter_t *adap, struc
                        eop = get_packet(adap, drop_thresh, qs, 
&rspq->rspq_mbuf, r);
 #endif
 #ifdef IFNET_MULTIQUEUE
+                       rspq->rspq_mh.mh_head->m_flags |= M_FLOWID;
                        rspq->rspq_mh.mh_head->m_pkthdr.flowid = rss_hash;
 #endif                 
                        ethpad = 2;

Modified: head/sys/netinet/in_pcb.h
==============================================================================
--- head/sys/netinet/in_pcb.h   Fri Apr 10 05:26:14 2009        (r190879)
+++ head/sys/netinet/in_pcb.h   Fri Apr 10 06:16:14 2009        (r190880)
@@ -167,7 +167,7 @@ struct inpcb {
        u_char  inp_ip_ttl;             /* (i) time to live proto */
        u_char  inp_ip_p;               /* (c) protocol proto */
        u_char  inp_ip_minttl;          /* (i) minimum TTL or drop */
-       uint32_t inp_ispare1;           /* (x) connection id / queue id */
+       uint32_t inp_flowid;            /* (x) flow id / queue id */
        u_int   inp_refcount;           /* (i) refcount */
        void    *inp_pspare[2];         /* (x) rtentry / general use */
 
@@ -416,6 +416,8 @@ void        inp_4tuple_get(struct inpcb *inp, 
 #define        INP_ONESBCAST           0x02000000 /* send all-ones broadcast */
 #define        INP_DROPPED             0x04000000 /* protocol drop flag */
 #define        INP_SOCKREF             0x08000000 /* strong socket reference */
+#define        INP_SW_FLOWID           0x10000000 /* software generated flow 
id */
+#define        INP_HW_FLOWID           0x20000000 /* hardware generated flow 
id */
 #define        IN6P_RFC2292            0x40000000 /* used RFC2292 API on the 
socket */
 #define        IN6P_MTU                0x80000000 /* receive path MTU */
 

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c        Fri Apr 10 05:26:14 2009        
(r190879)
+++ head/sys/netinet/ip_output.c        Fri Apr 10 06:16:14 2009        
(r190880)
@@ -153,6 +153,10 @@ ip_output(struct mbuf *m, struct mbuf *o
        if (inp != NULL) {
                M_SETFIB(m, inp->inp_inc.inc_fibnum);
                INP_LOCK_ASSERT(inp);
+               if (inp->inp_flags & (INP_HW_FLOWID|INP_SW_FLOWID)) {
+                       m->m_pkthdr.flowid = inp->inp_flowid;
+                       m->m_flags |= M_FLOWID;
+               }
        }
 
        if (opt) {

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c        Fri Apr 10 05:26:14 2009        
(r190879)
+++ head/sys/netinet/tcp_input.c        Fri Apr 10 06:16:14 2009        
(r190880)
@@ -594,7 +594,14 @@ findpcb:
                goto dropwithreset;
        }
        INP_WLOCK(inp);
-
+       if (!(inp->inp_flags & INP_HW_FLOWID)
+           && (m->m_flags & M_FLOWID)
+           && ((inp->inp_socket == NULL)
+               || !(inp->inp_socket->so_options & SO_ACCEPTCONN))) {
+               inp->inp_flags |= INP_HW_FLOWID;
+               inp->inp_flags &= ~INP_SW_FLOWID;
+               inp->inp_flowid = m->m_pkthdr.flowid;
+       }
 #ifdef IPSEC
 #ifdef INET6
        if (isipv6 && ipsec6_in_reject(m, inp)) {

Modified: head/sys/sys/mbuf.h
==============================================================================
--- head/sys/sys/mbuf.h Fri Apr 10 05:26:14 2009        (r190879)
+++ head/sys/sys/mbuf.h Fri Apr 10 06:16:14 2009        (r190880)
@@ -199,6 +199,7 @@ struct mbuf {
 #define        M_PROTO6        0x00080000 /* protocol-specific */
 #define        M_PROTO7        0x00100000 /* protocol-specific */
 #define        M_PROTO8        0x00200000 /* protocol-specific */
+#define        M_FLOWID        0x00400000 /* flowid is valid */
 /*
  * For RELENG_{6,7} steal these flags for limited multiple routing table
  * support. In RELENG_8 and beyond, use just one flag and a tag.
_______________________________________________
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