Date: Sat, 27 Jun 2009 21:38:47 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r195123 - in user/kmacy/head_ppacket/sys: . net Message-ID: <200906272138.n5RLcl1u089103@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Sat Jun 27 21:38:46 2009 New Revision: 195123 URL: http://svn.freebsd.org/changeset/base/195123 Log: merge ppacket changes Modified: user/kmacy/head_ppacket/sys/ (props changed) user/kmacy/head_ppacket/sys/net/ (props changed) user/kmacy/head_ppacket/sys/net/radix_mpath.c user/kmacy/head_ppacket/sys/net/radix_mpath.h user/kmacy/head_ppacket/sys/net/route.h Modified: user/kmacy/head_ppacket/sys/net/radix_mpath.c ============================================================================== --- user/kmacy/head_ppacket/sys/net/radix_mpath.c Sat Jun 27 21:37:36 2009 (r195122) +++ user/kmacy/head_ppacket/sys/net/radix_mpath.c Sat Jun 27 21:38:46 2009 (r195123) @@ -258,8 +258,11 @@ different: return 0; } -void -rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) +#define RT_MP_NORMAL 0 +#define RT_MP_LIST 1 + +static void +rtalloc_mpath_fib_(struct route *ro, uint32_t hash, u_int fibnum, int type) { struct radix_node *rn0, *rn; u_int32_t n; @@ -277,15 +280,19 @@ rtalloc_mpath_fib(struct route *ro, uint /* if the route does not exist or it is not multipath, don't care */ if (ro->ro_rt == NULL) return; - if (rn_mpath_next((struct radix_node *)ro->ro_rt) == NULL) { + if (rn_mpath_next((struct radix_node *)ro->ro_rt) == NULL || + ((type == RT_MP_LIST) && (ro->ro_rt->rt_flags & RTF_PPACKET))) { RT_UNLOCK(ro->ro_rt); return; } - + /* beyond here, we use rn as the master copy */ rn0 = rn = (struct radix_node *)ro->ro_rt; n = rn_mpath_count(rn0); + if (ro->ro_rt->rt_flags & RTF_PPACKET) + hash = arc4random(); + /* gw selection by Modulo-N Hash (RFC2991) XXX need improvement? */ hash += hashjitter; hash %= n; @@ -317,6 +324,21 @@ rtalloc_mpath_fib(struct route *ro, uint RT_UNLOCK(ro->ro_rt); } +void +rtalloc_mpath_fib_list(struct route *ro, uint32_t hash, u_int fibnum) +{ + + rtalloc_mpath_fib_(ro, hash, fibnum, RT_MP_LIST); +} + + +void +rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) +{ + + rtalloc_mpath_fib_(ro, hash, fibnum, RT_MP_NORMAL); +} + extern int in6_inithead(void **head, int off); extern int in_inithead(void **head, int off); Modified: user/kmacy/head_ppacket/sys/net/radix_mpath.h ============================================================================== --- user/kmacy/head_ppacket/sys/net/radix_mpath.h Sat Jun 27 21:37:36 2009 (r195122) +++ user/kmacy/head_ppacket/sys/net/radix_mpath.h Sat Jun 27 21:38:46 2009 (r195123) @@ -51,6 +51,7 @@ struct rtentry *rt_mpath_matchgate(struc int rt_mpath_conflict(struct radix_node_head *, struct rtentry *, struct sockaddr *); void rtalloc_mpath_fib(struct route *, u_int32_t, u_int); +void rtalloc_mpath_fib_list(struct route *ro, uint32_t hash, u_int fibnum); #define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0) struct radix_node *rn_mpath_lookup(void *, void *, struct radix_node_head *); Modified: user/kmacy/head_ppacket/sys/net/route.h ============================================================================== --- user/kmacy/head_ppacket/sys/net/route.h Sat Jun 27 21:37:36 2009 (r195122) +++ user/kmacy/head_ppacket/sys/net/route.h Sat Jun 27 21:38:46 2009 (r195123) @@ -192,7 +192,7 @@ struct ortentry { /* 0x20000 unused, was RTF_WASCLONED */ #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ -/* 0x80000 unused */ +#define RTF_PPACKET 0x80000 /* per-packet load balancing */ #define RTF_PINNED 0x100000 /* future use */ #define RTF_LOCAL 0x200000 /* route represents a local address */ #define RTF_BROADCAST 0x400000 /* route represents a bcast address */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906272138.n5RLcl1u089103>