Simplify the interface to netstat_sysctl() and allocate space for

the collated counters using kmem_alloc().

PR kern/38577
This commit is contained in:
thorpej 2008-05-04 07:22:14 +00:00
parent 5ae0f4961a
commit b129a80c20
19 changed files with 91 additions and 200 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: net_stats.c,v 1.3 2008/04/28 20:24:09 martin Exp $ */
/* $NetBSD: net_stats.c,v 1.4 2008/05/04 07:22:14 thorpej Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -30,14 +30,20 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: net_stats.c,v 1.3 2008/04/28 20:24:09 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: net_stats.c,v 1.4 2008/05/04 07:22:14 thorpej Exp $");
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/kmem.h>
#include <net/net_stats.h>
typedef struct {
uint64_t *ctx_counters; /* pointer to collated counter array */
u_int ctx_ncounters; /* number of counters in array */
} netstat_sysctl_context;
/*
* netstat_convert_to_user_cb --
* Internal routine used as a call-back for percpu data enumeration.
@ -53,19 +59,6 @@ netstat_convert_to_user_cb(void *v1, void *v2, struct cpu_info *ci)
ctx->ctx_counters[i] += local_counters[i];
}
/*
* netstat_convert_to_user --
* Internal routine to convert per-CPU network statistics into
* collated form.
*/
static void
netstat_convert_to_user(netstat_sysctl_context *ctx)
{
memset(ctx->ctx_counters, 0, sizeof(uint64_t) * ctx->ctx_ncounters);
percpu_foreach(ctx->ctx_stat, netstat_convert_to_user_cb, ctx);
}
/*
* netstat_sysctl --
* Common routine for collating and reporting network statistics
@ -73,13 +66,31 @@ netstat_convert_to_user(netstat_sysctl_context *ctx)
* to be arrays of uint64_t's.
*/
int
netstat_sysctl(netstat_sysctl_context *ctx, SYSCTLFN_ARGS)
netstat_sysctl(percpu_t *stat, u_int ncounters, SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
struct sysctlnode node;
uint64_t *counters;
size_t countersize;
int rv;
countersize = sizeof(uint64_t) * ncounters;
counters = kmem_zalloc(countersize, KM_SLEEP);
if (counters == NULL)
return (ENOMEM);
ctx.ctx_counters = counters;
ctx.ctx_ncounters = ncounters;
percpu_foreach(stat, netstat_convert_to_user_cb, &ctx);
netstat_convert_to_user(ctx);
node = *rnode;
node.sysctl_data = ctx->ctx_counters;
node.sysctl_size = sizeof(uint64_t) * ctx->ctx_ncounters;
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
node.sysctl_data = counters;
node.sysctl_size = countersize;
rv = sysctl_lookup(SYSCTLFN_CALL(&node));
kmem_free(counters, countersize);
return (rv);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: net_stats.h,v 1.2 2008/04/28 20:24:09 martin Exp $ */
/* $NetBSD: net_stats.h,v 1.3 2008/05/04 07:22:14 thorpej Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -66,27 +66,17 @@ do { \
_NET_STAT_PUTREF(stat); \
} while (/*CONSTCOND*/0)
/*
* netstat_sysctl_context --
* Context passed to netstat_sysctl().
*/
typedef struct {
percpu_t *ctx_stat; /* stat's percpu context */
uint64_t *ctx_counters; /* pointer to collated counter array */
u_int ctx_ncounters; /* number of counters in array */
} netstat_sysctl_context;
__BEGIN_DECLS
struct lwp;
struct sysctlnode;
int netstat_sysctl(netstat_sysctl_context *,
int netstat_sysctl(percpu_t *, u_int,
const int *, u_int, void *,
size_t *, const void *, size_t,
const int *, struct lwp *, const struct sysctlnode *);
#define NETSTAT_SYSCTL(ctx) \
netstat_sysctl((ctx), name, namelen, oldp, oldlenp, \
#define NETSTAT_SYSCTL(stat, nctrs) \
netstat_sysctl((stat), (nctrs), name, namelen, oldp, oldlenp, \
newp, newlen, oname, l, rnode)
__END_DECLS
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ddp_usrreq.c,v 1.32 2008/04/24 11:38:37 ad Exp $ */
/* $NetBSD: ddp_usrreq.c,v 1.33 2008/05/04 07:22:14 thorpej Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.32 2008/04/24 11:38:37 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.33 2008/05/04 07:22:14 thorpej Exp $");
#include "opt_mbuftrace.h"
@ -585,13 +585,8 @@ ddp_clean()
static int
sysctl_net_atalk_ddp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ddps[DDP_NSTATS];
ctx.ctx_stat = ddpstat_percpu;
ctx.ctx_counters = ddps;
ctx.ctx_ncounters = DDP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ddpstat_percpu, DDP_NSTATS));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arp.c,v 1.136 2008/05/02 13:40:32 ad Exp $ */
/* $NetBSD: if_arp.c,v 1.137 2008/05/04 07:22:14 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.136 2008/05/02 13:40:32 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.137 2008/05/04 07:22:14 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@ -1575,13 +1575,8 @@ db_show_arptab(db_expr_t addr, bool have_addr,
static int
sysctl_net_inet_arp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t arps[ARP_NSTATS];
ctx.ctx_stat = arpstat_percpu;
ctx.ctx_counters = arps;
ctx.ctx_ncounters = ARP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(arpstat_percpu, ARP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_arp_setup, "sysctl net.inet.arp subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp.c,v 1.48 2008/04/24 11:38:37 ad Exp $ */
/* $NetBSD: igmp.c,v 1.49 2008/05/04 07:22:14 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.48 2008/04/24 11:38:37 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.49 2008/05/04 07:22:14 thorpej Exp $");
#include "opt_mrouting.h"
@ -603,13 +603,8 @@ igmp_purgeif(struct ifnet *ifp) /* MUST be called at splsoftnet() */
static int
sysctl_net_inet_igmp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t igmps[IGMP_NSTATS];
ctx.ctx_stat = igmpstat_percpu;
ctx.ctx_counters = igmps;
ctx.ctx_ncounters = IGMP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(igmpstat_percpu, IGMP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_igmp_setup, "sysctl net.inet.igmp subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_carp.c,v 1.25 2008/04/23 05:26:50 thorpej Exp $ */
/* $NetBSD: ip_carp.c,v 1.26 2008/05/04 07:22:14 thorpej Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.25 2008/04/23 05:26:50 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.26 2008/05/04 07:22:14 thorpej Exp $");
/*
* TODO:
@ -2242,13 +2242,8 @@ carp_ether_purgemulti(struct carp_softc *sc)
static int
sysctl_net_inet_carp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t carps[CARP_NSTATS];
ctx.ctx_stat = carpstat_percpu;
ctx.ctx_counters = carps;
ctx.ctx_ncounters = CARP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(carpstat_percpu, CARP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_carp_setup, "sysctl net.inet.carp subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_icmp.c,v 1.118 2008/04/28 20:24:09 martin Exp $ */
/* $NetBSD: ip_icmp.c,v 1.119 2008/05/04 07:22:14 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.118 2008/04/28 20:24:09 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.119 2008/05/04 07:22:14 thorpej Exp $");
#include "opt_ipsec.h"
@ -979,13 +979,8 @@ sysctl_net_inet_icmp_redirtimeout(SYSCTLFN_ARGS)
static int
sysctl_net_inet_icmp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t icps[ICMP_NSTATS];
ctx.ctx_stat = icmpstat_percpu;
ctx.ctx_counters = icps;
ctx.ctx_ncounters = ICMP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(icmpstat_percpu, ICMP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_icmp_setup, "sysctl net.inet.icmp subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.270 2008/05/02 13:40:32 ad Exp $ */
/* $NetBSD: ip_input.c,v 1.271 2008/05/04 07:22:14 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.270 2008/05/02 13:40:32 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.271 2008/05/04 07:22:14 thorpej Exp $");
#include "opt_inet.h"
#include "opt_gateway.h"
@ -2202,13 +2202,8 @@ sysctl_net_inet_ip_hashsize(SYSCTLFN_ARGS)
static int
sysctl_net_inet_ip_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ips[IP_NSTATS];
ctx.ctx_stat = ipstat_percpu;
ctx.ctx_counters = ips;
ctx.ctx_ncounters = IP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ipstat_percpu, IP_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_ip_setup, "sysctl net.inet.ip subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.145 2008/04/28 20:24:09 martin Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.146 2008/05/04 07:22:14 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.145 2008/04/28 20:24:09 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.146 2008/05/04 07:22:14 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1615,13 +1615,8 @@ sysctl_tcp_keep(SYSCTLFN_ARGS)
static int
sysctl_net_inet_tcp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t tcps[TCP_NSTATS];
ctx.ctx_stat = tcpstat_percpu;
ctx.ctx_counters = tcps;
ctx.ctx_ncounters = TCP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(tcpstat_percpu, TCP_NSTATS));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_usrreq.c,v 1.171 2008/04/26 08:13:59 yamt Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.172 2008/05/04 07:22:14 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.171 2008/04/26 08:13:59 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.172 2008/05/04 07:22:14 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1349,13 +1349,8 @@ release:
static int
sysctl_net_inet_udp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t udps[UDP_NSTATS];
ctx.ctx_stat = udpstat_percpu;
ctx.ctx_counters = udps;
ctx.ctx_ncounters = UDP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(udpstat_percpu, UDP_NSTATS));
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: icmp6.c,v 1.146 2008/04/23 05:26:50 thorpej Exp $ */
/* $NetBSD: icmp6.c,v 1.147 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.146 2008/04/23 05:26:50 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.147 2008/05/04 07:22:15 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -2748,13 +2748,8 @@ sysctl_net_inet6_icmp6_nd6(SYSCTLFN_ARGS)
static int
sysctl_net_inet6_icmp6_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t icmp6s[ICMP6_NSTATS];
ctx.ctx_stat = icmp6stat_percpu;
ctx.ctx_counters = icmp6s;
ctx.ctx_ncounters = ICMP6_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(icmp6stat_percpu, ICMP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_icmp6_setup,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_input.c,v 1.118 2008/04/24 11:38:38 ad Exp $ */
/* $NetBSD: ip6_input.c,v 1.119 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.118 2008/04/24 11:38:38 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.119 2008/05/04 07:22:15 thorpej Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@ -1654,13 +1654,8 @@ u_char inet6ctlerrmap[PRC_NCMDS] = {
static int
sysctl_net_inet6_ip6_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ip6s[IP6_NSTATS];
ctx.ctx_stat = ip6stat_percpu;
ctx.ctx_counters = ip6s;
ctx.ctx_ncounters = IP6_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ip6stat_percpu, IP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, "sysctl net.inet6.ip6 subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_mroute.c,v 1.92 2008/04/24 11:38:38 ad Exp $ */
/* $NetBSD: ip6_mroute.c,v 1.93 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.92 2008/04/24 11:38:38 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.93 2008/05/04 07:22:15 thorpej Exp $");
#include "opt_inet.h"
#include "opt_mrouting.h"
@ -1929,13 +1929,8 @@ pim6_input(struct mbuf **mp, int *offp, int proto)
static int
sysctl_net_inet6_pim6_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t pim6s[PIM6_NSTATS];
ctx.ctx_stat = pim6stat_percpu;
ctx.ctx_counters = pim6s;
ctx.ctx_ncounters = PIM6_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(pim6stat_percpu, PIM6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_pim6_setup, "sysctl net.inet6.pim6 subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipsec.c,v 1.129 2008/04/23 06:09:05 thorpej Exp $ */
/* $NetBSD: ipsec.c,v 1.130 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: ipsec.c,v 1.136 2002/05/19 00:36:39 itojun Exp $ */
/*
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.129 2008/04/23 06:09:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.130 2008/05/04 07:22:15 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -3555,13 +3555,8 @@ sysctl_ipsec(SYSCTLFN_ARGS)
static int
sysctl_net_inet_ipsec_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ipss[IPSEC_NSTATS];
ctx.ctx_stat = ipsecstat_percpu;
ctx.ctx_counters = ipss;
ctx.ctx_ncounters = IPSEC_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ipsecstat_percpu, IPSEC_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet_ipsec_setup, "sysctl net.inet.ipsec subtree setup")
@ -3712,13 +3707,8 @@ u_char ipsec6ctlermap[PRC_NCMDS] = {
static int
sysctl_net_inet6_ipsec6_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ipss[IPSEC_NSTATS];
ctx.ctx_stat = ipsec6stat_percpu;
ctx.ctx_counters = ipss;
ctx.ctx_ncounters = IPSEC_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ipsec6stat_percpu, IPSEC_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_ipsec6_setup,

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip6.c,v 1.98 2008/04/24 11:38:38 ad Exp $ */
/* $NetBSD: raw_ip6.c,v 1.99 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.98 2008/04/24 11:38:38 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.99 2008/05/04 07:22:15 thorpej Exp $");
#include "opt_ipsec.h"
@ -873,13 +873,8 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m,
static int
sysctl_net_inet6_raw6_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t rip6s[RIP6_NSTATS];
ctx.ctx_stat = rip6stat_percpu;
ctx.ctx_counters = rip6s;
ctx.ctx_ncounters = RIP6_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(rip6stat_percpu, RIP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_raw6_setup, "sysctl net.inet6.raw6 subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp6_usrreq.c,v 1.85 2008/04/28 15:01:39 yamt Exp $ */
/* $NetBSD: udp6_usrreq.c,v 1.86 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.85 2008/04/28 15:01:39 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.86 2008/05/04 07:22:15 thorpej Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -410,13 +410,8 @@ release:
static int
sysctl_net_inet6_udp6_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t udp6s[UDP6_NSTATS];
ctx.ctx_stat = udp6stat_percpu;
ctx.ctx_counters = udp6s;
ctx.ctx_ncounters = UDP6_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(udp6stat_percpu, UDP6_NSTATS));
}
SYSCTL_SETUP(sysctl_net_inet6_udp6_setup, "sysctl net.inet6.udp6 subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipsec_netbsd.c,v 1.31 2008/04/27 12:58:48 degroote Exp $ */
/* $NetBSD: ipsec_netbsd.c,v 1.32 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: esp_input.c,v 1.60 2001/09/04 08:43:19 itojun Exp $ */
/* $KAME: ah_input.c,v 1.64 2001/09/04 08:43:19 itojun Exp $ */
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.31 2008/04/27 12:58:48 degroote Exp $");
__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.32 2008/05/04 07:22:15 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -445,61 +445,36 @@ sysctl_fast_ipsec_test(SYSCTLFN_ARGS)
static int
sysctl_net_inet_fast_ipsec_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ipss[IPSEC_NSTATS];
ctx.ctx_stat = ipsecstat_percpu;
ctx.ctx_counters = ipss;
ctx.ctx_ncounters = IPSEC_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ipsecstat_percpu, IPSEC_NSTATS));
}
static int
sysctl_net_inet_ah_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ipss[AH_NSTATS];
ctx.ctx_stat = ahstat_percpu;
ctx.ctx_counters = ipss;
ctx.ctx_ncounters = AH_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ahstat_percpu, AH_NSTATS));
}
static int
sysctl_net_inet_esp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ipss[ESP_NSTATS];
ctx.ctx_stat = espstat_percpu;
ctx.ctx_counters = ipss;
ctx.ctx_ncounters = ESP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(espstat_percpu, ESP_NSTATS));
}
static int
sysctl_net_inet_ipcomp_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ipss[IPCOMP_NSTATS];
ctx.ctx_stat = ipcompstat_percpu;
ctx.ctx_counters = ipss;
ctx.ctx_ncounters = IPCOMP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ipcompstat_percpu, IPCOMP_NSTATS));
}
static int
sysctl_net_inet_ipip_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ipss[IPIP_NSTATS];
ctx.ctx_stat = ipipstat_percpu;
ctx.ctx_counters = ipss;
ctx.ctx_ncounters = IPIP_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(ipipstat_percpu, IPIP_NSTATS));
}
/* XXX will need a different oid at parent */

