blob: 8443a6d841b0645859328b73f0740b7872fdcb64 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -03002/*
3 * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
YOSHIFUJI Hideakid57b1862007-02-09 23:25:01 +09004 *
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -03005 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 */
7
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -03008#include <linux/mm.h>
9#include <linux/init.h>
10#include <linux/sysctl.h>
Eric W. Biederman5dd3df12012-04-19 13:24:33 +000011#include <net/net_namespace.h>
Arnaldo Carvalho de Melo2928c192005-09-22 05:14:33 -030012#include <net/llc.h>
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030013
14#ifndef CONFIG_SYSCTL
15#error This file should not be compiled without CONFIG_SYSCTL defined
16#endif
17
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030018static struct ctl_table llc2_timeout_table[] = {
19 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030020 .procname = "ack",
21 .data = &sysctl_llc2_ack_timeout,
Sasha Levin6b8d9112015-01-23 20:47:00 -050022 .maxlen = sizeof(sysctl_llc2_ack_timeout),
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030023 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080024 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030025 },
26 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030027 .procname = "busy",
28 .data = &sysctl_llc2_busy_timeout,
Sasha Levin6b8d9112015-01-23 20:47:00 -050029 .maxlen = sizeof(sysctl_llc2_busy_timeout),
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030030 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080031 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030032 },
33 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030034 .procname = "p",
35 .data = &sysctl_llc2_p_timeout,
Sasha Levin6b8d9112015-01-23 20:47:00 -050036 .maxlen = sizeof(sysctl_llc2_p_timeout),
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030037 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080038 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030039 },
40 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030041 .procname = "rej",
42 .data = &sysctl_llc2_rej_timeout,
Sasha Levin6b8d9112015-01-23 20:47:00 -050043 .maxlen = sizeof(sysctl_llc2_rej_timeout),
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030044 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080045 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030046 },
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080047 { },
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030048};
49
50static struct ctl_table llc_station_table[] = {
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080051 { },
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030052};
53
Eric W. Biederman64fb3012012-04-19 13:35:39 +000054static struct ctl_table_header *llc2_timeout_header;
55static struct ctl_table_header *llc_station_header;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030056
57int __init llc_sysctl_init(void)
58{
Eric W. Biederman64fb3012012-04-19 13:35:39 +000059 llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
60 llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030061
Eric W. Biederman64fb3012012-04-19 13:35:39 +000062 if (!llc2_timeout_header || !llc_station_header) {
63 llc_sysctl_exit();
64 return -ENOMEM;
65 }
66 return 0;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030067}
68
69void llc_sysctl_exit(void)
70{
Eric W. Biederman64fb3012012-04-19 13:35:39 +000071 if (llc2_timeout_header) {
72 unregister_net_sysctl_table(llc2_timeout_header);
73 llc2_timeout_header = NULL;
74 }
75 if (llc_station_header) {
76 unregister_net_sysctl_table(llc_station_header);
77 llc_station_header = NULL;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030078 }
79}