xref: /linux/net/dccp/sysctl.c (revision b5ccd792fa413f9336273cb8fa3b9dd3a7ec1735)
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 		.procname	= "seq_window",
24afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_sequence_window,
25afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_sequence_window),
26e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
27e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
28e55d912fSArnaldo Carvalho de Melo 	},
29e55d912fSArnaldo Carvalho de Melo 	{
30e55d912fSArnaldo Carvalho de Melo 		.procname	= "rx_ccid",
31afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_rx_ccid,
32afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_rx_ccid),
33e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
34e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
35e55d912fSArnaldo Carvalho de Melo 	},
36e55d912fSArnaldo Carvalho de Melo 	{
37e55d912fSArnaldo Carvalho de Melo 		.procname	= "tx_ccid",
38afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_tx_ccid,
39afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_tx_ccid),
40e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
41e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
42e55d912fSArnaldo Carvalho de Melo 	},
43e55d912fSArnaldo Carvalho de Melo 	{
44e55d912fSArnaldo Carvalho de Melo 		.procname	= "ack_ratio",
45afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_ack_ratio,
46afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_ack_ratio),
47e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
48e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
49e55d912fSArnaldo Carvalho de Melo 	},
50e55d912fSArnaldo Carvalho de Melo 	{
51e55d912fSArnaldo Carvalho de Melo 		.procname	= "send_ackvec",
52afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_send_ack_vector,
53afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_send_ack_vector),
54e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
55e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
56e55d912fSArnaldo Carvalho de Melo 	},
57e55d912fSArnaldo Carvalho de Melo 	{
58e55d912fSArnaldo Carvalho de Melo 		.procname	= "send_ndp",
59afb0a34dSGerrit Renker 		.data		= &sysctl_dccp_feat_send_ndp_count,
60afb0a34dSGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_feat_send_ndp_count),
61e55d912fSArnaldo Carvalho de Melo 		.mode		= 0644,
62e55d912fSArnaldo Carvalho de Melo 		.proc_handler	= proc_dointvec,
63e55d912fSArnaldo Carvalho de Melo 	},
642e2e9e92SGerrit Renker 	{
652e2e9e92SGerrit Renker 		.procname	= "request_retries",
662e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_request_retries,
672e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_request_retries),
682e2e9e92SGerrit Renker 		.mode		= 0644,
692e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
702e2e9e92SGerrit Renker 	},
712e2e9e92SGerrit Renker 	{
722e2e9e92SGerrit Renker 		.procname	= "retries1",
732e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries1,
742e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries1),
752e2e9e92SGerrit Renker 		.mode		= 0644,
762e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
772e2e9e92SGerrit Renker 	},
782e2e9e92SGerrit Renker 	{
792e2e9e92SGerrit Renker 		.procname	= "retries2",
802e2e9e92SGerrit Renker 		.data		= &sysctl_dccp_retries2,
812e2e9e92SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_retries2),
822e2e9e92SGerrit Renker 		.mode		= 0644,
832e2e9e92SGerrit Renker 		.proc_handler	= proc_dointvec,
842e2e9e92SGerrit Renker 	},
8582e3ab9dSIan McDonald 	{
8682e3ab9dSIan McDonald 		.procname	= "tx_qlen",
8782e3ab9dSIan McDonald 		.data		= &sysctl_dccp_tx_qlen,
8882e3ab9dSIan McDonald 		.maxlen		= sizeof(sysctl_dccp_tx_qlen),
8982e3ab9dSIan McDonald 		.mode		= 0644,
9082e3ab9dSIan McDonald 		.proc_handler	= proc_dointvec,
9182e3ab9dSIan McDonald 	},
92a94f0f97SGerrit Renker 	{
93a94f0f97SGerrit Renker 		.procname	= "sync_ratelimit",
94a94f0f97SGerrit Renker 		.data		= &sysctl_dccp_sync_ratelimit,
95a94f0f97SGerrit Renker 		.maxlen		= sizeof(sysctl_dccp_sync_ratelimit),
96a94f0f97SGerrit Renker 		.mode		= 0644,
97a94f0f97SGerrit Renker 		.proc_handler	= proc_dointvec_ms_jiffies,
98a94f0f97SGerrit Renker 	},
9982e3ab9dSIan McDonald 
100e55d912fSArnaldo Carvalho de Melo 	{ .ctl_name = 0, }
101e55d912fSArnaldo Carvalho de Melo };
102e55d912fSArnaldo Carvalho de Melo 
103*b5ccd792SPavel Emelyanov static struct ctl_path dccp_path[] = {
104*b5ccd792SPavel Emelyanov 	{ .procname = "net", .ctl_name = CTL_NET, },
105*b5ccd792SPavel Emelyanov 	{ .procname = "dccp", .ctl_name = NET_DCCP, },
106*b5ccd792SPavel Emelyanov 	{ .procname = "default", .ctl_name = NET_DCCP_DEFAULT, },
107*b5ccd792SPavel Emelyanov 	{ }
108e55d912fSArnaldo Carvalho de Melo };
109e55d912fSArnaldo Carvalho de Melo 
110e55d912fSArnaldo Carvalho de Melo static struct ctl_table_header *dccp_table_header;
111e55d912fSArnaldo Carvalho de Melo 
112e55d912fSArnaldo Carvalho de Melo int __init dccp_sysctl_init(void)
113e55d912fSArnaldo Carvalho de Melo {
114*b5ccd792SPavel Emelyanov 	dccp_table_header = register_sysctl_paths(dccp_path,
115*b5ccd792SPavel Emelyanov 			dccp_default_table);
116e55d912fSArnaldo Carvalho de Melo 
117e55d912fSArnaldo Carvalho de Melo 	return dccp_table_header != NULL ? 0 : -ENOMEM;
118e55d912fSArnaldo Carvalho de Melo }
119e55d912fSArnaldo Carvalho de Melo 
120e55d912fSArnaldo Carvalho de Melo void dccp_sysctl_exit(void)
121e55d912fSArnaldo Carvalho de Melo {
122e55d912fSArnaldo Carvalho de Melo 	if (dccp_table_header != NULL) {
123e55d912fSArnaldo Carvalho de Melo 		unregister_sysctl_table(dccp_table_header);
124e55d912fSArnaldo Carvalho de Melo 		dccp_table_header = NULL;
125e55d912fSArnaldo Carvalho de Melo 	}
126e55d912fSArnaldo Carvalho de Melo }
127