xref: /linux/net/dccp/sysctl.c (revision 82e3ab9dbeebd5c8d5402ad1607d22086271a56d)
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>
142e2e9e92SGerrit 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",
25afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_sequence_window,
26afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_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",
33afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_rx_ccid,
34afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_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",
41afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_tx_ccid,
42afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_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",
49afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_ack_ratio,
50afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_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",
57afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_send_ack_vector,
58afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_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",
65afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_send_ndp_count,
66afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_send_ndp_count),
67e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
68e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
69e55d912fSArnaldo Carvalho de Melo 	},
702e2e9e92SGerrit Renker 	{
712e2e9e92SGerrit Renker 		.ctl_name	= NET_DCCP_DEFAULT_REQ_RETRIES,
722e2e9e92SGerrit Renker 		.procname	= "request_retries",
732e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_request_retries,
742e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_request_retries),
752e2e9e92SGerrit Renker 		.mode		= 0644,
762e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
772e2e9e92SGerrit Renker 	},
782e2e9e92SGerrit Renker 	{
792e2e9e92SGerrit Renker 		.ctl_name	= NET_DCCP_DEFAULT_RETRIES1,
802e2e9e92SGerrit Renker 		.procname	= "retries1",
812e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries1,
822e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries1),
832e2e9e92SGerrit Renker 		.mode		= 0644,
842e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
852e2e9e92SGerrit Renker 	},
862e2e9e92SGerrit Renker 	{
872e2e9e92SGerrit Renker 		.ctl_name	= NET_DCCP_DEFAULT_RETRIES2,
882e2e9e92SGerrit Renker 		.procname	= "retries2",
892e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries2,
902e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries2),
912e2e9e92SGerrit Renker 		.mode		= 0644,
922e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
932e2e9e92SGerrit Renker 	},
94*82e3ab9dSIan McDonald 	{
95*82e3ab9dSIan McDonald 		.ctl_name	= NET_DCCP_DEFAULT_TX_QLEN,
96*82e3ab9dSIan McDonald 		.procname	= "tx_qlen",
97*82e3ab9dSIan McDonald 		.data		= &sysctl_dccp_tx_qlen,
98*82e3ab9dSIan McDonald 		.maxlen		= sizeof(sysctl_dccp_tx_qlen),
99*82e3ab9dSIan McDonald 		.mode		= 0644,
100*82e3ab9dSIan McDonald 		.proc_handler	= proc_dointvec,
101*82e3ab9dSIan McDonald 	},
102*82e3ab9dSIan McDonald 
103e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, }
104e55d912fSArnaldo Carvalho de Melo };
105e55d912fSArnaldo Carvalho de Melo 
106e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_table[] = {
107e55d912fSArnaldo Carvalho de Melo 	{
108e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP_DEFAULT,
109e55d912fSArnaldo Carvalho de Melo 		.procname	= "default",
110e55d912fSArnaldo Carvalho de Melo 		.mode		= 0555,
111e55d912fSArnaldo Carvalho de Melo 		.child		= dccp_default_table,
112e55d912fSArnaldo Carvalho de Melo 	},
113e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, },
114e55d912fSArnaldo Carvalho de Melo };
115e55d912fSArnaldo Carvalho de Melo 
116e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_dir_table[] = {
117e55d912fSArnaldo Carvalho de Melo 	{
118e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= NET_DCCP,
119e55d912fSArnaldo Carvalho de Melo 		.procname	= "dccp",
120e55d912fSArnaldo Carvalho de Melo 		.mode		= 0555,
121e55d912fSArnaldo Carvalho de Melo 		.child		= dccp_table,
122e55d912fSArnaldo Carvalho de Melo 	},
123e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, },
124e55d912fSArnaldo Carvalho de Melo };
125e55d912fSArnaldo Carvalho de Melo 
126e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_root_table[] = {
127e55d912fSArnaldo Carvalho de Melo 	{
128e55d912fSArnaldo Carvalho de Melo 		.ctl_name	= CTL_NET,
129e55d912fSArnaldo Carvalho de Melo 		.procname	= "net",
130e55d912fSArnaldo Carvalho de Melo 		.mode		= 0555,
131e55d912fSArnaldo Carvalho de Melo 		.child		= dccp_dir_table,
132e55d912fSArnaldo Carvalho de Melo 	},
133e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, },
134e55d912fSArnaldo Carvalho de Melo };
135e55d912fSArnaldo Carvalho de Melo 
136e55d912fSArnaldo Carvalho de Melo static struct ctl_table_header *dccp_table_header;
137e55d912fSArnaldo Carvalho de Melo 
138e55d912fSArnaldo Carvalho de Melo int __init dccp_sysctl_init(void)
139e55d912fSArnaldo Carvalho de Melo {
140e55d912fSArnaldo Carvalho de Melo 	dccp_table_header = register_sysctl_table(dccp_root_table, 1);
141e55d912fSArnaldo Carvalho de Melo 
142e55d912fSArnaldo Carvalho de Melo 	return dccp_table_header != NULL ? 0 : -ENOMEM;
143e55d912fSArnaldo Carvalho de Melo }
144e55d912fSArnaldo Carvalho de Melo 
145e55d912fSArnaldo Carvalho de Melo void dccp_sysctl_exit(void)
146e55d912fSArnaldo Carvalho de Melo {
147e55d912fSArnaldo Carvalho de Melo 	if (dccp_table_header != NULL) {
148e55d912fSArnaldo Carvalho de Melo 		unregister_sysctl_table(dccp_table_header);
149e55d912fSArnaldo Carvalho de Melo 		dccp_table_header = NULL;
150e55d912fSArnaldo Carvalho de Melo 	}
151e55d912fSArnaldo Carvalho de Melo }
152