svn commit: r203649 - user/kmacy/head_flowtable_v6/sys/netinet6
Kip Macy
kmacy at FreeBSD.org
Mon Feb 8 05:08:25 UTC 2010
Author: kmacy
Date: Mon Feb 8 05:08:24 2010
New Revision: 203649
URL: http://svn.freebsd.org/changeset/base/203649
Log:
add flowtable support to ip6_output
Modified:
user/kmacy/head_flowtable_v6/sys/netinet6/in6_proto.c
user/kmacy/head_flowtable_v6/sys/netinet6/ip6_input.c
user/kmacy/head_flowtable_v6/sys/netinet6/ip6_output.c
user/kmacy/head_flowtable_v6/sys/netinet6/udp6_usrreq.c
Modified: user/kmacy/head_flowtable_v6/sys/netinet6/in6_proto.c
==============================================================================
--- user/kmacy/head_flowtable_v6/sys/netinet6/in6_proto.c Mon Feb 8 05:07:21 2010 (r203648)
+++ user/kmacy/head_flowtable_v6/sys/netinet6/in6_proto.c Mon Feb 8 05:08:24 2010 (r203649)
@@ -546,6 +546,16 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_
&VNET_NAME(ip6stealth), 0, "");
#endif
+#ifdef FLOWTABLE
+static VNET_DEFINE(int, ip6_output_flowtable_size) = 2048;
+VNET_DEFINE(struct flowtable *, ip6_ft);
+#define V_ip6_output_flowtable_size VNET(ip6_output_flowtable_size)
+
+SYSCTL_VNET_INT(_net_inet6_ip6, OID_AUTO, output_flowtable_size, CTLFLAG_RDTUN,
+ &VNET_NAME(ip6_output_flowtable_size), 2048,
+ "number of entries in the per-cpu output flow caches");
+#endif
+
/* net.inet6.icmp6 */
SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT, rediraccept,
CTLFLAG_RW, &VNET_NAME(icmp6_rediraccept), 0, "");
Modified: user/kmacy/head_flowtable_v6/sys/netinet6/ip6_input.c
==============================================================================
--- user/kmacy/head_flowtable_v6/sys/netinet6/ip6_input.c Mon Feb 8 05:07:21 2010 (r203648)
+++ user/kmacy/head_flowtable_v6/sys/netinet6/ip6_input.c Mon Feb 8 05:08:24 2010 (r203649)
@@ -192,6 +192,11 @@ ip6_init(void)
#define IPV6_SENDREDIRECTS 1
#endif
+#ifdef FLOWTABLE
+ TUNABLE_INT_FETCH("net.inet6.ip6.output_flowtable_size",
+ &V_ip6_output_flowtable_size);
+ V_ip6_ft = flowtable_alloc(V_ip6_output_flowtable_size, FL_PCPU);
+#endif
V_ip6_forwarding = IPV6FORWARDING; /* act as router? */
V_ip6_sendredirects = IPV6_SENDREDIRECTS;
V_ip6_defhlim = IPV6_DEFHLIM;
Modified: user/kmacy/head_flowtable_v6/sys/netinet6/ip6_output.c
==============================================================================
--- user/kmacy/head_flowtable_v6/sys/netinet6/ip6_output.c Mon Feb 8 05:07:21 2010 (r203648)
+++ user/kmacy/head_flowtable_v6/sys/netinet6/ip6_output.c Mon Feb 8 05:08:24 2010 (r203649)
@@ -206,6 +206,7 @@ ip6_output(struct mbuf *m0, struct ip6_p
struct in6_addr finaldst, src0, dst0;
u_int32_t zone;
struct route_in6 *ro_pmtu = NULL;
+ int flevalid = 0;
int hdrsplit = 0;
int needipsec = 0;
#ifdef IPSEC
@@ -223,9 +224,7 @@ ip6_output(struct mbuf *m0, struct ip6_p
}
finaldst = ip6->ip6_dst;
-
bzero(&exthdrs, sizeof(exthdrs));
-
if (opt) {
/* Hop-by-Hop options header */
MAKE_EXTHDR(opt->ip6po_hbh, &exthdrs.ip6e_hbh);
@@ -462,7 +461,22 @@ skip_ipsec2:;
if (opt && opt->ip6po_rthdr)
ro = &opt->ip6po_route;
dst = (struct sockaddr_in6 *)&ro->ro_dst;
-
+#ifdef FLOWTABLE
+ if (ro == &ip6route) {
+ struct flentry *fle;
+
+ /*
+ * The flow table returns route entries valid for up to 30
+ * seconds; we rely on the remainder of ip_output() taking no
+ * longer than that long for the stability of ro_rt. The
+ * flow ID assignment must have happened before this point.
+ */
+ if ((fle = flowtable_lookup_mbuf(V_ip6_ft, m, AF_INET6)) != NULL) {
+ flow_to_route_in6(fle, ro);
+ flevalid = 1;
+ }
+ }
+#endif
again:
/*
* if specified, try to fill in the traffic class field.
@@ -568,7 +582,10 @@ again:
dst_sa.sin6_family = AF_INET6;
dst_sa.sin6_len = sizeof(dst_sa);
dst_sa.sin6_addr = ip6->ip6_dst;
- if ((error = in6_selectroute(&dst_sa, opt, im6o, ro,
+ if (flevalid) {
+ rt = ro->ro_rt;
+ ifp = ro->ro_rt->rt_ifp;
+ } else if ((error = in6_selectroute(&dst_sa, opt, im6o, ro,
&ifp, &rt)) != 0) {
switch (error) {
case EHOSTUNREACH:
@@ -1052,7 +1069,8 @@ sendorfree:
V_ip6stat.ip6s_fragmented++;
done:
- if (ro == &ip6route && ro->ro_rt) { /* brace necessary for RTFREE */
+ if (ro == &ip6route && ro->ro_rt && flevalid == 0) {
+ /* brace necessary for RTFREE */
RTFREE(ro->ro_rt);
} else if (ro_pmtu == &ip6route && ro_pmtu->ro_rt) {
RTFREE(ro_pmtu->ro_rt);
Modified: user/kmacy/head_flowtable_v6/sys/netinet6/udp6_usrreq.c
==============================================================================
--- user/kmacy/head_flowtable_v6/sys/netinet6/udp6_usrreq.c Mon Feb 8 05:07:21 2010 (r203648)
+++ user/kmacy/head_flowtable_v6/sys/netinet6/udp6_usrreq.c Mon Feb 8 05:08:24 2010 (r203649)
@@ -1079,7 +1079,9 @@ udp6_send(struct socket *so, int flags,
mac_inpcb_create_mbuf(inp, m);
#endif
error = udp6_output(inp, m, addr, control, td);
+#ifdef INET
out:
+#endif
INP_WUNLOCK(inp);
INP_INFO_WUNLOCK(&V_udbinfo);
return (error);
More information about the svn-src-user
mailing list