PERFORCE change 193792 for review
Kazuya Goda
goda at FreeBSD.org
Fri May 27 12:40:07 UTC 2011
http://p4web.freebsd.org/@@193792?ac=10
Change 193792 by goda at hassaku on 2011/05/27 12:39:23
Implements RPS.
Affected files ...
.. //depot/projects/soc2011/kgoda_rpsrfs/src/sys/amd64/conf/RPS#1 add
.. //depot/projects/soc2011/kgoda_rpsrfs/src/sys/conf/options#2 edit
.. //depot/projects/soc2011/kgoda_rpsrfs/src/sys/net/if_ethersubr.c#2 edit
Differences ...
==== //depot/projects/soc2011/kgoda_rpsrfs/src/sys/conf/options#2 (text+ko) ====
@@ -424,6 +424,7 @@
RADIX_MPATH opt_mpath.h
ROUTETABLES opt_route.h
RSS opt_rss.h
+RPS opt_rps.h
SLIP_IFF_OPTS opt_slip.h
TCPDEBUG
TCP_OFFLOAD_DISABLE opt_inet.h #Disable code to dispatch tcp offloading
==== //depot/projects/soc2011/kgoda_rpsrfs/src/sys/net/if_ethersubr.c#2 (text+ko) ====
@@ -30,6 +30,7 @@
* $FreeBSD: src/sys/net/if_ethersubr.c,v 1.282 2010/11/22 19:32:54 dim Exp $
*/
+
#include "opt_atalk.h"
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -37,6 +38,7 @@
#include "opt_netgraph.h"
#include "opt_mbuf_profiling.h"
#include "opt_rss.h"
+#include "opt_rps.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,9 +73,12 @@
#include <netinet/in_var.h>
#include <netinet/if_ether.h>
#include <netinet/in_rss.h>
+#include <netinet/ip.h>
#include <netinet/ip_carp.h>
#include <netinet/ip_var.h>
#include <netinet/ip_fw.h>
+#include <netinet/tcp.h>
+
#include <netinet/ipfw/ip_fw_private.h>
#endif
#ifdef INET6
@@ -902,6 +907,28 @@
case ETHERTYPE_IP:
if ((m = ip_fastforward(m)) == NULL)
return;
+
+#ifdef RPS
+ {
+ struct ip *ip = NULL;
+ struct tcphdr *th = NULL;
+
+ if ( m->m_flags & M_FLOWID )
+ goto not_rps;
+
+ ip = mtod(m, struct ip *);
+ if( ip->ip_p != IPPROTO_TCP )
+ goto not_rps;
+
+ th = (struct tcphdr *)((caddr_t)ip + ( ip->ip_hl << 2 ) );
+
+ m->m_flags |= M_FLOWID;
+ m->m_pkthdr.flowid = rss_hash_ip4_4tuple(ip->ip_src, th->th_sport, ip->ip_dst, th->th_dport);
+
+ }
+
+not_rps:
+#endif
isr = NETISR_IP;
break;
More information about the p4-projects
mailing list