Import "flowid" support for serializing flows across transmit queues

Reviewed by:	rwatson and jeli
This commit is contained in:
Kip Macy 2009-04-10 06:16:14 +00:00
parent 529f22baa8
commit 80cb9f211a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190880
5 changed files with 17 additions and 2 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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) {

View File

@ -594,7 +594,14 @@ tcp_input(struct mbuf *m, int off0)
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)) {

View File

@ -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.