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