From fbd36468425151a258c7a90df46c0de1a069a137 Mon Sep 17 00:00:00 2001 From: kmacy Date: Fri, 10 Apr 2009 06:16:14 +0000 Subject: Import "flowid" support for serializing flows across transmit queues Reviewed by: rwatson and jeli --- sys/dev/cxgb/cxgb_sge.c | 1 + sys/netinet/in_pcb.h | 4 +++- sys/netinet/ip_output.c | 4 ++++ sys/netinet/tcp_input.c | 9 ++++++++- sys/sys/mbuf.h | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c index 6c5a17e..47f36fd 100644 --- a/sys/dev/cxgb/cxgb_sge.c +++ b/sys/dev/cxgb/cxgb_sge.c @@ -2879,6 +2879,7 @@ process_responses(adapter_t *adap, struct sge_qset *qs, int budget) 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; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 4ad4732..aada126 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -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, uint32_t *laddr, uint16_t *lp, #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 */ diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 90df601..fc811fa 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -153,6 +153,10 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, 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) { diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 1b9cf85..9d85448 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -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)) { diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 05b28de2..e7f0b7e 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -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. -- cgit v1.1