svn commit: r203647 - user/kmacy/head_flowtable_v6/sys/net
Kip Macy
kmacy at FreeBSD.org
Mon Feb 8 05:06:48 UTC 2010
Author: kmacy
Date: Mon Feb 8 05:06:47 2010
New Revision: 203647
URL: http://svn.freebsd.org/changeset/base/203647
Log:
- reduce debugging noise
- create separate flow to route routines for INET and INET6
Modified:
user/kmacy/head_flowtable_v6/sys/net/flowtable.c
user/kmacy/head_flowtable_v6/sys/net/flowtable.h
Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.c
==============================================================================
--- user/kmacy/head_flowtable_v6/sys/net/flowtable.c Mon Feb 8 04:12:10 2010 (r203646)
+++ user/kmacy/head_flowtable_v6/sys/net/flowtable.c Mon Feb 8 05:06:47 2010 (r203647)
@@ -186,7 +186,6 @@ static struct cv flowclean_cv;
static struct mtx flowclean_lock;
static uint32_t flowclean_cycles;
-#define FLOWTABLE_DEBUG
#ifdef FLOWTABLE_DEBUG
#define FLDPRINTF(ft, flags, fmt, ...) \
do { \
@@ -417,40 +416,6 @@ flags_to_proto(int flags)
return (proto);
}
-void
-flow_to_route(struct flentry *fle, struct route *ro)
-{
- uint32_t *hashkey = NULL;
-
-#ifdef INET6
- if (fle->f_flags & FL_IPV6) {
- struct sockaddr_in6 *sin6;
-
- sin6 = (struct sockaddr_in6 *)&ro->ro_dst;
-
- sin6->sin6_family = AF_INET6;
- sin6->sin6_len = sizeof(*sin6);
- hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key;
- memcpy(&sin6->sin6_addr, &hashkey[2], sizeof (struct in6_addr));
- } else
-#endif
-#ifdef INET
- {
- struct sockaddr_in *sin;
-
- sin = (struct sockaddr_in *)&ro->ro_dst;
-
- sin->sin_family = AF_INET;
- sin->sin_len = sizeof(*sin);
- hashkey = ((struct flentry_v4 *)fle)->fl_flow.ipf_key;
- sin->sin_addr.s_addr = hashkey[2];
- }
-#endif
- ; /* terminate INET6 else if no INET4 */
- ro->ro_rt = __DEVOLATILE(struct rtentry *, fle->f_rt);
- ro->ro_lle = __DEVOLATILE(struct llentry *, fle->f_lle);
-}
-
#ifdef INET
#ifdef FLOWTABLE_DEBUG
static void
@@ -583,6 +548,21 @@ flowtable_lookup_mbuf4(struct flowtable
return (flowtable_lookup(ft, &ssa, &dsa, M_GETFIB(m), flags));
}
+
+void
+flow_to_route(struct flentry *fle, struct route *ro)
+{
+ uint32_t *hashkey = NULL;
+ struct sockaddr_in *sin;
+
+ sin = (struct sockaddr_in *)&ro->ro_dst;
+ sin->sin_family = AF_INET;
+ sin->sin_len = sizeof(*sin);
+ hashkey = ((struct flentry_v4 *)fle)->fl_flow.ipf_key;
+ sin->sin_addr.s_addr = hashkey[2];
+ ro->ro_rt = __DEVOLATILE(struct rtentry *, fle->f_rt);
+ ro->ro_lle = __DEVOLATILE(struct llentry *, fle->f_lle);
+}
#endif /* INET */
#ifdef INET6
@@ -772,6 +752,23 @@ flowtable_lookup_mbuf6(struct flowtable
return (flowtable_lookup(ft, &ssa, &dsa, M_GETFIB(m), flags));
}
+
+void
+flow_to_route_in6(struct flentry *fle, struct route_in6 *ro)
+{
+ uint32_t *hashkey = NULL;
+ struct sockaddr_in6 *sin6;
+
+ sin6 = (struct sockaddr_in6 *)&ro->ro_dst;
+
+ sin6->sin6_family = AF_INET6;
+ sin6->sin6_len = sizeof(*sin6);
+ hashkey = ((struct flentry_v6 *)fle)->fl_flow.ipf_key;
+ memcpy(&sin6->sin6_addr, &hashkey[5], sizeof (struct in6_addr));
+ ro->ro_rt = __DEVOLATILE(struct rtentry *, fle->f_rt);
+ ro->ro_lle = __DEVOLATILE(struct llentry *, fle->f_lle);
+
+}
#endif /* INET6 */
static bitstr_t *
@@ -967,11 +964,6 @@ kern_flowtable_insert(struct flowtable *
FLDPRINTF(ft, FL_DEBUG,
"kern_flowtable_insert: key=%x:%x:%x hash=%x fibnum=%d flags=%x\n",
key[0], key[1], key[2], hash, fibnum, flags);
-#ifdef FLOWTABLE_DEBUG
- if (flags & FL_DEBUG)
- ipv4_flow_print_tuple(flags, flags_to_proto(flags),
- (struct sockaddr_in *)ssa, (struct sockaddr_in *)dsa);
-#endif
return (flowtable_insert(ft, hash, key, fibnum, ro, flags));
}
@@ -1071,18 +1063,6 @@ flowtable_lookup(struct flowtable *ft, s
goto uncached;
}
keycheck:
-#ifdef FLOWTABLE_DEBUG
- if (flags & FL_DEBUG){
- printf("keycheck: key=%x:%x:%x hash=%x fibnum=%02d "
- "keyequal=%d hashequal=%d",
- key[0], key[1], key[2], hash, fibnum,
- flowtable_key_equal(fle, key),
- (fle->f_fhash == hash));
- ipv4_flow_print_tuple(flags, proto,
- (struct sockaddr_in *)ssa,
- (struct sockaddr_in *)dsa);
- }
-#endif
rt = __DEVOLATILE(struct rtentry *, fle->f_rt);
lle = __DEVOLATILE(struct llentry *, fle->f_lle);
if ((rt != NULL)
Modified: user/kmacy/head_flowtable_v6/sys/net/flowtable.h
==============================================================================
--- user/kmacy/head_flowtable_v6/sys/net/flowtable.h Mon Feb 8 04:12:10 2010 (r203646)
+++ user/kmacy/head_flowtable_v6/sys/net/flowtable.h Mon Feb 8 05:06:47 2010 (r203647)
@@ -50,6 +50,9 @@ struct flentry;
VNET_DECLARE(struct flowtable *, ip_ft);
#define V_ip_ft VNET(ip_ft)
+VNET_DECLARE(struct flowtable *, ip6_ft);
+#define V_ip6_ft VNET(ip6_ft)
+
struct flowtable *flowtable_alloc(char *name, int nentry, int flags);
/*
@@ -66,10 +69,16 @@ int kern_flowtable_insert(struct flowtab
struct sockaddr *dsa, struct route *ro, uint32_t fibnum, int flags);
void flow_invalidate(struct flentry *fl);
+void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt);
+#ifdef INET
void flow_to_route(struct flentry *fl, struct route *ro);
+#endif
+
+#ifdef INET6
+void flow_to_route_in6(struct flentry *fl, struct route_in6 *ro);
+#endif
-void flowtable_route_flush(struct flowtable *ft, struct rtentry *rt);
#endif /* _KERNEL */
#endif
More information about the svn-src-user
mailing list