View File

@ -1,4 +1,4 @@
/* $NetBSD: key.c,v 1.54 2008/05/03 21:53:23 degroote Exp $ */
/* $NetBSD: key.c,v 1.55 2008/05/04 07:22:15 thorpej Exp $ */
/* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.54 2008/05/03 21:53:23 degroote Exp $");
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.55 2008/05/04 07:22:15 thorpej Exp $");
/*
* This code is referd to RFC 2367
@ -8151,13 +8151,8 @@ sysctl_net_key_dumpsp(SYSCTLFN_ARGS)
static int
sysctl_net_key_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ps[PFKEY_NSTATS];
ctx.ctx_stat = pfkeystat_percpu;
ctx.ctx_counters = ps;
ctx.ctx_ncounters = PFKEY_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(pfkeystat_percpu, PFKEY_NSTATS));
}
SYSCTL_SETUP(sysctl_net_keyv2_setup, "sysctl net.keyv2 subtree setup")

View File

@ -1,4 +1,4 @@
/* $NetBSD: key.c,v 1.159 2008/04/24 11:38:38 ad Exp $ */
/* $NetBSD: key.c,v 1.160 2008/05/04 07:22:15 thorpej Exp $ */
/* $KAME: key.c,v 1.310 2003/09/08 02:23:44 itojun Exp $ */
/*
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.159 2008/04/24 11:38:38 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.160 2008/05/04 07:22:15 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -8439,13 +8439,8 @@ sysctl_net_key_dumpsp(SYSCTLFN_ARGS)
static int
sysctl_net_key_stats(SYSCTLFN_ARGS)
{
netstat_sysctl_context ctx;
uint64_t ps[PFKEY_NSTATS];
ctx.ctx_stat = pfkeystat_percpu;
ctx.ctx_counters = ps;
ctx.ctx_ncounters = PFKEY_NSTATS;
return (NETSTAT_SYSCTL(&ctx));
return (NETSTAT_SYSCTL(pfkeystat_percpu, PFKEY_NSTATS));
}
SYSCTL_SETUP(sysctl_net_key_setup, "sysctl net.key subtree setup")