From 5249bf6428e70aa489aa9b8c44b16935c391a7fe Mon Sep 17 00:00:00 2001 From: "Sergey V. Lobanov" Date: Mon, 20 Dec 2021 18:00:32 +0300 Subject: T55: add netlink buffer size configuration parameters Netlink buffers may overflow so it might be useful to increase send and receive netlink buffer sizes. Two parameters to [common] configuration section added: nl-rcv-buffer, nl-snd-buffer. It is required to set (sysctl) net.core.wmem_max>=nl-snd-buffer and net.core.rmem_max>=nl-rcv-buffer before running accel-pppd To check current netlink buffer size and related info use the following command: % ss -f netlink -m 0 0 rtnl:kernel * skmem:(r0,rb212992,t0,tb212992,f0,w0,o0,bl0,d0) 0 0 rtnl:-1140221812 * skmem:(r0,rb2048000,t0,tb80000,f0,w0,o0,bl0,d0) 0 0 rtnl:accel-pppd/14285 * skmem:(r0,rb2048000,t0,tb65536,f0,w0,o0,bl0,d0) ... (Please check man ss to get the meaning for r,rb,t,tb,f,w,o,bl and d params) In the ss output you will see the values doubled from configured. First accel-pppd netlink socket will use default values (rcv=1048576, snd=32768) regardless of configured nl-rcv-buffer and nl-snd-buffer values. Signed-off-by: Sergey V. Lobanov --- accel-pppd/net.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'accel-pppd/net.c') diff --git a/accel-pppd/net.c b/accel-pppd/net.c index 26373fc..c619dee 100644 --- a/accel-pppd/net.c +++ b/accel-pppd/net.c @@ -45,6 +45,9 @@ __export __thread struct ap_net *net; __export struct ap_net *def_net; static int def_ns_fd; +__export int conf_nl_rcvbuf = 1024 * 1024; +__export int conf_nl_sndbuf = -1; + static int def_socket(int domain, int type, int proto) { return socket(domain, type, proto); @@ -432,6 +435,14 @@ static void __init init() { const char *opt; + opt = conf_get_opt("common", "nl-rcv-buffer"); + if (opt) + conf_nl_rcvbuf = atoi(opt); + + opt = conf_get_opt("common", "nl-snd-buffer"); + if (opt) + conf_nl_sndbuf = atoi(opt); + opt = conf_get_opt("common", "netns-run-dir"); if (opt) conf_netns_run_dir = opt; -- cgit v1.2.3