blob: 612a5ddaf93b1ab1b5a524c5efef8d6b1f769038 [file] [log] [blame]
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -03001/*
2 * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
YOSHIFUJI Hideakid57b1862007-02-09 23:25:01 +09003 *
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -03004 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5 */
6
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -03007#include <linux/mm.h>
8#include <linux/init.h>
9#include <linux/sysctl.h>
Eric W. Biederman5dd3df12012-04-19 13:24:33 +000010#include <net/net_namespace.h>
Arnaldo Carvalho de Melo2928c192005-09-22 05:14:33 -030011#include <net/llc.h>
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030012
13#ifndef CONFIG_SYSCTL
14#error This file should not be compiled without CONFIG_SYSCTL defined
15#endif
16
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030017static struct ctl_table llc2_timeout_table[] = {
18 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030019 .procname = "ack",
20 .data = &sysctl_llc2_ack_timeout,
21 .maxlen = sizeof(long),
22 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080023 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030024 },
25 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030026 .procname = "busy",
27 .data = &sysctl_llc2_busy_timeout,
28 .maxlen = sizeof(long),
29 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080030 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030031 },
32 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030033 .procname = "p",
34 .data = &sysctl_llc2_p_timeout,
35 .maxlen = sizeof(long),
36 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080037 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030038 },
39 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030040 .procname = "rej",
41 .data = &sysctl_llc2_rej_timeout,
42 .maxlen = sizeof(long),
43 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080044 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030045 },
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080046 { },
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030047};
48
49static struct ctl_table llc_station_table[] = {
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080050 { },
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030051};
52
Eric W. Biederman64fb3012012-04-19 13:35:39 +000053static struct ctl_table_header *llc2_timeout_header;
54static struct ctl_table_header *llc_station_header;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030055
56int __init llc_sysctl_init(void)
57{
Eric W. Biederman64fb3012012-04-19 13:35:39 +000058 llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
59 llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030060
Eric W. Biederman64fb3012012-04-19 13:35:39 +000061 if (!llc2_timeout_header || !llc_station_header) {
62 llc_sysctl_exit();
63 return -ENOMEM;
64 }
65 return 0;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030066}
67
68void llc_sysctl_exit(void)
69{
Eric W. Biederman64fb3012012-04-19 13:35:39 +000070 if (llc2_timeout_header) {
71 unregister_net_sysctl_table(llc2_timeout_header);
72 llc2_timeout_header = NULL;
73 }
74 if (llc_station_header) {
75 unregister_net_sysctl_table(llc_station_header);
76 llc_station_header = NULL;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030077 }
78}