[LLC]: Add sysctl support for the LLC timeouts
[linux-3.10.git] / net / llc / sysctl_net_llc.c
1 /*
2  * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
3  * 
4  * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5  */
6
7 #include <linux/config.h>
8 #include <linux/mm.h>
9 #include <linux/init.h>
10 #include <linux/sysctl.h>
11
12 #ifndef CONFIG_SYSCTL
13 #error This file should not be compiled without CONFIG_SYSCTL defined
14 #endif
15
16 extern int sysctl_llc2_ack_timeout;
17 extern int sysctl_llc2_busy_timeout;
18 extern int sysctl_llc2_p_timeout;
19 extern int sysctl_llc2_rej_timeout;
20 extern int sysctl_llc_station_ack_timeout;
21
22 static struct ctl_table llc2_timeout_table[] = {
23         {
24                 .ctl_name       = NET_LLC2_ACK_TIMEOUT,
25                 .procname       = "ack",
26                 .data           = &sysctl_llc2_ack_timeout,
27                 .maxlen         = sizeof(long),
28                 .mode           = 0644,
29                 .proc_handler   = &proc_dointvec_jiffies,
30                 .strategy       = &sysctl_jiffies,
31         },
32         {
33                 .ctl_name       = NET_LLC2_BUSY_TIMEOUT,
34                 .procname       = "busy",
35                 .data           = &sysctl_llc2_busy_timeout,
36                 .maxlen         = sizeof(long),
37                 .mode           = 0644,
38                 .proc_handler   = &proc_dointvec_jiffies,
39                 .strategy       = &sysctl_jiffies,
40         },
41         {
42                 .ctl_name       = NET_LLC2_P_TIMEOUT,
43                 .procname       = "p",
44                 .data           = &sysctl_llc2_p_timeout,
45                 .maxlen         = sizeof(long),
46                 .mode           = 0644,
47                 .proc_handler   = &proc_dointvec_jiffies,
48                 .strategy       = &sysctl_jiffies,
49         },
50         {
51                 .ctl_name       = NET_LLC2_REJ_TIMEOUT,
52                 .procname       = "rej",
53                 .data           = &sysctl_llc2_rej_timeout,
54                 .maxlen         = sizeof(long),
55                 .mode           = 0644,
56                 .proc_handler   = &proc_dointvec_jiffies,
57                 .strategy       = &sysctl_jiffies,
58         },
59         { 0 },
60 };
61
62 static struct ctl_table llc_station_table[] = {
63         {
64                 .ctl_name       = NET_LLC_STATION_ACK_TIMEOUT,
65                 .procname       = "ack_timeout",
66                 .data           = &sysctl_llc_station_ack_timeout,
67                 .maxlen         = sizeof(long),
68                 .mode           = 0644,
69                 .proc_handler   = &proc_dointvec_jiffies,
70                 .strategy       = &sysctl_jiffies,
71         },
72         { 0 },
73 };
74
75 static struct ctl_table llc2_dir_timeout_table[] = {
76         {
77                 .ctl_name       = NET_LLC2,
78                 .procname       = "timeout",
79                 .mode           = 0555,
80                 .child          = llc2_timeout_table,
81         },
82         { 0 },
83 };
84
85 static struct ctl_table llc_table[] = {
86         {
87                 .ctl_name       = NET_LLC2,
88                 .procname       = "llc2",
89                 .mode           = 0555,
90                 .child          = llc2_dir_timeout_table,
91         },
92         {
93                 .ctl_name       = NET_LLC_STATION,
94                 .procname       = "station",
95                 .mode           = 0555,
96                 .child          = llc_station_table,
97         },
98         { 0 },
99 };
100
101 static struct ctl_table llc_dir_table[] = {
102         {
103                 .ctl_name       = NET_LLC,
104                 .procname       = "llc",
105                 .mode           = 0555,
106                 .child          = llc_table,
107         },
108         { 0 },
109 };
110
111 static struct ctl_table llc_root_table[] = {
112         {
113                 .ctl_name       = CTL_NET,
114                 .procname       = "net",
115                 .mode           = 0555,
116                 .child          = llc_dir_table,
117         },
118         { 0 },
119 };
120
121 static struct ctl_table_header *llc_table_header;
122
123 int __init llc_sysctl_init(void)
124 {
125         llc_table_header = register_sysctl_table(llc_root_table, 1);
126
127         return llc_table_header ? 0 : -ENOMEM;
128 }
129
130 void llc_sysctl_exit(void)
131 {
132         if (llc_table_header) {
133                 unregister_sysctl_table(llc_table_header);
134                 llc_table_header = NULL;
135         }
136 }