xref: /linux/net/dccp/sysctl.c (revision 2e2e9e92bd723244ea20fa488b1780111f2b05e1)
1e55d912fSArnaldo Carvalho de Melo /*
2e55d912fSArnaldo Carvalho de Melo  *  net/dccp/sysctl.c
3e55d912fSArnaldo Carvalho de Melo  *
4e55d912fSArnaldo Carvalho de Melo  *  An implementation of the DCCP protocol
5e55d912fSArnaldo Carvalho de Melo  *  Arnaldo Carvalho de Melo <acme@mandriva.com>
6e55d912fSArnaldo Carvalho de Melo  *
7e55d912fSArnaldo Carvalho de Melo  *	This program is free software; you can redistribute it and/or
8e55d912fSArnaldo Carvalho de Melo  *	modify it under the terms of the GNU General Public License v2
9e55d912fSArnaldo Carvalho de Melo  *	as published by the Free Software Foundation.
10e55d912fSArnaldo Carvalho de Melo  */
11e55d912fSArnaldo Carvalho de Melo 
12e55d912fSArnaldo Carvalho de Melo #include <linux/mm.h>
13e55d912fSArnaldo Carvalho de Melo #include <linux/sysctl.h>
14*2e2e9e92SGerrit Renker #include "dccp.h"
152a0109a7SIan McDonald #include "feat.h"
16e55d912fSArnaldo Carvalho de Melo 
17e55d912fSArnaldo Carvalho de Melo #ifndef CONFIG_SYSCTL
18e55d912fSArnaldo Carvalho de Melo #error This file should not be compiled without CONFIG_SYSCTL defined
19e55d912fSArnaldo Carvalho de Melo #endif
20e55d912fSArnaldo Carvalho de Melo 
21e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_default_table[] = {
22e55d912fSArnaldo Carvalho de Melo 	{
23e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT_SEQ_WINDOW,
24e55d912fSArnaldo Carvalho de Melo 		.procname	= "seq_window",
25e55d912fSArnaldo Carvalho de Melo 		.data		= &dccp_feat_default_sequence_window,
26e55d912fSArnaldo Carvalho de Melo 		.maxlen		= sizeof(dccp_feat_default_sequence_window),
27e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
28e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
29e55d912fSArnaldo Carvalho de Melo 	},
30e55d912fSArnaldo Carvalho de Melo 	{
31e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT_RX_CCID,
32e55d912fSArnaldo Carvalho de Melo 		.procname	= "rx_ccid",
33e55d912fSArnaldo Carvalho de Melo 		.data		= &dccp_feat_default_rx_ccid,
34e55d912fSArnaldo Carvalho de Melo 		.maxlen		= sizeof(dccp_feat_default_rx_ccid),
35e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
36e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
37e55d912fSArnaldo Carvalho de Melo 	},
38e55d912fSArnaldo Carvalho de Melo 	{
39e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT_TX_CCID,
40e55d912fSArnaldo Carvalho de Melo 		.procname	= "tx_ccid",
41e55d912fSArnaldo Carvalho de Melo 		.data		= &dccp_feat_default_tx_ccid,
42e55d912fSArnaldo Carvalho de Melo 		.maxlen		= sizeof(dccp_feat_default_tx_ccid),
43e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
44e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
45e55d912fSArnaldo Carvalho de Melo 	},
46e55d912fSArnaldo Carvalho de Melo 	{
47e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT_ACK_RATIO,
48e55d912fSArnaldo Carvalho de Melo 		.procname	= "ack_ratio",
49e55d912fSArnaldo Carvalho de Melo 		.data		= &dccp_feat_default_ack_ratio,
50e55d912fSArnaldo Carvalho de Melo 		.maxlen		= sizeof(dccp_feat_default_ack_ratio),
51e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
52e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
53e55d912fSArnaldo Carvalho de Melo 	},
54e55d912fSArnaldo Carvalho de Melo 	{
55e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT_SEND_ACKVEC,
56e55d912fSArnaldo Carvalho de Melo 		.procname	= "send_ackvec",
57e55d912fSArnaldo Carvalho de Melo 		.data		= &dccp_feat_default_send_ack_vector,
58e55d912fSArnaldo Carvalho de Melo 		.maxlen		= sizeof(dccp_feat_default_send_ack_vector),
59e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
60e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
61e55d912fSArnaldo Carvalho de Melo 	},
62e55d912fSArnaldo Carvalho de Melo 	{
63e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT_SEND_NDP,
64e55d912fSArnaldo Carvalho de Melo 		.procname	= "send_ndp",
65e55d912fSArnaldo Carvalho de Melo 		.data		= &dccp_feat_default_send_ndp_count,
66e55d912fSArnaldo Carvalho de Melo 		.maxlen		= sizeof(dccp_feat_default_send_ndp_count),
67e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
68e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
69e55d912fSArnaldo Carvalho de Melo 	},
70*2e2e9e92SGerrit Renker 	{
71*2e2e9e92SGerrit Renker 		.ctl_name	= NET_DCCP_DEFAULT_REQ_RETRIES,
72*2e2e9e92SGerrit Renker 		.procname	= "request_retries",
73*2e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_request_retries,
74*2e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_request_retries),
75*2e2e9e92SGerrit Renker 		.mode		= 0644,
76*2e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
77*2e2e9e92SGerrit Renker 	},
78*2e2e9e92SGerrit Renker 	{
79*2e2e9e92SGerrit Renker 		.ctl_name	= NET_DCCP_DEFAULT_RETRIES1,
80*2e2e9e92SGerrit Renker 		.procname	= "retries1",
81*2e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries1,
82*2e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries1),
83*2e2e9e92SGerrit Renker 		.mode		= 0644,
84*2e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
85*2e2e9e92SGerrit Renker 	},
86*2e2e9e92SGerrit Renker 	{
87*2e2e9e92SGerrit Renker 		.ctl_name	= NET_DCCP_DEFAULT_RETRIES2,
88*2e2e9e92SGerrit Renker 		.procname	= "retries2",
89*2e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries2,
90*2e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries2),
91*2e2e9e92SGerrit Renker 		.mode		= 0644,
92*2e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
93*2e2e9e92SGerrit Renker 	},
94e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, }
95e55d912fSArnaldo Carvalho de Melo };
96e55d912fSArnaldo Carvalho de Melo 
97e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_table[] = {
98e55d912fSArnaldo Carvalho de Melo 	{
99e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT,
100e55d912fSArnaldo Carvalho de Melo 		.procname	= "default",
101e55d912fSArnaldo Carvalho de Melo 		.mode		= 0555,
102e55d912fSArnaldo Carvalho de Melo 		.child		= dccp_default_table,
103e55d912fSArnaldo Carvalho de Melo 	},
104e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, },
105e55d912fSArnaldo Carvalho de Melo };
106e55d912fSArnaldo Carvalho de Melo 
107e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_dir_table[] = {
108e55d912fSArnaldo Carvalho de Melo 	{
109e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP,
110e55d912fSArnaldo Carvalho de Melo 		.procname	= "dccp",
111e55d912fSArnaldo Carvalho de Melo 		.mode		= 0555,
112e55d912fSArnaldo Carvalho de Melo 		.child		= dccp_table,
113e55d912fSArnaldo Carvalho de Melo 	},
114e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, },
115e55d912fSArnaldo Carvalho de Melo };
116e55d912fSArnaldo Carvalho de Melo 
117e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_root_table[] = {
118e55d912fSArnaldo Carvalho de Melo 	{
119e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= CTL_NET,
120e55d912fSArnaldo Carvalho de Melo 		.procname	= "net",
121e55d912fSArnaldo Carvalho de Melo 		.mode		= 0555,
122e55d912fSArnaldo Carvalho de Melo 		.child		= dccp_dir_table,
123e55d912fSArnaldo Carvalho de Melo 	},
124e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, },
125e55d912fSArnaldo Carvalho de Melo };
126e55d912fSArnaldo Carvalho de Melo 
127e55d912fSArnaldo Carvalho de Melo static struct ctl_table_header *dccp_table_header;
128e55d912fSArnaldo Carvalho de Melo 
129e55d912fSArnaldo Carvalho de Melo int __init dccp_sysctl_init(void)
130e55d912fSArnaldo Carvalho de Melo {
131e55d912fSArnaldo Carvalho de Melo 	dccp_table_header = register_sysctl_table(dccp_root_table, 1);
132e55d912fSArnaldo Carvalho de Melo 
133e55d912fSArnaldo Carvalho de Melo 	return dccp_table_header != NULL ? 0 : -ENOMEM;
134e55d912fSArnaldo Carvalho de Melo }
135e55d912fSArnaldo Carvalho de Melo 
136e55d912fSArnaldo Carvalho de Melo void dccp_sysctl_exit(void)
137e55d912fSArnaldo Carvalho de Melo {
138e55d912fSArnaldo Carvalho de Melo 	if (dccp_table_header != NULL) {
139e55d912fSArnaldo Carvalho de Melo 		unregister_sysctl_table(dccp_table_header);
140e55d912fSArnaldo Carvalho de Melo 		dccp_table_header = NULL;
141e55d912fSArnaldo Carvalho de Melo 	}
142e55d912fSArnaldo Carvalho de Melo }
143