svn commit: r186588 - in user/kmacy/HEAD_fast_net/sys: net netinet sys

Kip Macy kmacy at FreeBSD.org
Tue Dec 30 05:00:11 UTC 2008


Author: kmacy
Date: Tue Dec 30 05:00:10 2008
New Revision: 186588
URL: http://svn.freebsd.org/changeset/base/186588

Log:
  enabled flowid usage for supporting multiple transmit queues

Modified:
  user/kmacy/HEAD_fast_net/sys/net/flowtable.c
  user/kmacy/HEAD_fast_net/sys/netinet/in_pcb.h
  user/kmacy/HEAD_fast_net/sys/netinet/ip_output.c
  user/kmacy/HEAD_fast_net/sys/netinet/tcp_input.c
  user/kmacy/HEAD_fast_net/sys/sys/mbuf.h

Modified: user/kmacy/HEAD_fast_net/sys/net/flowtable.c
==============================================================================
--- user/kmacy/HEAD_fast_net/sys/net/flowtable.c	Tue Dec 30 04:48:59 2008	(r186587)
+++ user/kmacy/HEAD_fast_net/sys/net/flowtable.c	Tue Dec 30 05:00:10 2008	(r186588)
@@ -394,7 +394,7 @@ ipv4_flow_lookup_hash_internal(struct mb
 	((uint16_t *)key)[1] = dport; 
 
 	hash = hashword(key, 3, hashjitter + proto);
-	if (m->m_pkthdr.flowid == 0)
+	if ((m->m_flags & M_FLOWID) == 0)
 		m->m_pkthdr.flowid = hash;
 	
 	CTR5(KTR_SPARE3, "proto=%d hash=%x key[0]=%x sport=%d dport=%d\n", proto, hash, key[0], sport, dport);

Modified: user/kmacy/HEAD_fast_net/sys/netinet/in_pcb.h
==============================================================================
--- user/kmacy/HEAD_fast_net/sys/netinet/in_pcb.h	Tue Dec 30 04:48:59 2008	(r186587)
+++ user/kmacy/HEAD_fast_net/sys/netinet/in_pcb.h	Tue Dec 30 05:00:10 2008	(r186588)
@@ -169,7 +169,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 */
 	struct llentry	*inp_lle;	/* L2 information */
 	struct rtentry	*inp_rt;	/* L3 information */
@@ -419,6 +419,8 @@ void 	inp_4tuple_get(struct inpcb *inp, 
 #define	INP_RECVTTL		0x400	/* receive incoming IP TTL */
 #define	INP_DONTFRAG		0x800	/* don't fragment packet */
 #define	INP_LLE_VALID		0x1000	/* L2 entry is set */
+#define	INP_SW_FLOWID		0x2000	/* software generated flow id */
+#define	INP_HW_FLOWID		0x4000	/* hardware generated flow id */
 
 #define IN6P_IPV6_V6ONLY	0x008000 /* restrict AF_INET6 socket for v6 */
 

Modified: user/kmacy/HEAD_fast_net/sys/netinet/ip_output.c
==============================================================================
--- user/kmacy/HEAD_fast_net/sys/netinet/ip_output.c	Tue Dec 30 04:48:59 2008	(r186587)
+++ user/kmacy/HEAD_fast_net/sys/netinet/ip_output.c	Tue Dec 30 05:00:10 2008	(r186588)
@@ -144,6 +144,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 ((ro == &iproute) && (inp->inp_vflag & INP_RT_VALID)) {
 			if (inp->inp_rt->rt_flags & RTF_UP) {
 				sin = (struct sockaddr_in *)&ro->ro_dst;

Modified: user/kmacy/HEAD_fast_net/sys/netinet/tcp_input.c
==============================================================================
--- user/kmacy/HEAD_fast_net/sys/netinet/tcp_input.c	Tue Dec 30 04:48:59 2008	(r186587)
+++ user/kmacy/HEAD_fast_net/sys/netinet/tcp_input.c	Tue Dec 30 05:00:10 2008	(r186588)
@@ -585,7 +585,13 @@ findpcb:
 		goto dropwithreset;
 	}
 	INP_WLOCK(inp);
-
+	if (!(so->so_options & SO_ACCEPTCONN)
+	    && !(inp->inp_flags & INP_HW_FLOWID)
+	    && (m->m_flags & M_FLOWID)) {
+		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: user/kmacy/HEAD_fast_net/sys/sys/mbuf.h
==============================================================================
--- user/kmacy/HEAD_fast_net/sys/sys/mbuf.h	Tue Dec 30 04:48:59 2008	(r186587)
+++ user/kmacy/HEAD_fast_net/sys/sys/mbuf.h	Tue Dec 30 05:00:10 2008	(r186588)
@@ -195,6 +195,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.


More information about the svn-src-user mailing list