Commit | Line | Data |
---|---|---|
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 | ||
17 | static struct ctl_table_header *rxrpc_sysctl_reg_table; | |
18 | static const unsigned zero = 0; | |
19 | static const unsigned one = 1; | |
20 | ||
21 | /* | |
22 | * RxRPC operating parameters. | |
23 | * | |
24 | * See Documentation/networking/rxrpc.txt and the variable definitions for more | |
25 | * information on the individual parameters. | |
26 | */ | |
27 | static struct ctl_table rxrpc_sysctl_table[] = { | |
28 | /* Values measured in milliseconds */ | |
29 | { | |
30 | .procname = "req_ack_delay", | |
31 | .data = &rxrpc_requested_ack_delay, | |
32 | .maxlen = sizeof(unsigned), | |
33 | .mode = 0644, | |
34 | .proc_handler = proc_dointvec_ms_jiffies, | |
35 | .extra1 = (void *)&zero, | |
36 | }, | |
37 | { | |
38 | .procname = "soft_ack_delay", | |
39 | .data = &rxrpc_soft_ack_delay, | |
40 | .maxlen = sizeof(unsigned), | |
41 | .mode = 0644, | |
42 | .proc_handler = proc_dointvec_ms_jiffies, | |
43 | .extra1 = (void *)&one, | |
44 | }, | |
45 | { | |
46 | .procname = "idle_ack_delay", | |
47 | .data = &rxrpc_idle_ack_delay, | |
48 | .maxlen = sizeof(unsigned), | |
49 | .mode = 0644, | |
50 | .proc_handler = proc_dointvec_ms_jiffies, | |
51 | .extra1 = (void *)&one, | |
52 | }, | |
53 | { | |
54 | .procname = "resend_timeout", | |
55 | .data = &rxrpc_resend_timeout, | |
56 | .maxlen = sizeof(unsigned), | |
57 | .mode = 0644, | |
58 | .proc_handler = proc_dointvec_ms_jiffies, | |
59 | .extra1 = (void *)&one, | |
60 | }, | |
61 | ||
62 | /* Values measured in seconds but used in jiffies */ | |
63 | { | |
64 | .procname = "max_call_lifetime", | |
65 | .data = &rxrpc_max_call_lifetime, | |
66 | .maxlen = sizeof(unsigned), | |
67 | .mode = 0644, | |
68 | .proc_handler = proc_dointvec_jiffies, | |
69 | .extra1 = (void *)&one, | |
70 | }, | |
71 | { | |
72 | .procname = "dead_call_expiry", | |
73 | .data = &rxrpc_dead_call_expiry, | |
74 | .maxlen = sizeof(unsigned), | |
75 | .mode = 0644, | |
76 | .proc_handler = proc_dointvec_jiffies, | |
77 | .extra1 = (void *)&one, | |
78 | }, | |
79 | ||
80 | /* Values measured in seconds */ | |
81 | { | |
82 | .procname = "connection_expiry", | |
83 | .data = &rxrpc_connection_expiry, | |
84 | .maxlen = sizeof(unsigned), | |
85 | .mode = 0644, | |
86 | .proc_handler = proc_dointvec_minmax, | |
87 | .extra1 = (void *)&one, | |
88 | }, | |
89 | { | |
90 | .procname = "transport_expiry", | |
91 | .data = &rxrpc_transport_expiry, | |
92 | .maxlen = sizeof(unsigned), | |
93 | .mode = 0644, | |
94 | .proc_handler = proc_dointvec_minmax, | |
95 | .extra1 = (void *)&one, | |
96 | }, | |
97 | { } | |
98 | }; | |
99 | ||
100 | int __init rxrpc_sysctl_init(void) | |
101 | { | |
102 | rxrpc_sysctl_reg_table = register_net_sysctl(&init_net, "net/rxrpc", | |
103 | rxrpc_sysctl_table); | |
104 | if (!rxrpc_sysctl_reg_table) | |
105 | return -ENOMEM; | |
106 | return 0; | |
107 | } | |
108 | ||
109 | void rxrpc_sysctl_exit(void) | |
110 | { | |
111 | if (rxrpc_sysctl_reg_table) | |
112 | unregister_net_sysctl_table(rxrpc_sysctl_reg_table); | |
113 | } |