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 "ib.h"
38
39static struct ctl_table_header *rds_ib_sysctl_hdr;
40
41unsigned long rds_ib_sysctl_max_send_wr = RDS_IB_DEFAULT_SEND_WR;
42unsigned long rds_ib_sysctl_max_recv_wr = RDS_IB_DEFAULT_RECV_WR;
43unsigned long rds_ib_sysctl_max_recv_allocation = (128 * 1024 * 1024) / RDS_FRAG_SIZE;
44static unsigned long rds_ib_sysctl_max_wr_min = 1;
45
46static unsigned long rds_ib_sysctl_max_wr_max = (u32)~0;
47
48unsigned long rds_ib_sysctl_max_unsig_wrs = 16;
49static unsigned long rds_ib_sysctl_max_unsig_wr_min = 1;
50static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
51
52
53
54
55
56
57
58
59
60
61
62unsigned int rds_ib_sysctl_flow_control = 0;
63
64static struct ctl_table rds_ib_sysctl_table[] = {
65 {
66 .procname = "max_send_wr",
67 .data = &rds_ib_sysctl_max_send_wr,
68 .maxlen = sizeof(unsigned long),
69 .mode = 0644,
70 .proc_handler = proc_doulongvec_minmax,
71 .extra1 = &rds_ib_sysctl_max_wr_min,
72 .extra2 = &rds_ib_sysctl_max_wr_max,
73 },
74 {
75 .procname = "max_recv_wr",
76 .data = &rds_ib_sysctl_max_recv_wr,
77 .maxlen = sizeof(unsigned long),
78 .mode = 0644,
79 .proc_handler = proc_doulongvec_minmax,
80 .extra1 = &rds_ib_sysctl_max_wr_min,
81 .extra2 = &rds_ib_sysctl_max_wr_max,
82 },
83 {
84 .procname = "max_unsignaled_wr",
85 .data = &rds_ib_sysctl_max_unsig_wrs,
86 .maxlen = sizeof(unsigned long),
87 .mode = 0644,
88 .proc_handler = proc_doulongvec_minmax,
89 .extra1 = &rds_ib_sysctl_max_unsig_wr_min,
90 .extra2 = &rds_ib_sysctl_max_unsig_wr_max,
91 },
92 {
93 .procname = "max_recv_allocation",
94 .data = &rds_ib_sysctl_max_recv_allocation,
95 .maxlen = sizeof(unsigned long),
96 .mode = 0644,
97 .proc_handler = proc_doulongvec_minmax,
98 },
99 {
100 .procname = "flow_control",
101 .data = &rds_ib_sysctl_flow_control,
102 .maxlen = sizeof(rds_ib_sysctl_flow_control),
103 .mode = 0644,
104 .proc_handler = proc_dointvec,
105 },
106 { }
107};
108
109void rds_ib_sysctl_exit(void)
110{
111 if (rds_ib_sysctl_hdr)
112 unregister_net_sysctl_table(rds_ib_sysctl_hdr);
113}
114
115int rds_ib_sysctl_init(void)
116{
117 rds_ib_sysctl_hdr = register_net_sysctl(&init_net, "net/rds/ib", rds_ib_sysctl_table);
118 if (!rds_ib_sysctl_hdr)
119 return -ENOMEM;
120 return 0;
121}
122