This source file includes following definitions.
- read_reset_stat
- svc_rdma_cleanup
- svc_rdma_init
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
34
35
36
37
38
39
40
41
42
43
44 #include <linux/slab.h>
45 #include <linux/fs.h>
46 #include <linux/sysctl.h>
47 #include <linux/workqueue.h>
48 #include <linux/sunrpc/clnt.h>
49 #include <linux/sunrpc/sched.h>
50 #include <linux/sunrpc/svc_rdma.h>
51
52 #define RPCDBG_FACILITY RPCDBG_SVCXPRT
53
54
55 unsigned int svcrdma_ord = 16;
56 static unsigned int min_ord = 1;
57 static unsigned int max_ord = 255;
58 unsigned int svcrdma_max_requests = RPCRDMA_MAX_REQUESTS;
59 unsigned int svcrdma_max_bc_requests = RPCRDMA_MAX_BC_REQUESTS;
60 static unsigned int min_max_requests = 4;
61 static unsigned int max_max_requests = 16384;
62 unsigned int svcrdma_max_req_size = RPCRDMA_DEF_INLINE_THRESH;
63 static unsigned int min_max_inline = RPCRDMA_DEF_INLINE_THRESH;
64 static unsigned int max_max_inline = RPCRDMA_MAX_INLINE_THRESH;
65
66 atomic_t rdma_stat_recv;
67 atomic_t rdma_stat_read;
68 atomic_t rdma_stat_write;
69 atomic_t rdma_stat_sq_starve;
70 atomic_t rdma_stat_rq_starve;
71 atomic_t rdma_stat_rq_poll;
72 atomic_t rdma_stat_rq_prod;
73 atomic_t rdma_stat_sq_poll;
74 atomic_t rdma_stat_sq_prod;
75
76
77
78
79
80
81
82 static int read_reset_stat(struct ctl_table *table, int write,
83 void __user *buffer, size_t *lenp,
84 loff_t *ppos)
85 {
86 atomic_t *stat = (atomic_t *)table->data;
87
88 if (!stat)
89 return -EINVAL;
90
91 if (write)
92 atomic_set(stat, 0);
93 else {
94 char str_buf[32];
95 int len = snprintf(str_buf, 32, "%d\n", atomic_read(stat));
96 if (len >= 32)
97 return -EFAULT;
98 len = strlen(str_buf);
99 if (*ppos > len) {
100 *lenp = 0;
101 return 0;
102 }
103 len -= *ppos;
104 if (len > *lenp)
105 len = *lenp;
106 if (len && copy_to_user(buffer, str_buf, len))
107 return -EFAULT;
108 *lenp = len;
109 *ppos += len;
110 }
111 return 0;
112 }
113
114 static struct ctl_table_header *svcrdma_table_header;
115 static struct ctl_table svcrdma_parm_table[] = {
116 {
117 .procname = "max_requests",
118 .data = &svcrdma_max_requests,
119 .maxlen = sizeof(unsigned int),
120 .mode = 0644,
121 .proc_handler = proc_dointvec_minmax,
122 .extra1 = &min_max_requests,
123 .extra2 = &max_max_requests
124 },
125 {
126 .procname = "max_req_size",
127 .data = &svcrdma_max_req_size,
128 .maxlen = sizeof(unsigned int),
129 .mode = 0644,
130 .proc_handler = proc_dointvec_minmax,
131 .extra1 = &min_max_inline,
132 .extra2 = &max_max_inline
133 },
134 {
135 .procname = "max_outbound_read_requests",
136 .data = &svcrdma_ord,
137 .maxlen = sizeof(unsigned int),
138 .mode = 0644,
139 .proc_handler = proc_dointvec_minmax,
140 .extra1 = &min_ord,
141 .extra2 = &max_ord,
142 },
143
144 {
145 .procname = "rdma_stat_read",
146 .data = &rdma_stat_read,
147 .maxlen = sizeof(atomic_t),
148 .mode = 0644,
149 .proc_handler = read_reset_stat,
150 },
151 {
152 .procname = "rdma_stat_recv",
153 .data = &rdma_stat_recv,
154 .maxlen = sizeof(atomic_t),
155 .mode = 0644,
156 .proc_handler = read_reset_stat,
157 },
158 {
159 .procname = "rdma_stat_write",
160 .data = &rdma_stat_write,
161 .maxlen = sizeof(atomic_t),
162 .mode = 0644,
163 .proc_handler = read_reset_stat,
164 },
165 {
166 .procname = "rdma_stat_sq_starve",
167 .data = &rdma_stat_sq_starve,
168 .maxlen = sizeof(atomic_t),
169 .mode = 0644,
170 .proc_handler = read_reset_stat,
171 },
172 {
173 .procname = "rdma_stat_rq_starve",
174 .data = &rdma_stat_rq_starve,
175 .maxlen = sizeof(atomic_t),
176 .mode = 0644,
177 .proc_handler = read_reset_stat,
178 },
179 {
180 .procname = "rdma_stat_rq_poll",
181 .data = &rdma_stat_rq_poll,
182 .maxlen = sizeof(atomic_t),
183 .mode = 0644,
184 .proc_handler = read_reset_stat,
185 },
186 {
187 .procname = "rdma_stat_rq_prod",
188 .data = &rdma_stat_rq_prod,
189 .maxlen = sizeof(atomic_t),
190 .mode = 0644,
191 .proc_handler = read_reset_stat,
192 },
193 {
194 .procname = "rdma_stat_sq_poll",
195 .data = &rdma_stat_sq_poll,
196 .maxlen = sizeof(atomic_t),
197 .mode = 0644,
198 .proc_handler = read_reset_stat,
199 },
200 {
201 .procname = "rdma_stat_sq_prod",
202 .data = &rdma_stat_sq_prod,
203 .maxlen = sizeof(atomic_t),
204 .mode = 0644,
205 .proc_handler = read_reset_stat,
206 },
207 { },
208 };
209
210 static struct ctl_table svcrdma_table[] = {
211 {
212 .procname = "svc_rdma",
213 .mode = 0555,
214 .child = svcrdma_parm_table
215 },
216 { },
217 };
218
219 static struct ctl_table svcrdma_root_table[] = {
220 {
221 .procname = "sunrpc",
222 .mode = 0555,
223 .child = svcrdma_table
224 },
225 { },
226 };
227
228 void svc_rdma_cleanup(void)
229 {
230 dprintk("SVCRDMA Module Removed, deregister RPC RDMA transport\n");
231 if (svcrdma_table_header) {
232 unregister_sysctl_table(svcrdma_table_header);
233 svcrdma_table_header = NULL;
234 }
235 svc_unreg_xprt_class(&svc_rdma_class);
236 }
237
238 int svc_rdma_init(void)
239 {
240 dprintk("SVCRDMA Module Init, register RPC RDMA transport\n");
241 dprintk("\tsvcrdma_ord : %d\n", svcrdma_ord);
242 dprintk("\tmax_requests : %u\n", svcrdma_max_requests);
243 dprintk("\tmax_bc_requests : %u\n", svcrdma_max_bc_requests);
244 dprintk("\tmax_inline : %d\n", svcrdma_max_req_size);
245
246 if (!svcrdma_table_header)
247 svcrdma_table_header =
248 register_sysctl_table(svcrdma_root_table);
249
250
251 svc_reg_xprt_class(&svc_rdma_class);
252 return 0;
253 }