From owner-svn-src-user@FreeBSD.ORG Sat Jan 10 06:55:37 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 BC532106566B; Sat, 10 Jan 2009 06:55:37 +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 AAF2C8FC16; Sat, 10 Jan 2009 06:55:37 +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 n0A6tbb6082823; Sat, 10 Jan 2009 06:55:37 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0A6tbqp082822; Sat, 10 Jan 2009 06:55:37 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200901100655.n0A6tbqp082822@svn.freebsd.org> From: Kip Macy Date: Sat, 10 Jan 2009 06:55:37 +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: r187013 - 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:55:38 -0000 Author: kmacy Date: Sat Jan 10 06:55:37 2009 New Revision: 187013 URL: http://svn.freebsd.org/changeset/base/187013 Log: update loop condition print hash earlier 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 06:36:28 2009 (r187012) +++ user/kmacy/HEAD_fast_net/sys/net/radix_mpath.c Sat Jan 10 06:55:37 2009 (r187013) @@ -299,21 +299,19 @@ rtalloc_mpath_fib(struct route *ro, uint /* gw selection by Modulo-N Hash (RFC2991) XXX need improvement? */ hash += hashjitter; - hash %= n; if ((lookup_count % 50000) == 0) - printf("hash=%d ", hash); - while (rn) { + printf("hash=%u n=%d ", hash, n); + hash %= n; + while (total_weight < hash && rn) { rt = (struct rtentry *)rn; if (rt->rt_flags & RTF_SHUTDOWN) continue; total_weight += rt->rt_rmx.rmx_weight; if ((lookup_count % 50000) == 0) - printf("rmx_weight=%ld ", rt->rt_rmx.rmx_weight); + printf("rmx_weight=%ld ", + rt->rt_rmx.rmx_weight); - if (total_weight >= hash) - break; - /* stay within the multipath routes */ if (rn->rn_dupedkey && rn->rn_mask != rn->rn_dupedkey->rn_mask) break;