Date: Fri, 19 Jun 2009 20:05:10 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r194510 - user/kmacy/releng_7_2_fcs/sys/net Message-ID: <200906192005.n5JK5AuT053988@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Fri Jun 19 20:05:09 2009 New Revision: 194510 URL: http://svn.freebsd.org/changeset/base/194510 Log: add per-packet support to rtalloc_mpath_fib Modified: user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.h Modified: user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c Fri Jun 19 19:59:43 2009 (r194509) +++ user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.c Fri Jun 19 20:05:09 2009 (r194510) @@ -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/releng_7_2_fcs/sys/net/radix_mpath.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.h Fri Jun 19 19:59:43 2009 (r194509) +++ user/kmacy/releng_7_2_fcs/sys/net/radix_mpath.h Fri Jun 19 20:05:09 2009 (r194510) @@ -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 *);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906192005.n5JK5AuT053988>