Merge tag 'devdax-for-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm...
[linux-2.6-block.git] / net / rxrpc / sysctl.c
CommitLineData
5873c083
DH
1/* sysctls for configuring RxRPC operating parameters
2 *
3 * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#include <linux/sysctl.h>
13#include <net/sock.h>
14#include <net/af_rxrpc.h>
15#include "ar-internal.h"
16
17static struct ctl_table_header *rxrpc_sysctl_reg_table;
dad8aff7
DH
18static const unsigned int one = 1;
19static const unsigned int four = 4;
0e119b41 20static const unsigned int thirtytwo = 32;
dad8aff7 21static const unsigned int n_65535 = 65535;
75e42126 22static const unsigned int n_max_acks = RXRPC_RXTX_BUFF_SIZE - 1;
a158bdd3
DH
23static const unsigned long one_jiffy = 1;
24static const unsigned long max_jiffies = MAX_JIFFY_OFFSET;
5873c083
DH
25
26/*
27 * RxRPC operating parameters.
28 *
29 * See Documentation/networking/rxrpc.txt and the variable definitions for more
30 * information on the individual parameters.
31 */
32static struct ctl_table rxrpc_sysctl_table[] = {
a158bdd3 33 /* Values measured in milliseconds but used in jiffies */
5873c083
DH
34 {
35 .procname = "req_ack_delay",
36 .data = &rxrpc_requested_ack_delay,
a158bdd3 37 .maxlen = sizeof(unsigned long),
5873c083 38 .mode = 0644,
a158bdd3
DH
39 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
40 .extra1 = (void *)&one_jiffy,
41 .extra2 = (void *)&max_jiffies,
5873c083
DH
42 },
43 {
44 .procname = "soft_ack_delay",
45 .data = &rxrpc_soft_ack_delay,
a158bdd3 46 .maxlen = sizeof(unsigned long),
5873c083 47 .mode = 0644,
a158bdd3
DH
48 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
49 .extra1 = (void *)&one_jiffy,
50 .extra2 = (void *)&max_jiffies,
5873c083
DH
51 },
52 {
53 .procname = "idle_ack_delay",
54 .data = &rxrpc_idle_ack_delay,
a158bdd3 55 .maxlen = sizeof(unsigned long),
5873c083 56 .mode = 0644,
a158bdd3
DH
57 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
58 .extra1 = (void *)&one_jiffy,
59 .extra2 = (void *)&max_jiffies,
5873c083 60 },
45025bce
DH
61 {
62 .procname = "idle_conn_expiry",
63 .data = &rxrpc_conn_idle_client_expiry,
a158bdd3 64 .maxlen = sizeof(unsigned long),
45025bce 65 .mode = 0644,
a158bdd3
DH
66 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
67 .extra1 = (void *)&one_jiffy,
68 .extra2 = (void *)&max_jiffies,
45025bce
DH
69 },
70 {
71 .procname = "idle_conn_fast_expiry",
72 .data = &rxrpc_conn_idle_client_fast_expiry,
a158bdd3 73 .maxlen = sizeof(unsigned long),
45025bce 74 .mode = 0644,
a158bdd3
DH
75 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
76 .extra1 = (void *)&one_jiffy,
77 .extra2 = (void *)&max_jiffies,
45025bce 78 },
5873c083 79 {
a158bdd3
DH
80 .procname = "resend_timeout",
81 .data = &rxrpc_resend_timeout,
82 .maxlen = sizeof(unsigned long),
5873c083 83 .mode = 0644,
a158bdd3
DH
84 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
85 .extra1 = (void *)&one_jiffy,
86 .extra2 = (void *)&max_jiffies,
5873c083 87 },
5873c083 88
45025bce
DH
89 /* Non-time values */
90 {
91 .procname = "max_client_conns",
92 .data = &rxrpc_max_client_connections,
93 .maxlen = sizeof(unsigned int),
94 .mode = 0644,
95 .proc_handler = proc_dointvec_minmax,
96 .extra1 = (void *)&rxrpc_reap_client_connections,
97 },
5873c083 98 {
45025bce
DH
99 .procname = "reap_client_conns",
100 .data = &rxrpc_reap_client_connections,
dad8aff7 101 .maxlen = sizeof(unsigned int),
5873c083
DH
102 .mode = 0644,
103 .proc_handler = proc_dointvec_minmax,
104 .extra1 = (void *)&one,
45025bce 105 .extra2 = (void *)&rxrpc_max_client_connections,
5873c083 106 },
0e119b41
DH
107 {
108 .procname = "max_backlog",
109 .data = &rxrpc_max_backlog,
110 .maxlen = sizeof(unsigned int),
111 .mode = 0644,
112 .proc_handler = proc_dointvec_minmax,
113 .extra1 = (void *)&four,
114 .extra2 = (void *)&thirtytwo,
115 },
817913d8
DH
116 {
117 .procname = "rx_window_size",
118 .data = &rxrpc_rx_window_size,
dad8aff7 119 .maxlen = sizeof(unsigned int),
817913d8
DH
120 .mode = 0644,
121 .proc_handler = proc_dointvec_minmax,
122 .extra1 = (void *)&one,
123 .extra2 = (void *)&n_max_acks,
124 },
125 {
126 .procname = "rx_mtu",
127 .data = &rxrpc_rx_mtu,
dad8aff7 128 .maxlen = sizeof(unsigned int),
817913d8
DH
129 .mode = 0644,
130 .proc_handler = proc_dointvec_minmax,
131 .extra1 = (void *)&one,
ee6fe085 132 .extra2 = (void *)&n_65535,
817913d8
DH
133 },
134 {
135 .procname = "rx_jumbo_max",
136 .data = &rxrpc_rx_jumbo_max,
dad8aff7 137 .maxlen = sizeof(unsigned int),
817913d8
DH
138 .mode = 0644,
139 .proc_handler = proc_dointvec_minmax,
140 .extra1 = (void *)&one,
141 .extra2 = (void *)&four,
142 },
143
5873c083
DH
144 { }
145};
146
147int __init rxrpc_sysctl_init(void)
148{
149 rxrpc_sysctl_reg_table = register_net_sysctl(&init_net, "net/rxrpc",
150 rxrpc_sysctl_table);
151 if (!rxrpc_sysctl_reg_table)
152 return -ENOMEM;
153 return 0;
154}
155
156void rxrpc_sysctl_exit(void)
157{
158 if (rxrpc_sysctl_reg_table)
159 unregister_net_sysctl_table(rxrpc_sysctl_reg_table);
160}