From owner-svn-src-projects@FreeBSD.ORG Sun Nov 9 22:59:23 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 66E6537A; Sun, 9 Nov 2014 22:59:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47938EA2; Sun, 9 Nov 2014 22:59:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA9MxNPV060246; Sun, 9 Nov 2014 22:59:23 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA9MxMJR060236; Sun, 9 Nov 2014 22:59:22 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201411092259.sA9MxMJR060236@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 9 Nov 2014 22:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r274335 - in projects/routing: share/man/man9 sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Nov 2014 22:59:23 -0000 Author: melifaro Date: Sun Nov 9 22:59:21 2014 New Revision: 274335 URL: https://svnweb.freebsd.org/changeset/base/274335 Log: Since we no longer return individual radix entries, it is not possible to do per-rte accounting. Remove rt_kpktsent. Modified: projects/routing/share/man/man9/rtentry.9 projects/routing/sys/net/route.c projects/routing/sys/net/route.h projects/routing/sys/net/route_internal.h projects/routing/sys/net/rtsock.c Modified: projects/routing/share/man/man9/rtentry.9 ============================================================================== --- projects/routing/share/man/man9/rtentry.9 Sun Nov 9 22:54:40 2014 (r274334) +++ projects/routing/share/man/man9/rtentry.9 Sun Nov 9 22:59:21 2014 (r274335) @@ -101,8 +101,6 @@ See description of rmx_mtu below. See description of rmx_weight below. .It Vt "u_long rt_expire"; See description of rmx_expire below. -.It Vt "counter64_t rt_pksent"; -See description of rmx_pksent below. .It Vt "struct rtentry *rt_gwroute" ; This member is a reference to a route whose destination is .Va rt_gateway . @@ -174,9 +172,9 @@ passed with routing control messages via .Xr route 4 API. Currently only -.Vt rmx_mtu , rmx_expire , +.Vt rmx_mtu , and -.Vt rmx_pksent +.Vt rmx_expire metrics are supplied. All others are ignored. .Pp @@ -221,8 +219,6 @@ The average deviation of the round-trip units of .Dv RMX_RTTUNIT per second. -.It Vt "u_long rmx_pksent" ; -A count of packets successfully sent via this route. .It Vt "u_long rmx_filler[4]" ; .\" XXX badly named Empty space available for protocol-specific information. Modified: projects/routing/sys/net/route.c ============================================================================== --- projects/routing/sys/net/route.c Sun Nov 9 22:54:40 2014 (r274334) +++ projects/routing/sys/net/route.c Sun Nov 9 22:59:21 2014 (r274335) @@ -201,48 +201,6 @@ route_init(void) } SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, 0); -static int -rtentry_zinit(void *mem, int size, int how) -{ - struct rtentry *rt = mem; - - rt->rt_pksent = counter_u64_alloc(how); - if (rt->rt_pksent == NULL) - return (ENOMEM); - - RT_LOCK_INIT(rt); - - return (0); -} - -static void -rtentry_zfini(void *mem, int size) -{ - struct rtentry *rt = mem; - - RT_LOCK_DESTROY(rt); - counter_u64_free(rt->rt_pksent); -} - -static int -rtentry_ctor(void *mem, int size, void *arg, int how) -{ - struct rtentry *rt = mem; - - bzero(rt, offsetof(struct rtentry, rt_endzero)); - counter_u64_zero(rt->rt_pksent); - - return (0); -} - -static void -rtentry_dtor(void *mem, int size, void *arg) -{ - struct rtentry *rt = mem; - - RT_UNLOCK_COND(rt); -} - static void vnet_route_init(const void *unused __unused) { @@ -255,8 +213,7 @@ vnet_route_init(const void *unused __unu sizeof(struct rib_head *), M_RTABLE, M_WAITOK|M_ZERO); V_rtzone = uma_zcreate("rtentry", sizeof(struct rtentry), - rtentry_ctor, rtentry_dtor, - rtentry_zinit, rtentry_zfini, UMA_ALIGN_PTR, 0); + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); for (dom = domains; dom; dom = dom->dom_next) { if (dom->dom_rtattach == NULL) continue; @@ -1341,11 +1298,12 @@ rtrequest1_fib(int req, struct rt_addrin } else ifa_ref(info->rti_ifa); ifa = info->rti_ifa; - rt = uma_zalloc(V_rtzone, M_NOWAIT); + rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) { ifa_free(ifa); senderr(ENOBUFS); } + RT_LOCK_INIT(rt); rt->rt_flags = RTF_UP | flags; rt->rt_fibnum = fibnum; /* @@ -1353,6 +1311,7 @@ rtrequest1_fib(int req, struct rt_addrin */ RT_LOCK(rt); if ((error = rt_setgate(rt, dst, gateway)) != 0) { + RT_LOCK_DESTROY(rt); ifa_free(ifa); uma_zfree(V_rtzone, rt); senderr(error); @@ -1388,6 +1347,7 @@ rtrequest1_fib(int req, struct rt_addrin rt_mpath_conflict(rh, rt, netmask)) { ifa_free(rt->rt_ifa); Free(rt_key(rt)); + RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); senderr(EEXIST); } Modified: projects/routing/sys/net/route.h ============================================================================== --- projects/routing/sys/net/route.h Sun Nov 9 22:54:40 2014 (r274334) +++ projects/routing/sys/net/route.h Sun Nov 9 22:59:21 2014 (r274335) @@ -33,7 +33,6 @@ #ifndef _NET_ROUTE_H_ #define _NET_ROUTE_H_ -#include #include /* Modified: projects/routing/sys/net/route_internal.h ============================================================================== --- projects/routing/sys/net/route_internal.h Sun Nov 9 22:54:40 2014 (r274334) +++ projects/routing/sys/net/route_internal.h Sun Nov 9 22:59:21 2014 (r274335) @@ -73,8 +73,7 @@ struct rtentry { u_long rt_mtu; /* MTU for this path */ u_long rt_weight; /* absolute weight */ u_long rt_expire; /* lifetime for route, e.g. redirect */ -#define rt_endzero rt_pksent - counter_u64_t rt_pksent; /* packets sent using this route */ +#define rt_endzero rt_mtx struct mtx rt_mtx; /* mutex for routing entry */ }; Modified: projects/routing/sys/net/rtsock.c ============================================================================== --- projects/routing/sys/net/rtsock.c Sun Nov 9 22:54:40 2014 (r274334) +++ projects/routing/sys/net/rtsock.c Sun Nov 9 22:59:21 2014 (r274335) @@ -922,7 +922,6 @@ rt_getmetrics(const struct rtentry *rt, bzero(out, sizeof(*out)); out->rmx_mtu = rt->rt_mtu; out->rmx_weight = rt->rt_weight; - out->rmx_pksent = counter_u64_fetch(rt->rt_pksent); /* Kernel -> userland timebase conversion. */ out->rmx_expire = rt->rt_expire ? rt->rt_expire - time_uptime + time_second : 0;