1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33#include <linux/kernel.h>
34#include <linux/sysctl.h>
35#include <linux/proc_fs.h>
36
37#include "rds.h"
38
39static struct ctl_table_header *rds_sysctl_reg_table;
40
41static unsigned long rds_sysctl_reconnect_min = 1;
42static unsigned long rds_sysctl_reconnect_max = ~0UL;
43
44unsigned long rds_sysctl_reconnect_min_jiffies;
45unsigned long rds_sysctl_reconnect_max_jiffies = HZ;
46
47unsigned int rds_sysctl_max_unacked_packets = 8;
48unsigned int rds_sysctl_max_unacked_bytes = (16 << 20);
49
50unsigned int rds_sysctl_ping_enable = 1;
51
52static struct ctl_table rds_sysctl_rds_table[] = {
53 {
54 .procname = "reconnect_min_delay_ms",
55 .data = &rds_sysctl_reconnect_min_jiffies,
56 .maxlen = sizeof(unsigned long),
57 .mode = 0644,
58 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
59 .extra1 = &rds_sysctl_reconnect_min,
60 .extra2 = &rds_sysctl_reconnect_max_jiffies,
61 },
62 {
63 .procname = "reconnect_max_delay_ms",
64 .data = &rds_sysctl_reconnect_max_jiffies,
65 .maxlen = sizeof(unsigned long),
66 .mode = 0644,
67 .proc_handler = proc_doulongvec_ms_jiffies_minmax,
68 .extra1 = &rds_sysctl_reconnect_min_jiffies,
69 .extra2 = &rds_sysctl_reconnect_max,
70 },
71 {
72 .procname = "max_unacked_packets",
73 .data = &rds_sysctl_max_unacked_packets,
74 .maxlen = sizeof(int),
75 .mode = 0644,
76 .proc_handler = proc_dointvec,
77 },
78 {
79 .procname = "max_unacked_bytes",
80 .data = &rds_sysctl_max_unacked_bytes,
81 .maxlen = sizeof(int),
82 .mode = 0644,
83 .proc_handler = proc_dointvec,
84 },
85 {
86 .procname = "ping_enable",
87 .data = &rds_sysctl_ping_enable,
88 .maxlen = sizeof(int),
89 .mode = 0644,
90 .proc_handler = proc_dointvec,
91 },
92 { }
93};
94
95void rds_sysctl_exit(void)
96{
97 unregister_net_sysctl_table(rds_sysctl_reg_table);
98}
99
100int rds_sysctl_init(void)
101{
102 rds_sysctl_reconnect_min = msecs_to_jiffies(1);
103 rds_sysctl_reconnect_min_jiffies = rds_sysctl_reconnect_min;
104
105 rds_sysctl_reg_table =
106 register_net_sysctl(&init_net, "net/rds", rds_sysctl_rds_table);
107 if (!rds_sysctl_reg_table)
108 return -ENOMEM;
109 return 0;
110}
111