1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2590232a7SArnaldo Carvalho de Melo /*
3590232a7SArnaldo Carvalho de Melo * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
4590232a7SArnaldo Carvalho de Melo *
5590232a7SArnaldo Carvalho de Melo * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6590232a7SArnaldo Carvalho de Melo */
7590232a7SArnaldo Carvalho de Melo
8590232a7SArnaldo Carvalho de Melo #include <linux/mm.h>
9590232a7SArnaldo Carvalho de Melo #include <linux/init.h>
10590232a7SArnaldo Carvalho de Melo #include <linux/sysctl.h>
115dd3df10SEric W. Biederman #include <net/net_namespace.h>
122928c19eSArnaldo Carvalho de Melo #include <net/llc.h>
13590232a7SArnaldo Carvalho de Melo
14590232a7SArnaldo Carvalho de Melo #ifndef CONFIG_SYSCTL
15590232a7SArnaldo Carvalho de Melo #error This file should not be compiled without CONFIG_SYSCTL defined
16590232a7SArnaldo Carvalho de Melo #endif
17590232a7SArnaldo Carvalho de Melo
18590232a7SArnaldo Carvalho de Melo static struct ctl_table llc2_timeout_table[] = {
19590232a7SArnaldo Carvalho de Melo {
20590232a7SArnaldo Carvalho de Melo .procname = "ack",
21590232a7SArnaldo Carvalho de Melo .data = &sysctl_llc2_ack_timeout,
226b8d9117SSasha Levin .maxlen = sizeof(sysctl_llc2_ack_timeout),
23590232a7SArnaldo Carvalho de Melo .mode = 0644,
246d9f239aSAlexey Dobriyan .proc_handler = proc_dointvec_jiffies,
25590232a7SArnaldo Carvalho de Melo },
26590232a7SArnaldo Carvalho de Melo {
27590232a7SArnaldo Carvalho de Melo .procname = "busy",
28590232a7SArnaldo Carvalho de Melo .data = &sysctl_llc2_busy_timeout,
296b8d9117SSasha Levin .maxlen = sizeof(sysctl_llc2_busy_timeout),
30590232a7SArnaldo Carvalho de Melo .mode = 0644,
316d9f239aSAlexey Dobriyan .proc_handler = proc_dointvec_jiffies,
32590232a7SArnaldo Carvalho de Melo },
33590232a7SArnaldo Carvalho de Melo {
34590232a7SArnaldo Carvalho de Melo .procname = "p",
35590232a7SArnaldo Carvalho de Melo .data = &sysctl_llc2_p_timeout,
366b8d9117SSasha Levin .maxlen = sizeof(sysctl_llc2_p_timeout),
37590232a7SArnaldo Carvalho de Melo .mode = 0644,
386d9f239aSAlexey Dobriyan .proc_handler = proc_dointvec_jiffies,
39590232a7SArnaldo Carvalho de Melo },
40590232a7SArnaldo Carvalho de Melo {
41590232a7SArnaldo Carvalho de Melo .procname = "rej",
42590232a7SArnaldo Carvalho de Melo .data = &sysctl_llc2_rej_timeout,
436b8d9117SSasha Levin .maxlen = sizeof(sysctl_llc2_rej_timeout),
44590232a7SArnaldo Carvalho de Melo .mode = 0644,
456d9f239aSAlexey Dobriyan .proc_handler = proc_dointvec_jiffies,
46590232a7SArnaldo Carvalho de Melo },
47f8572d8fSEric W. Biederman { },
48590232a7SArnaldo Carvalho de Melo };
49590232a7SArnaldo Carvalho de Melo
50590232a7SArnaldo Carvalho de Melo static struct ctl_table llc_station_table[] = {
51f8572d8fSEric W. Biederman { },
52590232a7SArnaldo Carvalho de Melo };
53590232a7SArnaldo Carvalho de Melo
5464fb3010SEric W. Biederman static struct ctl_table_header *llc2_timeout_header;
5564fb3010SEric W. Biederman static struct ctl_table_header *llc_station_header;
56590232a7SArnaldo Carvalho de Melo
llc_sysctl_init(void)57590232a7SArnaldo Carvalho de Melo int __init llc_sysctl_init(void)
58590232a7SArnaldo Carvalho de Melo {
5964fb3010SEric W. Biederman llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
6064fb3010SEric W. Biederman llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
61590232a7SArnaldo Carvalho de Melo
6264fb3010SEric W. Biederman if (!llc2_timeout_header || !llc_station_header) {
6364fb3010SEric W. Biederman llc_sysctl_exit();
6464fb3010SEric W. Biederman return -ENOMEM;
6564fb3010SEric W. Biederman }
6664fb3010SEric W. Biederman return 0;
67590232a7SArnaldo Carvalho de Melo }
68590232a7SArnaldo Carvalho de Melo
llc_sysctl_exit(void)69590232a7SArnaldo Carvalho de Melo void llc_sysctl_exit(void)
70590232a7SArnaldo Carvalho de Melo {
7164fb3010SEric W. Biederman if (llc2_timeout_header) {
7264fb3010SEric W. Biederman unregister_net_sysctl_table(llc2_timeout_header);
7364fb3010SEric W. Biederman llc2_timeout_header = NULL;
7464fb3010SEric W. Biederman }
7564fb3010SEric W. Biederman if (llc_station_header) {
7664fb3010SEric W. Biederman unregister_net_sysctl_table(llc_station_header);
7764fb3010SEric W. Biederman llc_station_header = NULL;
78590232a7SArnaldo Carvalho de Melo }
79590232a7SArnaldo Carvalho de Melo }
80