Re: git: 3360a15898ce - main - net: route: convert routing statistics to a sysctl

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Thu, 24 Oct 2024 03:17:03 UTC
On 10/23/24 22:16, Kyle Evans wrote:
> The branch main has been updated by kevans:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=3360a15898ce6cd06aad5afd9b48c8a5454cf952
> 
> commit 3360a15898ce6cd06aad5afd9b48c8a5454cf952
> Author:     Kyle Evans <kevans@FreeBSD.org>
> AuthorDate: 2024-10-24 03:15:55 +0000
> Commit:     Kyle Evans <kevans@FreeBSD.org>
> CommitDate: 2024-10-24 03:15:55 +0000
> 
>      net: route: convert routing statistics to a sysctl
>      
>      Exporting the relevant pcpustat is trivial, so let's do that.  We will
>      use it in a near-future change in netstat to avoid having to dig around
>      in mem(4) for live kernel statistics.
>      
>      Differential Revision:  https://reviews.freebsd.org/D47231

Sorry, I failed to ^C it in time.

Reviewed by: glebius, markj, zlei

Thanks,

Kyle Evans

> ---
>   sys/net/route.c | 4 ++++
>   sys/net/route.h | 1 +
>   2 files changed, 5 insertions(+)
> 
> diff --git a/sys/net/route.c b/sys/net/route.c
> index 650da826d89d..7a50bcc43e06 100644
> --- a/sys/net/route.c
> +++ b/sys/net/route.c
> @@ -75,6 +75,10 @@ VNET_PCPUSTAT_SYSINIT(rtstat);
>   VNET_PCPUSTAT_SYSUNINIT(rtstat);
>   #endif
>   
> +SYSCTL_DECL(_net_route);
> +SYSCTL_VNET_PCPUSTAT(_net_route, OID_AUTO, stats, struct rtstat,
> +    rtstat, "route statistics");
> +
>   EVENTHANDLER_LIST_DEFINE(rt_addrmsg);
>   
>   static int rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *,
> diff --git a/sys/net/route.h b/sys/net/route.h
> index 6d28f21e9181..603e4fac5354 100644
> --- a/sys/net/route.h
> +++ b/sys/net/route.h
> @@ -239,6 +239,7 @@ struct rtstat {
>   	uint64_t rts_add_retry;		/* # of route addition retries */
>   	uint64_t rts_del_failure;	/* # of route deletion failure */
>   	uint64_t rts_del_retry;		/* # of route deletion retries */
> +	uint64_t rts_spare[5];
>   };
>   
>   /*