Since we no longer return individual radix entries, it is

not possible to do per-rte accounting. Remove rt_kpktsent.
This commit is contained in:
Alexander V. Chernikov 2014-11-09 22:59:21 +00:00
parent 36f34ac70b
commit 69d149adf5
5 changed files with 8 additions and 55 deletions

View File

@ -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 time to this destination, in
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.

View File

@ -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 __unused)
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_addrinfo *info, struct rtentry **ret_nrt,
} 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_addrinfo *info, struct rtentry **ret_nrt,
*/
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_addrinfo *info, struct rtentry **ret_nrt,
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);
}

View File

@ -33,7 +33,6 @@
#ifndef _NET_ROUTE_H_
#define _NET_ROUTE_H_
#include <sys/counter.h>
#include <net/vnet.h>
/*

View File

@ -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 */
};

View File

@ -922,7 +922,6 @@ rt_getmetrics(const struct rtentry *rt, struct rt_metrics *out)
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;