blob: d75306b9c2f3e80d5fe0ed90d511d646b8a0728c [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[] = {
50 {
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030051 .procname = "ack_timeout",
52 .data = &sysctl_llc_station_ack_timeout,
53 .maxlen = sizeof(long),
54 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080055 .proc_handler = proc_dointvec_jiffies,
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030056 },
Eric W. Biedermanf8572d82009-11-05 13:32:03 -080057 { },
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030058};
59
Eric W. Biederman64fb3012012-04-19 13:35:39 +000060static struct ctl_table_header *llc2_timeout_header;
61static struct ctl_table_header *llc_station_header;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030062
63int __init llc_sysctl_init(void)
64{
Eric W. Biederman64fb3012012-04-19 13:35:39 +000065 llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
66 llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030067
Eric W. Biederman64fb3012012-04-19 13:35:39 +000068 if (!llc2_timeout_header || !llc_station_header) {
69 llc_sysctl_exit();
70 return -ENOMEM;
71 }
72 return 0;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030073}
74
75void llc_sysctl_exit(void)
76{
Eric W. Biederman64fb3012012-04-19 13:35:39 +000077 if (llc2_timeout_header) {
78 unregister_net_sysctl_table(llc2_timeout_header);
79 llc2_timeout_header = NULL;
80 }
81 if (llc_station_header) {
82 unregister_net_sysctl_table(llc_station_header);
83 llc_station_header = NULL;
Arnaldo Carvalho de Melo590232a2005-09-22 04:30:44 -030084 }
85}