svn commit: r287077 - projects/routing/sys/net
Alexander V. Chernikov
melifaro at FreeBSD.org
Sun Aug 23 18:33:44 UTC 2015
Author: melifaro
Date: Sun Aug 23 18:33:42 2015
New Revision: 287077
URL: https://svnweb.freebsd.org/changeset/base/287077
Log:
Since we no longer return individual radix entries, it
is not possible to do per-rte accounting. Remove rt_kpktsent.
Modified:
projects/routing/sys/net/route.c
projects/routing/sys/net/route.h
projects/routing/sys/net/rtsock.c
Modified: projects/routing/sys/net/route.c
==============================================================================
--- projects/routing/sys/net/route.c Sun Aug 23 18:33:15 2015 (r287076)
+++ projects/routing/sys/net/route.c Sun Aug 23 18:33:42 2015 (r287077)
@@ -208,48 +208,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)
{
@@ -262,8 +220,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;
@@ -1403,11 +1360,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;
/*
@@ -1415,6 +1373,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);
@@ -1450,6 +1409,7 @@ rtrequest1_fib(int req, struct rt_addrin
rt_mpath_conflict(rh, rt, netmask)) {
ifa_free(rt->rt_ifa);
R_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 Aug 23 18:33:15 2015 (r287076)
+++ projects/routing/sys/net/route.h Sun Aug 23 18:33:42 2015 (r287077)
@@ -33,7 +33,6 @@
#ifndef _NET_ROUTE_H_
#define _NET_ROUTE_H_
-#include <sys/counter.h>
#include <net/vnet.h>
/*
Modified: projects/routing/sys/net/rtsock.c
==============================================================================
--- projects/routing/sys/net/rtsock.c Sun Aug 23 18:33:15 2015 (r287076)
+++ projects/routing/sys/net/rtsock.c Sun Aug 23 18:33:42 2015 (r287077)
@@ -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;
More information about the svn-src-projects
mailing list