From owner-svn-src-user@FreeBSD.ORG Fri Jun 19 20:05:10 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 642C2106564A; Fri, 19 Jun 2009 20:05:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3759F8FC21; Fri, 19 Jun 2009 20:05:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5JK5A9f053991; Fri, 19 Jun 2009 20:05:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5JK5AuT053988; Fri, 19 Jun 2009 20:05:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906192005.n5JK5AuT053988@svn.freebsd.org> From: Kip Macy Date: Fri, 19 Jun 2009 20:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194510 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 20:05:10 -0000 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 *);