PERFORCE change 195190 for review
Kazuya Goda
goda at FreeBSD.org
Thu Jun 23 05:28:30 UTC 2011
http://p4web.freebsd.org/@@195190?ac=10
Change 195190 by goda at hassaku on 2011/06/23 05:27:37
Support UDP.
Netisr policy on IP is changed "hybride".
Affected files ...
.. //depot/projects/soc2011/kgoda_rpsrfs/src/sys/net/if_ethersubr.c#3 edit
.. //depot/projects/soc2011/kgoda_rpsrfs/src/sys/net/netisr.c#2 edit
.. //depot/projects/soc2011/kgoda_rpsrfs/src/sys/netinet/ip_input.c#2 edit
Differences ...
==== //depot/projects/soc2011/kgoda_rpsrfs/src/sys/net/if_ethersubr.c#3 (text+ko) ====
@@ -78,6 +78,7 @@
#include <netinet/ip_var.h>
#include <netinet/ip_fw.h>
#include <netinet/tcp.h>
+#include <netinet/udp.h>
#include <netinet/ipfw/ip_fw_private.h>
#endif
@@ -912,19 +913,32 @@
{
struct ip *ip = NULL;
struct tcphdr *th = NULL;
+ struct udphdr *uh = NULL;
+ uint16_t sport, dport;
- if ( m->m_flags & M_FLOWID )
+ if (m->m_flags & M_FLOWID)
goto not_rps;
ip = mtod(m, struct ip *);
- if( ip->ip_p != IPPROTO_TCP )
+
+ switch (ip->ip_p){
+ case IPPROTO_TCP:
+ th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
+ sport = th->th_sport;
+ dport = th->th_dport;
+ break;
+ case IPPROTO_UDP:
+ uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));
+ sport = uh->uh_sport;
+ dport = uh->uh_dport;
+ break;
+ default:
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);
-
+ m->m_pkthdr.flowid = rss_hash_ip4_4tuple(ip->ip_src, sport, ip->ip_dst, dport);
+ M_HASHTYPE_SET(m, M_HASHTYPE_RSS_4TUPLE);
}
not_rps:
==== //depot/projects/soc2011/kgoda_rpsrfs/src/sys/net/netisr.c#2 (text+ko) ====
@@ -1073,6 +1073,7 @@
sched_pin();
m = netisr_select_cpuid(&netisr_proto[proto], NETISR_DISPATCH_HYBRID,
source, m, &cpuid);
+
if (m == NULL) {
error = ENOBUFS;
goto out_unpin;
==== //depot/projects/soc2011/kgoda_rpsrfs/src/sys/netinet/ip_input.c#2 (text+ko) ====
@@ -37,6 +37,7 @@
#include "opt_ipstealth.h"
#include "opt_ipsec.h"
#include "opt_route.h"
+#include "opt_rps.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -144,6 +145,9 @@
.nh_handler = ip_input,
.nh_proto = NETISR_IP,
.nh_policy = NETISR_POLICY_FLOW,
+#ifdef RPS
+ .nh_dispatch = NETISR_DISPATCH_HYBRID,
+#endif
};
extern struct domain inetdomain;
More information about the p4-projects
mailing list