diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2023-04-05 21:51:48 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2023-04-05 21:51:48 +0000 |
commit | 7e4ccd27cfdfbceb30ea07c53ad747f6dc5095fc (patch) | |
tree | b1bb47b2dfac6571e63243b01f5f308a43b693e1 /sys/netinet | |
parent | 97d8da8a6b1f8ca43457237826312668a9f2005f (diff) |
ARP has a sysctl to show the number of packets waiting for an arp
response. Implement analog sysctl net.inet6.icmp6.nd6_queued for
ND6 to reduce places where mbufs can hide within the kernel.
Atomic operations operate on unsigned int. Make the type of total
hold queue length consistent.
Use atomic load to read the value for the sysctl. This clarifies
why no lock around sysctl_rdint() is needed.
OK mvs@ kn@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/icmp6.h | 7 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 4 |
4 files changed, 11 insertions, 9 deletions
diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index ef7df8dfdde..210c6191fd8 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.h,v 1.51 2021/01/11 13:28:53 bluhm Exp $ */ +/* $OpenBSD: icmp6.h,v 1.52 2023/04/05 21:51:47 bluhm Exp $ */ /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ /* @@ -504,7 +504,8 @@ struct icmp6stat { #define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */ #define ICMPV6CTL_ND6_DELAY 8 #define ICMPV6CTL_ND6_UMAXTRIES 9 -#define ICMPV6CTL_ND6_MMAXTRIES 10 +#define ICMPV6CTL_ND6_MMAXTRIES 10 +#define ICMPV6CTL_ND6_QUEUED 11 #define ICMPV6CTL_NODEINFO 13 #define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */ #define ICMPV6CTL_ND6_MAXNUDHINT 15 @@ -525,7 +526,7 @@ struct icmp6stat { { "nd6_delay", CTLTYPE_INT }, \ { "nd6_umaxtries", CTLTYPE_INT }, \ { "nd6_mmaxtries", CTLTYPE_INT }, \ - { 0, 0 }, \ + { "nd6_queued", CTLTYPE_INT }, \ { 0, 0 }, \ { 0, 0 }, \ { "errppslimit", CTLTYPE_INT }, \ diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index b1268d3fa00..46aa3c26acb 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.259 2023/04/05 19:35:23 bluhm Exp $ */ +/* $OpenBSD: if_ether.c,v 1.260 2023/04/05 21:51:47 bluhm Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -109,7 +109,7 @@ LIST_HEAD(, llinfo_arp) arp_list = LIST_HEAD_INITIALIZER(arp_list); /* [mN] list of llinfo_arp structures */ struct pool arp_pool; /* [I] pool for llinfo_arp structures */ int arp_maxtries = 5; /* [I] arp requests before set to rejected */ -int la_hold_total; /* [a] packets currently in the arp queue */ +unsigned int la_hold_total; /* [a] packets currently in the arp queue */ #ifdef NFSCLIENT /* revarp state */ diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 07dde2897c5..42c1c72d78d 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.382 2023/03/08 23:17:02 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.383 2023/04/05 21:51:47 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1698,7 +1698,8 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (sysctl_niq(name + 1, namelen - 1, oldp, oldlenp, newp, newlen, &arpinq)); case IPCTL_ARPQUEUED: - return (sysctl_rdint(oldp, oldlenp, newp, la_hold_total)); + return (sysctl_rdint(oldp, oldlenp, newp, + atomic_load_int(&la_hold_total))); case IPCTL_STATS: return (ip_sysctl_ipstat(oldp, oldlenp, newp)); #ifdef MROUTING diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index e4ba27bc65c..b93b27ca337 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.108 2022/11/17 18:05:43 mvs Exp $ */ +/* $OpenBSD: ip_var.h,v 1.109 2023/04/05 21:51:47 bluhm Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -217,7 +217,7 @@ extern int ipforwarding; /* enable IP forwarding */ extern int ipmforwarding; /* enable multicast forwarding */ #endif extern int ipmultipath; /* enable multipath routing */ -extern int la_hold_total; +extern unsigned int la_hold_total; extern const struct pr_usrreqs rip_usrreqs; |