From owner-svn-src-user@FreeBSD.ORG Sat Jan 10 06:18:27 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 38AA6106564A; Sat, 10 Jan 2009 06:18:27 +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 2806A8FC0C; Sat, 10 Jan 2009 06:18:27 +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 n0A6IRs6082042; Sat, 10 Jan 2009 06:18:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0A6IR4L082041; Sat, 10 Jan 2009 06:18:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901100618.n0A6IR4L082041@svn.freebsd.org> From: Kip Macy Date: Sat, 10 Jan 2009 06:18:27 +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: r187011 - user/kmacy/HEAD_fast_net/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: Sat, 10 Jan 2009 06:18:27 -0000 Author: kmacy Date: Sat Jan 10 06:18:26 2009 New Revision: 187011 URL: http://svn.freebsd.org/changeset/base/187011 Log: add debug cruft to route selection Modified: user/kmacy/HEAD_fast_net/sys/net/radix_mpath.c Modified: user/kmacy/HEAD_fast_net/sys/net/radix_mpath.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/net/radix_mpath.c Sat Jan 10 05:42:53 2009 (r187010) +++ user/kmacy/HEAD_fast_net/sys/net/radix_mpath.c Sat Jan 10 06:18:26 2009 (r187011) @@ -83,7 +83,6 @@ rn_mpath_count(struct radix_node *rn) uint32_t i = 0; struct rtentry *rt; - i = 1; while ((rn = rn_mpath_next(rn)) != NULL) { rt = (struct rtentry *)rn; if ((rt->rt_flags & RTF_SHUTDOWN) == 0) @@ -259,6 +258,9 @@ different: return 0; } +static int n_prev; +static int lookup_count; + void rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) { @@ -287,15 +289,26 @@ rtalloc_mpath_fib(struct route *ro, uint rn0 = rn = (struct radix_node *)ro->ro_rt; n = rn_mpath_count(rn0); + if (n != n_prev) { + printf("rn_mpath_count=%d\n", n); + n_prev = n; + } + + /* gw selection by Modulo-N Hash (RFC2991) XXX need improvement? */ hash += hashjitter; hash %= n; + if ((lookup_count % 500) == 0) + printf("hash=%d ", hash); while (rn) { rt = (struct rtentry *)rn; if (rt->rt_flags & RTF_SHUTDOWN) continue; total_weight += rt->rt_rmx.rmx_weight; + if ((lookup_count % 500) == 0) + printf("rmx_weight=%ld ", rt->rt_rmx.rmx_weight); + if (total_weight >= hash) break; @@ -304,7 +317,10 @@ rtalloc_mpath_fib(struct route *ro, uint break; rn = rn->rn_dupedkey; } - + if ((lookup_count % 500) == 0) + printf("\n"); + lookup_count++; + /* XXX try filling rt_gwroute and avoid unreachable gw */ /* if gw selection fails, use the first match (default) */