diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2019-07-03 10:19:46 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2019-07-03 10:19:46 +0000 |
commit | 87c3a1805d44c7fd2ec53e30d48e7cab484fb230 (patch) | |
tree | 15d796d4fdbd9ba2d21c74deb8e7c2622b662756 /sys/net | |
parent | 25b99591ca6494fe4f2212b73d92e1aa0dc6bc85 (diff) |
add the kernel side of net.link.ifrxq.pressure_return and pressure_drop
these values are used as the backpressure thresholds in the interface
rx q processing code. theyre being exposed as tunables to userland
while we are figuring out what the best values for them are.
ok visa@ deraadt@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/ifq.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sys/net/ifq.c b/sys/net/ifq.c index bd0764e907f..302277c2e7b 100644 --- a/sys/net/ifq.c +++ b/sys/net/ifq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.c,v 1.32 2019/07/01 00:44:29 dlg Exp $ */ +/* $OpenBSD: ifq.c,v 1.33 2019/07/03 10:19:45 dlg Exp $ */ /* * Copyright (c) 2015 David Gwynne <dlg@openbsd.org> @@ -23,6 +23,7 @@ #include <sys/socket.h> #include <sys/mbuf.h> #include <sys/proc.h> +#include <sys/sysctl.h> #include <net/if.h> #include <net/if_var.h> @@ -607,6 +608,43 @@ ifiq_process(void *arg) if_input_process(ifiq->ifiq_if, &ml); } +int +net_ifiq_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + int val; + int error; + + if (namelen != 1) + return (EISDIR); + + switch (name[0]) { + case NET_LINK_IFRXQ_PRESSURE_RETURN: + val = ifiq_pressure_return; + error = sysctl_int(oldp, oldlenp, newp, newlen, &val); + if (error != 0) + return (error); + if (val < 1 || val > ifiq_pressure_drop) + return (EINVAL); + ifiq_pressure_return = val; + break; + case NET_LINK_IFRXQ_PRESSURE_DROP: + val = ifiq_pressure_drop; + error = sysctl_int(oldp, oldlenp, newp, newlen, &val); + if (error != 0) + return (error); + if (ifiq_pressure_return > val) + return (EINVAL); + ifiq_pressure_drop = val; + break; + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} + /* * priq implementation */ |