.. | .. |
---|
36 | 36 | |
---|
37 | 37 | int mlx5_core_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn) |
---|
38 | 38 | { |
---|
39 | | - u32 in[MLX5_ST_SZ_DW(alloc_transport_domain_in)] = {0}; |
---|
40 | | - u32 out[MLX5_ST_SZ_DW(alloc_transport_domain_out)] = {0}; |
---|
| 39 | + u32 out[MLX5_ST_SZ_DW(alloc_transport_domain_out)] = {}; |
---|
| 40 | + u32 in[MLX5_ST_SZ_DW(alloc_transport_domain_in)] = {}; |
---|
41 | 41 | int err; |
---|
42 | 42 | |
---|
43 | 43 | MLX5_SET(alloc_transport_domain_in, in, opcode, |
---|
44 | 44 | MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN); |
---|
45 | 45 | |
---|
46 | | - err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
| 46 | + err = mlx5_cmd_exec_inout(dev, alloc_transport_domain, in, out); |
---|
47 | 47 | if (!err) |
---|
48 | 48 | *tdn = MLX5_GET(alloc_transport_domain_out, out, |
---|
49 | 49 | transport_domain); |
---|
.. | .. |
---|
54 | 54 | |
---|
55 | 55 | void mlx5_core_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn) |
---|
56 | 56 | { |
---|
57 | | - u32 in[MLX5_ST_SZ_DW(dealloc_transport_domain_in)] = {0}; |
---|
58 | | - u32 out[MLX5_ST_SZ_DW(dealloc_transport_domain_out)] = {0}; |
---|
| 57 | + u32 in[MLX5_ST_SZ_DW(dealloc_transport_domain_in)] = {}; |
---|
59 | 58 | |
---|
60 | 59 | MLX5_SET(dealloc_transport_domain_in, in, opcode, |
---|
61 | 60 | MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN); |
---|
62 | 61 | MLX5_SET(dealloc_transport_domain_in, in, transport_domain, tdn); |
---|
63 | | - mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
| 62 | + mlx5_cmd_exec_in(dev, dealloc_transport_domain, in); |
---|
64 | 63 | } |
---|
65 | 64 | EXPORT_SYMBOL(mlx5_core_dealloc_transport_domain); |
---|
66 | 65 | |
---|
67 | 66 | int mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *rqn) |
---|
68 | 67 | { |
---|
69 | | - u32 out[MLX5_ST_SZ_DW(create_rq_out)] = {0}; |
---|
| 68 | + u32 out[MLX5_ST_SZ_DW(create_rq_out)] = {}; |
---|
70 | 69 | int err; |
---|
71 | 70 | |
---|
72 | 71 | MLX5_SET(create_rq_in, in, opcode, MLX5_CMD_OP_CREATE_RQ); |
---|
.. | .. |
---|
78 | 77 | } |
---|
79 | 78 | EXPORT_SYMBOL(mlx5_core_create_rq); |
---|
80 | 79 | |
---|
81 | | -int mlx5_core_modify_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *in, int inlen) |
---|
| 80 | +int mlx5_core_modify_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *in) |
---|
82 | 81 | { |
---|
83 | | - u32 out[MLX5_ST_SZ_DW(modify_rq_out)]; |
---|
84 | | - |
---|
85 | 82 | MLX5_SET(modify_rq_in, in, rqn, rqn); |
---|
86 | 83 | MLX5_SET(modify_rq_in, in, opcode, MLX5_CMD_OP_MODIFY_RQ); |
---|
87 | 84 | |
---|
88 | | - memset(out, 0, sizeof(out)); |
---|
89 | | - return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
| 85 | + return mlx5_cmd_exec_in(dev, modify_rq, in); |
---|
90 | 86 | } |
---|
91 | 87 | EXPORT_SYMBOL(mlx5_core_modify_rq); |
---|
92 | 88 | |
---|
93 | 89 | void mlx5_core_destroy_rq(struct mlx5_core_dev *dev, u32 rqn) |
---|
94 | 90 | { |
---|
95 | | - u32 in[MLX5_ST_SZ_DW(destroy_rq_in)] = {0}; |
---|
96 | | - u32 out[MLX5_ST_SZ_DW(destroy_rq_out)] = {0}; |
---|
| 91 | + u32 in[MLX5_ST_SZ_DW(destroy_rq_in)] = {}; |
---|
97 | 92 | |
---|
98 | 93 | MLX5_SET(destroy_rq_in, in, opcode, MLX5_CMD_OP_DESTROY_RQ); |
---|
99 | 94 | MLX5_SET(destroy_rq_in, in, rqn, rqn); |
---|
100 | | - mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
| 95 | + mlx5_cmd_exec_in(dev, destroy_rq, in); |
---|
101 | 96 | } |
---|
102 | 97 | EXPORT_SYMBOL(mlx5_core_destroy_rq); |
---|
103 | 98 | |
---|
104 | 99 | int mlx5_core_query_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *out) |
---|
105 | 100 | { |
---|
106 | | - u32 in[MLX5_ST_SZ_DW(query_rq_in)] = {0}; |
---|
107 | | - int outlen = MLX5_ST_SZ_BYTES(query_rq_out); |
---|
| 101 | + u32 in[MLX5_ST_SZ_DW(query_rq_in)] = {}; |
---|
108 | 102 | |
---|
109 | 103 | MLX5_SET(query_rq_in, in, opcode, MLX5_CMD_OP_QUERY_RQ); |
---|
110 | 104 | MLX5_SET(query_rq_in, in, rqn, rqn); |
---|
111 | 105 | |
---|
112 | | - return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); |
---|
| 106 | + return mlx5_cmd_exec_inout(dev, query_rq, in, out); |
---|
113 | 107 | } |
---|
114 | 108 | EXPORT_SYMBOL(mlx5_core_query_rq); |
---|
115 | 109 | |
---|
116 | 110 | int mlx5_core_create_sq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *sqn) |
---|
117 | 111 | { |
---|
118 | | - u32 out[MLX5_ST_SZ_DW(create_sq_out)] = {0}; |
---|
| 112 | + u32 out[MLX5_ST_SZ_DW(create_sq_out)] = {}; |
---|
119 | 113 | int err; |
---|
120 | 114 | |
---|
121 | 115 | MLX5_SET(create_sq_in, in, opcode, MLX5_CMD_OP_CREATE_SQ); |
---|
.. | .. |
---|
126 | 120 | return err; |
---|
127 | 121 | } |
---|
128 | 122 | |
---|
129 | | -int mlx5_core_modify_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *in, int inlen) |
---|
| 123 | +int mlx5_core_modify_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *in) |
---|
130 | 124 | { |
---|
131 | | - u32 out[MLX5_ST_SZ_DW(modify_sq_out)] = {0}; |
---|
132 | | - |
---|
133 | 125 | MLX5_SET(modify_sq_in, in, sqn, sqn); |
---|
134 | 126 | MLX5_SET(modify_sq_in, in, opcode, MLX5_CMD_OP_MODIFY_SQ); |
---|
135 | | - return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
| 127 | + return mlx5_cmd_exec_in(dev, modify_sq, in); |
---|
136 | 128 | } |
---|
137 | 129 | EXPORT_SYMBOL(mlx5_core_modify_sq); |
---|
138 | 130 | |
---|
139 | 131 | void mlx5_core_destroy_sq(struct mlx5_core_dev *dev, u32 sqn) |
---|
140 | 132 | { |
---|
141 | | - u32 in[MLX5_ST_SZ_DW(destroy_sq_in)] = {0}; |
---|
142 | | - u32 out[MLX5_ST_SZ_DW(destroy_sq_out)] = {0}; |
---|
| 133 | + u32 in[MLX5_ST_SZ_DW(destroy_sq_in)] = {}; |
---|
143 | 134 | |
---|
144 | 135 | MLX5_SET(destroy_sq_in, in, opcode, MLX5_CMD_OP_DESTROY_SQ); |
---|
145 | 136 | MLX5_SET(destroy_sq_in, in, sqn, sqn); |
---|
146 | | - mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
| 137 | + mlx5_cmd_exec_in(dev, destroy_sq, in); |
---|
147 | 138 | } |
---|
148 | 139 | |
---|
149 | 140 | int mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out) |
---|
150 | 141 | { |
---|
151 | | - u32 in[MLX5_ST_SZ_DW(query_sq_in)] = {0}; |
---|
152 | | - int outlen = MLX5_ST_SZ_BYTES(query_sq_out); |
---|
| 142 | + u32 in[MLX5_ST_SZ_DW(query_sq_in)] = {}; |
---|
153 | 143 | |
---|
154 | 144 | MLX5_SET(query_sq_in, in, opcode, MLX5_CMD_OP_QUERY_SQ); |
---|
155 | 145 | MLX5_SET(query_sq_in, in, sqn, sqn); |
---|
156 | | - return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); |
---|
| 146 | + return mlx5_cmd_exec_inout(dev, query_sq, in, out); |
---|
157 | 147 | } |
---|
158 | 148 | EXPORT_SYMBOL(mlx5_core_query_sq); |
---|
159 | 149 | |
---|
.. | .. |
---|
182 | 172 | } |
---|
183 | 173 | EXPORT_SYMBOL_GPL(mlx5_core_query_sq_state); |
---|
184 | 174 | |
---|
185 | | -int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen, |
---|
186 | | - u32 *tirn) |
---|
| 175 | +int mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, u32 *tirn) |
---|
187 | 176 | { |
---|
188 | | - u32 out[MLX5_ST_SZ_DW(create_tir_out)] = {0}; |
---|
| 177 | + u32 out[MLX5_ST_SZ_DW(create_tir_out)] = {}; |
---|
189 | 178 | int err; |
---|
190 | 179 | |
---|
191 | 180 | MLX5_SET(create_tir_in, in, opcode, MLX5_CMD_OP_CREATE_TIR); |
---|
192 | | - |
---|
193 | | - memset(out, 0, sizeof(out)); |
---|
194 | | - err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
| 181 | + err = mlx5_cmd_exec_inout(dev, create_tir, in, out); |
---|
195 | 182 | if (!err) |
---|
196 | 183 | *tirn = MLX5_GET(create_tir_out, out, tirn); |
---|
197 | 184 | |
---|
.. | .. |
---|
199 | 186 | } |
---|
200 | 187 | EXPORT_SYMBOL(mlx5_core_create_tir); |
---|
201 | 188 | |
---|
202 | | -int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in, |
---|
203 | | - int inlen) |
---|
| 189 | +int mlx5_core_modify_tir(struct mlx5_core_dev *dev, u32 tirn, u32 *in) |
---|
204 | 190 | { |
---|
205 | | - u32 out[MLX5_ST_SZ_DW(modify_tir_out)] = {0}; |
---|
206 | | - |
---|
207 | 191 | MLX5_SET(modify_tir_in, in, tirn, tirn); |
---|
208 | 192 | MLX5_SET(modify_tir_in, in, opcode, MLX5_CMD_OP_MODIFY_TIR); |
---|
209 | | - return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
| 193 | + return mlx5_cmd_exec_in(dev, modify_tir, in); |
---|
210 | 194 | } |
---|
211 | 195 | |
---|
212 | 196 | void mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn) |
---|
213 | 197 | { |
---|
214 | | - u32 in[MLX5_ST_SZ_DW(destroy_tir_in)] = {0}; |
---|
215 | | - u32 out[MLX5_ST_SZ_DW(destroy_tir_out)] = {0}; |
---|
| 198 | + u32 in[MLX5_ST_SZ_DW(destroy_tir_in)] = {}; |
---|
216 | 199 | |
---|
217 | 200 | MLX5_SET(destroy_tir_in, in, opcode, MLX5_CMD_OP_DESTROY_TIR); |
---|
218 | 201 | MLX5_SET(destroy_tir_in, in, tirn, tirn); |
---|
219 | | - mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
| 202 | + mlx5_cmd_exec_in(dev, destroy_tir, in); |
---|
220 | 203 | } |
---|
221 | 204 | EXPORT_SYMBOL(mlx5_core_destroy_tir); |
---|
222 | 205 | |
---|
223 | | -int mlx5_core_create_tis(struct mlx5_core_dev *dev, u32 *in, int inlen, |
---|
224 | | - u32 *tisn) |
---|
| 206 | +int mlx5_core_create_tis(struct mlx5_core_dev *dev, u32 *in, u32 *tisn) |
---|
225 | 207 | { |
---|
226 | | - u32 out[MLX5_ST_SZ_DW(create_tis_out)] = {0}; |
---|
| 208 | + u32 out[MLX5_ST_SZ_DW(create_tis_out)] = {}; |
---|
227 | 209 | int err; |
---|
228 | 210 | |
---|
229 | 211 | MLX5_SET(create_tis_in, in, opcode, MLX5_CMD_OP_CREATE_TIS); |
---|
230 | | - err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
| 212 | + err = mlx5_cmd_exec_inout(dev, create_tis, in, out); |
---|
231 | 213 | if (!err) |
---|
232 | 214 | *tisn = MLX5_GET(create_tis_out, out, tisn); |
---|
233 | 215 | |
---|
.. | .. |
---|
235 | 217 | } |
---|
236 | 218 | EXPORT_SYMBOL(mlx5_core_create_tis); |
---|
237 | 219 | |
---|
238 | | -int mlx5_core_modify_tis(struct mlx5_core_dev *dev, u32 tisn, u32 *in, |
---|
239 | | - int inlen) |
---|
| 220 | +int mlx5_core_modify_tis(struct mlx5_core_dev *dev, u32 tisn, u32 *in) |
---|
240 | 221 | { |
---|
241 | | - u32 out[MLX5_ST_SZ_DW(modify_tis_out)] = {0}; |
---|
242 | | - |
---|
243 | 222 | MLX5_SET(modify_tis_in, in, tisn, tisn); |
---|
244 | 223 | MLX5_SET(modify_tis_in, in, opcode, MLX5_CMD_OP_MODIFY_TIS); |
---|
245 | 224 | |
---|
246 | | - return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
| 225 | + return mlx5_cmd_exec_in(dev, modify_tis, in); |
---|
247 | 226 | } |
---|
248 | 227 | EXPORT_SYMBOL(mlx5_core_modify_tis); |
---|
249 | 228 | |
---|
250 | 229 | void mlx5_core_destroy_tis(struct mlx5_core_dev *dev, u32 tisn) |
---|
251 | 230 | { |
---|
252 | | - u32 in[MLX5_ST_SZ_DW(destroy_tis_in)] = {0}; |
---|
253 | | - u32 out[MLX5_ST_SZ_DW(destroy_tis_out)] = {0}; |
---|
| 231 | + u32 in[MLX5_ST_SZ_DW(destroy_tis_in)] = {}; |
---|
254 | 232 | |
---|
255 | 233 | MLX5_SET(destroy_tis_in, in, opcode, MLX5_CMD_OP_DESTROY_TIS); |
---|
256 | 234 | MLX5_SET(destroy_tis_in, in, tisn, tisn); |
---|
257 | | - mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
| 235 | + mlx5_cmd_exec_in(dev, destroy_tis, in); |
---|
258 | 236 | } |
---|
259 | 237 | EXPORT_SYMBOL(mlx5_core_destroy_tis); |
---|
260 | | - |
---|
261 | | -int mlx5_core_create_rmp(struct mlx5_core_dev *dev, u32 *in, int inlen, |
---|
262 | | - u32 *rmpn) |
---|
263 | | -{ |
---|
264 | | - u32 out[MLX5_ST_SZ_DW(create_rmp_out)] = {0}; |
---|
265 | | - int err; |
---|
266 | | - |
---|
267 | | - MLX5_SET(create_rmp_in, in, opcode, MLX5_CMD_OP_CREATE_RMP); |
---|
268 | | - err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
269 | | - if (!err) |
---|
270 | | - *rmpn = MLX5_GET(create_rmp_out, out, rmpn); |
---|
271 | | - |
---|
272 | | - return err; |
---|
273 | | -} |
---|
274 | | - |
---|
275 | | -int mlx5_core_modify_rmp(struct mlx5_core_dev *dev, u32 *in, int inlen) |
---|
276 | | -{ |
---|
277 | | - u32 out[MLX5_ST_SZ_DW(modify_rmp_out)] = {0}; |
---|
278 | | - |
---|
279 | | - MLX5_SET(modify_rmp_in, in, opcode, MLX5_CMD_OP_MODIFY_RMP); |
---|
280 | | - return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
281 | | -} |
---|
282 | | - |
---|
283 | | -int mlx5_core_destroy_rmp(struct mlx5_core_dev *dev, u32 rmpn) |
---|
284 | | -{ |
---|
285 | | - u32 in[MLX5_ST_SZ_DW(destroy_rmp_in)] = {0}; |
---|
286 | | - u32 out[MLX5_ST_SZ_DW(destroy_rmp_out)] = {0}; |
---|
287 | | - |
---|
288 | | - MLX5_SET(destroy_rmp_in, in, opcode, MLX5_CMD_OP_DESTROY_RMP); |
---|
289 | | - MLX5_SET(destroy_rmp_in, in, rmpn, rmpn); |
---|
290 | | - return mlx5_cmd_exec(dev, in, sizeof(in), out, |
---|
291 | | - sizeof(out)); |
---|
292 | | -} |
---|
293 | | - |
---|
294 | | -int mlx5_core_query_rmp(struct mlx5_core_dev *dev, u32 rmpn, u32 *out) |
---|
295 | | -{ |
---|
296 | | - u32 in[MLX5_ST_SZ_DW(query_rmp_in)] = {0}; |
---|
297 | | - int outlen = MLX5_ST_SZ_BYTES(query_rmp_out); |
---|
298 | | - |
---|
299 | | - MLX5_SET(query_rmp_in, in, opcode, MLX5_CMD_OP_QUERY_RMP); |
---|
300 | | - MLX5_SET(query_rmp_in, in, rmpn, rmpn); |
---|
301 | | - return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); |
---|
302 | | -} |
---|
303 | | - |
---|
304 | | -int mlx5_core_arm_rmp(struct mlx5_core_dev *dev, u32 rmpn, u16 lwm) |
---|
305 | | -{ |
---|
306 | | - void *in; |
---|
307 | | - void *rmpc; |
---|
308 | | - void *wq; |
---|
309 | | - void *bitmask; |
---|
310 | | - int err; |
---|
311 | | - |
---|
312 | | - in = kvzalloc(MLX5_ST_SZ_BYTES(modify_rmp_in), GFP_KERNEL); |
---|
313 | | - if (!in) |
---|
314 | | - return -ENOMEM; |
---|
315 | | - |
---|
316 | | - rmpc = MLX5_ADDR_OF(modify_rmp_in, in, ctx); |
---|
317 | | - bitmask = MLX5_ADDR_OF(modify_rmp_in, in, bitmask); |
---|
318 | | - wq = MLX5_ADDR_OF(rmpc, rmpc, wq); |
---|
319 | | - |
---|
320 | | - MLX5_SET(modify_rmp_in, in, rmp_state, MLX5_RMPC_STATE_RDY); |
---|
321 | | - MLX5_SET(modify_rmp_in, in, rmpn, rmpn); |
---|
322 | | - MLX5_SET(wq, wq, lwm, lwm); |
---|
323 | | - MLX5_SET(rmp_bitmask, bitmask, lwm, 1); |
---|
324 | | - MLX5_SET(rmpc, rmpc, state, MLX5_RMPC_STATE_RDY); |
---|
325 | | - |
---|
326 | | - err = mlx5_core_modify_rmp(dev, in, MLX5_ST_SZ_BYTES(modify_rmp_in)); |
---|
327 | | - |
---|
328 | | - kvfree(in); |
---|
329 | | - |
---|
330 | | - return err; |
---|
331 | | -} |
---|
332 | | - |
---|
333 | | -int mlx5_core_create_xsrq(struct mlx5_core_dev *dev, u32 *in, int inlen, |
---|
334 | | - u32 *xsrqn) |
---|
335 | | -{ |
---|
336 | | - u32 out[MLX5_ST_SZ_DW(create_xrc_srq_out)] = {0}; |
---|
337 | | - int err; |
---|
338 | | - |
---|
339 | | - MLX5_SET(create_xrc_srq_in, in, opcode, MLX5_CMD_OP_CREATE_XRC_SRQ); |
---|
340 | | - err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
---|
341 | | - if (!err) |
---|
342 | | - *xsrqn = MLX5_GET(create_xrc_srq_out, out, xrc_srqn); |
---|
343 | | - |
---|
344 | | - return err; |
---|
345 | | -} |
---|
346 | | - |
---|
347 | | -int mlx5_core_destroy_xsrq(struct mlx5_core_dev *dev, u32 xsrqn) |
---|
348 | | -{ |
---|
349 | | - u32 in[MLX5_ST_SZ_DW(destroy_xrc_srq_in)] = {0}; |
---|
350 | | - u32 out[MLX5_ST_SZ_DW(destroy_xrc_srq_out)] = {0}; |
---|
351 | | - |
---|
352 | | - MLX5_SET(destroy_xrc_srq_in, in, opcode, MLX5_CMD_OP_DESTROY_XRC_SRQ); |
---|
353 | | - MLX5_SET(destroy_xrc_srq_in, in, xrc_srqn, xsrqn); |
---|
354 | | - return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
355 | | -} |
---|
356 | | - |
---|
357 | | -int mlx5_core_arm_xsrq(struct mlx5_core_dev *dev, u32 xsrqn, u16 lwm) |
---|
358 | | -{ |
---|
359 | | - u32 in[MLX5_ST_SZ_DW(arm_xrc_srq_in)] = {0}; |
---|
360 | | - u32 out[MLX5_ST_SZ_DW(arm_xrc_srq_out)] = {0}; |
---|
361 | | - |
---|
362 | | - MLX5_SET(arm_xrc_srq_in, in, opcode, MLX5_CMD_OP_ARM_XRC_SRQ); |
---|
363 | | - MLX5_SET(arm_xrc_srq_in, in, xrc_srqn, xsrqn); |
---|
364 | | - MLX5_SET(arm_xrc_srq_in, in, lwm, lwm); |
---|
365 | | - MLX5_SET(arm_xrc_srq_in, in, op_mod, |
---|
366 | | - MLX5_ARM_XRC_SRQ_IN_OP_MOD_XRC_SRQ); |
---|
367 | | - return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
368 | | -} |
---|
369 | 238 | |
---|
370 | 239 | int mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen, |
---|
371 | 240 | u32 *rqtn) |
---|
372 | 241 | { |
---|
373 | | - u32 out[MLX5_ST_SZ_DW(create_rqt_out)] = {0}; |
---|
| 242 | + u32 out[MLX5_ST_SZ_DW(create_rqt_out)] = {}; |
---|
374 | 243 | int err; |
---|
375 | 244 | |
---|
376 | 245 | MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT); |
---|
.. | .. |
---|
385 | 254 | int mlx5_core_modify_rqt(struct mlx5_core_dev *dev, u32 rqtn, u32 *in, |
---|
386 | 255 | int inlen) |
---|
387 | 256 | { |
---|
388 | | - u32 out[MLX5_ST_SZ_DW(modify_rqt_out)] = {0}; |
---|
| 257 | + u32 out[MLX5_ST_SZ_DW(modify_rqt_out)] = {}; |
---|
389 | 258 | |
---|
390 | 259 | MLX5_SET(modify_rqt_in, in, rqtn, rqtn); |
---|
391 | 260 | MLX5_SET(modify_rqt_in, in, opcode, MLX5_CMD_OP_MODIFY_RQT); |
---|
.. | .. |
---|
394 | 263 | |
---|
395 | 264 | void mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn) |
---|
396 | 265 | { |
---|
397 | | - u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)] = {0}; |
---|
398 | | - u32 out[MLX5_ST_SZ_DW(destroy_rqt_out)] = {0}; |
---|
| 266 | + u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)] = {}; |
---|
399 | 267 | |
---|
400 | 268 | MLX5_SET(destroy_rqt_in, in, opcode, MLX5_CMD_OP_DESTROY_RQT); |
---|
401 | 269 | MLX5_SET(destroy_rqt_in, in, rqtn, rqtn); |
---|
402 | | - mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); |
---|
| 270 | + mlx5_cmd_exec_in(dev, destroy_rqt, in); |
---|
403 | 271 | } |
---|
404 | 272 | EXPORT_SYMBOL(mlx5_core_destroy_rqt); |
---|
405 | 273 | |
---|
.. | .. |
---|
484 | 352 | int curr_state, int next_state, |
---|
485 | 353 | u16 peer_vhca, u32 peer_sq) |
---|
486 | 354 | { |
---|
487 | | - u32 in[MLX5_ST_SZ_DW(modify_rq_in)] = {0}; |
---|
| 355 | + u32 in[MLX5_ST_SZ_DW(modify_rq_in)] = {}; |
---|
488 | 356 | void *rqc; |
---|
489 | 357 | |
---|
490 | 358 | rqc = MLX5_ADDR_OF(modify_rq_in, in, ctx); |
---|
.. | .. |
---|
497 | 365 | MLX5_SET(modify_rq_in, in, rq_state, curr_state); |
---|
498 | 366 | MLX5_SET(rqc, rqc, state, next_state); |
---|
499 | 367 | |
---|
500 | | - return mlx5_core_modify_rq(func_mdev, rqn, |
---|
501 | | - in, MLX5_ST_SZ_BYTES(modify_rq_in)); |
---|
| 368 | + return mlx5_core_modify_rq(func_mdev, rqn, in); |
---|
502 | 369 | } |
---|
503 | 370 | |
---|
504 | 371 | static int mlx5_hairpin_modify_sq(struct mlx5_core_dev *peer_mdev, u32 sqn, |
---|
.. | .. |
---|
518 | 385 | MLX5_SET(modify_sq_in, in, sq_state, curr_state); |
---|
519 | 386 | MLX5_SET(sqc, sqc, state, next_state); |
---|
520 | 387 | |
---|
521 | | - return mlx5_core_modify_sq(peer_mdev, sqn, |
---|
522 | | - in, MLX5_ST_SZ_BYTES(modify_sq_in)); |
---|
| 388 | + return mlx5_core_modify_sq(peer_mdev, sqn, in); |
---|
523 | 389 | } |
---|
524 | 390 | |
---|
525 | 391 | static int mlx5_hairpin_pair_queues(struct mlx5_hairpin *hp) |
---|
.. | .. |
---|
558 | 424 | return err; |
---|
559 | 425 | } |
---|
560 | 426 | |
---|
| 427 | +static void mlx5_hairpin_unpair_peer_sq(struct mlx5_hairpin *hp) |
---|
| 428 | +{ |
---|
| 429 | + int i; |
---|
| 430 | + |
---|
| 431 | + for (i = 0; i < hp->num_channels; i++) |
---|
| 432 | + mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY, |
---|
| 433 | + MLX5_SQC_STATE_RST, 0, 0); |
---|
| 434 | +} |
---|
| 435 | + |
---|
561 | 436 | static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp) |
---|
562 | 437 | { |
---|
563 | 438 | int i; |
---|
.. | .. |
---|
566 | 441 | for (i = 0; i < hp->num_channels; i++) |
---|
567 | 442 | mlx5_hairpin_modify_rq(hp->func_mdev, hp->rqn[i], MLX5_RQC_STATE_RDY, |
---|
568 | 443 | MLX5_RQC_STATE_RST, 0, 0); |
---|
569 | | - |
---|
570 | 444 | /* unset peer SQs */ |
---|
571 | | - if (hp->peer_gone) |
---|
572 | | - return; |
---|
573 | | - for (i = 0; i < hp->num_channels; i++) |
---|
574 | | - mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY, |
---|
575 | | - MLX5_SQC_STATE_RST, 0, 0); |
---|
| 445 | + if (!hp->peer_gone) |
---|
| 446 | + mlx5_hairpin_unpair_peer_sq(hp); |
---|
576 | 447 | } |
---|
577 | 448 | |
---|
578 | 449 | struct mlx5_hairpin * |
---|
.. | .. |
---|
619 | 490 | mlx5_hairpin_destroy_queues(hp); |
---|
620 | 491 | kfree(hp); |
---|
621 | 492 | } |
---|
| 493 | + |
---|
| 494 | +void mlx5_core_hairpin_clear_dead_peer(struct mlx5_hairpin *hp) |
---|
| 495 | +{ |
---|
| 496 | + int i; |
---|
| 497 | + |
---|
| 498 | + mlx5_hairpin_unpair_peer_sq(hp); |
---|
| 499 | + |
---|
| 500 | + /* destroy peer SQ */ |
---|
| 501 | + for (i = 0; i < hp->num_channels; i++) |
---|
| 502 | + mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]); |
---|
| 503 | + |
---|
| 504 | + hp->peer_gone = true; |
---|
| 505 | +} |
---|