1290650Shselasky/*-
2290650Shselasky * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
3290650Shselasky *
4290650Shselasky * Redistribution and use in source and binary forms, with or without
5290650Shselasky * modification, are permitted provided that the following conditions
6290650Shselasky * are met:
7290650Shselasky * 1. Redistributions of source code must retain the above copyright
8290650Shselasky *    notice, this list of conditions and the following disclaimer.
9290650Shselasky * 2. Redistributions in binary form must reproduce the above copyright
10290650Shselasky *    notice, this list of conditions and the following disclaimer in the
11290650Shselasky *    documentation and/or other materials provided with the distribution.
12290650Shselasky *
13290650Shselasky * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND
14290650Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15290650Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16290650Shselasky * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17290650Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18290650Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19290650Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20290650Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21290650Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22290650Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23290650Shselasky * SUCH DAMAGE.
24290650Shselasky *
25290650Shselasky * $FreeBSD: stable/10/sys/dev/mlx5/mlx5_core/mlx5_transobj.c 306244 2016-09-23 08:28:44Z hselasky $
26290650Shselasky */
27290650Shselasky
28290650Shselasky#include <dev/mlx5/driver.h>
29290650Shselasky
30290650Shselasky#include "mlx5_core.h"
31290650Shselasky#include "transobj.h"
32290650Shselasky
33290650Shselaskyint mlx5_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn)
34290650Shselasky{
35290650Shselasky	u32 in[MLX5_ST_SZ_DW(alloc_transport_domain_in)];
36290650Shselasky	u32 out[MLX5_ST_SZ_DW(alloc_transport_domain_out)];
37290650Shselasky	int err;
38290650Shselasky
39290650Shselasky	memset(in, 0, sizeof(in));
40290650Shselasky	memset(out, 0, sizeof(out));
41290650Shselasky
42290650Shselasky	MLX5_SET(alloc_transport_domain_in, in, opcode,
43290650Shselasky		 MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN);
44290650Shselasky
45290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
46290650Shselasky	if (!err)
47290650Shselasky		*tdn = MLX5_GET(alloc_transport_domain_out, out,
48290650Shselasky				transport_domain);
49290650Shselasky
50290650Shselasky	return err;
51290650Shselasky}
52290650Shselasky
53290650Shselaskyvoid mlx5_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn)
54290650Shselasky{
55290650Shselasky	u32 in[MLX5_ST_SZ_DW(dealloc_transport_domain_in)];
56290650Shselasky	u32 out[MLX5_ST_SZ_DW(dealloc_transport_domain_out)];
57290650Shselasky
58290650Shselasky	memset(in, 0, sizeof(in));
59290650Shselasky	memset(out, 0, sizeof(out));
60290650Shselasky
61290650Shselasky	MLX5_SET(dealloc_transport_domain_in, in, opcode,
62290650Shselasky		 MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN);
63290650Shselasky	MLX5_SET(dealloc_transport_domain_in, in, transport_domain, tdn);
64290650Shselasky
65290650Shselasky	mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
66290650Shselasky}
67290650Shselasky
68290650Shselaskyint mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *rqn)
69290650Shselasky{
70290650Shselasky	u32 out[MLX5_ST_SZ_DW(create_rq_out)];
71290650Shselasky	int err;
72290650Shselasky
73290650Shselasky	MLX5_SET(create_rq_in, in, opcode, MLX5_CMD_OP_CREATE_RQ);
74290650Shselasky
75290650Shselasky	memset(out, 0, sizeof(out));
76290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
77290650Shselasky	if (!err)
78290650Shselasky		*rqn = MLX5_GET(create_rq_out, out, rqn);
79290650Shselasky
80290650Shselasky	return err;
81290650Shselasky}
82290650Shselasky
83290650Shselaskyint mlx5_core_modify_rq(struct mlx5_core_dev *dev, u32 *in, int inlen)
84290650Shselasky{
85290650Shselasky	u32 out[MLX5_ST_SZ_DW(modify_rq_out)];
86290650Shselasky
87290650Shselasky	MLX5_SET(modify_rq_in, in, opcode, MLX5_CMD_OP_MODIFY_RQ);
88290650Shselasky
89290650Shselasky	memset(out, 0, sizeof(out));
90290650Shselasky	return mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
91290650Shselasky}
92290650Shselasky
93290650Shselaskyvoid mlx5_core_destroy_rq(struct mlx5_core_dev *dev, u32 rqn)
94290650Shselasky{
95290650Shselasky	u32 in[MLX5_ST_SZ_DW(destroy_rq_in)];
96290650Shselasky	u32 out[MLX5_ST_SZ_DW(destroy_rq_out)];
97290650Shselasky
98290650Shselasky	memset(in, 0, sizeof(in));
99290650Shselasky
100290650Shselasky	MLX5_SET(destroy_rq_in, in, opcode, MLX5_CMD_OP_DESTROY_RQ);
101290650Shselasky	MLX5_SET(destroy_rq_in, in, rqn, rqn);
102290650Shselasky
103290650Shselasky	mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
104290650Shselasky}
105290650Shselasky
106306244Shselaskyint mlx5_core_query_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *out)
107306244Shselasky{
108306244Shselasky	u32 in[MLX5_ST_SZ_DW(query_rq_in)];
109306244Shselasky	int outlen = MLX5_ST_SZ_BYTES(query_rq_out);
110306244Shselasky
111306244Shselasky	memset(in, 0, sizeof(in));
112306244Shselasky	MLX5_SET(query_rq_in, in, opcode, MLX5_CMD_OP_QUERY_RQ);
113306244Shselasky	MLX5_SET(query_rq_in, in, rqn, rqn);
114306244Shselasky
115306244Shselasky	return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, outlen);
116306244Shselasky}
117306244Shselasky
118290650Shselaskyint mlx5_core_create_sq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *sqn)
119290650Shselasky{
120290650Shselasky	u32 out[MLX5_ST_SZ_DW(create_sq_out)];
121290650Shselasky	int err;
122290650Shselasky
123290650Shselasky	MLX5_SET(create_sq_in, in, opcode, MLX5_CMD_OP_CREATE_SQ);
124290650Shselasky
125290650Shselasky	memset(out, 0, sizeof(out));
126290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
127290650Shselasky	if (!err)
128290650Shselasky		*sqn = MLX5_GET(create_sq_out, out, sqn);
129290650Shselasky
130290650Shselasky	return err;
131290650Shselasky}
132290650Shselasky
133290650Shselaskyint mlx5_core_modify_sq(struct mlx5_core_dev *dev, u32 *in, int inlen)
134290650Shselasky{
135290650Shselasky	u32 out[MLX5_ST_SZ_DW(modify_sq_out)];
136290650Shselasky
137290650Shselasky	MLX5_SET(modify_sq_in, in, opcode, MLX5_CMD_OP_MODIFY_SQ);
138290650Shselasky
139290650Shselasky	memset(out, 0, sizeof(out));
140290650Shselasky	return mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
141290650Shselasky}
142290650Shselasky
143290650Shselaskyvoid mlx5_core_destroy_sq(struct mlx5_core_dev *dev, u32 sqn)
144290650Shselasky{
145290650Shselasky	u32 in[MLX5_ST_SZ_DW(destroy_sq_in)];
146290650Shselasky	u32 out[MLX5_ST_SZ_DW(destroy_sq_out)];
147290650Shselasky
148290650Shselasky	memset(in, 0, sizeof(in));
149290650Shselasky
150290650Shselasky	MLX5_SET(destroy_sq_in, in, opcode, MLX5_CMD_OP_DESTROY_SQ);
151290650Shselasky	MLX5_SET(destroy_sq_in, in, sqn, sqn);
152290650Shselasky
153290650Shselasky	mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
154290650Shselasky}
155290650Shselasky
156306244Shselaskyint mlx5_core_query_sq(struct mlx5_core_dev *dev, u32 sqn, u32 *out)
157306244Shselasky{
158306244Shselasky	u32 in[MLX5_ST_SZ_DW(query_sq_in)];
159306244Shselasky	int outlen = MLX5_ST_SZ_BYTES(query_sq_out);
160306244Shselasky
161306244Shselasky	memset(in, 0, sizeof(in));
162306244Shselasky	MLX5_SET(query_sq_in, in, opcode, MLX5_CMD_OP_QUERY_SQ);
163306244Shselasky	MLX5_SET(query_sq_in, in, sqn, sqn);
164306244Shselasky
165306244Shselasky	return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, outlen);
166306244Shselasky}
167306244Shselasky
168290650Shselaskyint mlx5_core_create_tir(struct mlx5_core_dev *dev, u32 *in, int inlen,
169290650Shselasky			 u32 *tirn)
170290650Shselasky{
171290650Shselasky	u32 out[MLX5_ST_SZ_DW(create_tir_out)];
172290650Shselasky	int err;
173290650Shselasky
174290650Shselasky	MLX5_SET(create_tir_in, in, opcode, MLX5_CMD_OP_CREATE_TIR);
175290650Shselasky
176290650Shselasky	memset(out, 0, sizeof(out));
177290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
178290650Shselasky	if (!err)
179290650Shselasky		*tirn = MLX5_GET(create_tir_out, out, tirn);
180290650Shselasky
181290650Shselasky	return err;
182290650Shselasky}
183290650Shselasky
184290650Shselaskyvoid mlx5_core_destroy_tir(struct mlx5_core_dev *dev, u32 tirn)
185290650Shselasky{
186290650Shselasky	u32 in[MLX5_ST_SZ_DW(destroy_tir_in)];
187290650Shselasky	u32 out[MLX5_ST_SZ_DW(destroy_tir_out)];
188290650Shselasky
189290650Shselasky	memset(in, 0, sizeof(in));
190290650Shselasky
191290650Shselasky	MLX5_SET(destroy_tir_in, in, opcode, MLX5_CMD_OP_DESTROY_TIR);
192290650Shselasky	MLX5_SET(destroy_tir_in, in, tirn, tirn);
193290650Shselasky
194290650Shselasky	mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
195290650Shselasky}
196290650Shselasky
197290650Shselaskyint mlx5_core_create_tis(struct mlx5_core_dev *dev, u32 *in, int inlen,
198290650Shselasky			 u32 *tisn)
199290650Shselasky{
200290650Shselasky	u32 out[MLX5_ST_SZ_DW(create_tis_out)];
201290650Shselasky	int err;
202290650Shselasky
203290650Shselasky	MLX5_SET(create_tis_in, in, opcode, MLX5_CMD_OP_CREATE_TIS);
204290650Shselasky
205290650Shselasky	memset(out, 0, sizeof(out));
206290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
207290650Shselasky	if (!err)
208290650Shselasky		*tisn = MLX5_GET(create_tis_out, out, tisn);
209290650Shselasky
210290650Shselasky	return err;
211290650Shselasky}
212290650Shselasky
213290650Shselaskyvoid mlx5_core_destroy_tis(struct mlx5_core_dev *dev, u32 tisn)
214290650Shselasky{
215290650Shselasky	u32 in[MLX5_ST_SZ_DW(destroy_tis_in)];
216290650Shselasky	u32 out[MLX5_ST_SZ_DW(destroy_tis_out)];
217290650Shselasky
218290650Shselasky	memset(in, 0, sizeof(in));
219290650Shselasky
220290650Shselasky	MLX5_SET(destroy_tis_in, in, opcode, MLX5_CMD_OP_DESTROY_TIS);
221290650Shselasky	MLX5_SET(destroy_tis_in, in, tisn, tisn);
222290650Shselasky
223290650Shselasky	mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
224290650Shselasky}
225290650Shselasky
226290650Shselaskyint mlx5_core_create_rmp(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *rmpn)
227290650Shselasky{
228290650Shselasky	u32 out[MLX5_ST_SZ_DW(create_rmp_out)];
229290650Shselasky	int err;
230290650Shselasky
231290650Shselasky	MLX5_SET(create_rmp_in, in, opcode, MLX5_CMD_OP_CREATE_RMP);
232290650Shselasky
233290650Shselasky	memset(out, 0, sizeof(out));
234290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
235290650Shselasky	if (!err)
236290650Shselasky		*rmpn = MLX5_GET(create_rmp_out, out, rmpn);
237290650Shselasky
238290650Shselasky	return err;
239290650Shselasky}
240290650Shselasky
241290650Shselaskyint mlx5_core_modify_rmp(struct mlx5_core_dev *dev, u32 *in, int inlen)
242290650Shselasky{
243290650Shselasky	u32 out[MLX5_ST_SZ_DW(modify_rmp_out)];
244290650Shselasky
245290650Shselasky	MLX5_SET(modify_rmp_in, in, opcode, MLX5_CMD_OP_MODIFY_RMP);
246290650Shselasky
247290650Shselasky	memset(out, 0, sizeof(out));
248290650Shselasky	return mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
249290650Shselasky}
250290650Shselasky
251290650Shselaskyint mlx5_core_destroy_rmp(struct mlx5_core_dev *dev, u32 rmpn)
252290650Shselasky{
253290650Shselasky	u32 in[MLX5_ST_SZ_DW(destroy_rmp_in)];
254290650Shselasky	u32 out[MLX5_ST_SZ_DW(destroy_rmp_out)];
255290650Shselasky
256290650Shselasky	memset(in, 0, sizeof(in));
257290650Shselasky
258290650Shselasky	MLX5_SET(destroy_rmp_in, in, opcode, MLX5_CMD_OP_DESTROY_RMP);
259290650Shselasky	MLX5_SET(destroy_rmp_in, in, rmpn, rmpn);
260290650Shselasky
261290650Shselasky	return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
262290650Shselasky}
263290650Shselasky
264290650Shselaskyint mlx5_core_query_rmp(struct mlx5_core_dev *dev, u32 rmpn, u32 *out)
265290650Shselasky{
266290650Shselasky	u32 in[MLX5_ST_SZ_DW(query_rmp_in)];
267290650Shselasky	int outlen = MLX5_ST_SZ_BYTES(query_rmp_out);
268290650Shselasky
269290650Shselasky	memset(in, 0, sizeof(in));
270290650Shselasky	MLX5_SET(query_rmp_in, in, opcode, MLX5_CMD_OP_QUERY_RMP);
271290650Shselasky	MLX5_SET(query_rmp_in, in, rmpn,   rmpn);
272290650Shselasky
273290650Shselasky	return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, outlen);
274290650Shselasky}
275290650Shselasky
276290650Shselaskyint mlx5_core_arm_rmp(struct mlx5_core_dev *dev, u32 rmpn, u16 lwm)
277290650Shselasky{
278290650Shselasky	void *in;
279290650Shselasky	void *rmpc;
280290650Shselasky	void *wq;
281290650Shselasky	void *bitmask;
282290650Shselasky	int  err;
283290650Shselasky
284290650Shselasky	in = mlx5_vzalloc(MLX5_ST_SZ_BYTES(modify_rmp_in));
285290650Shselasky	if (!in)
286290650Shselasky		return -ENOMEM;
287290650Shselasky
288290650Shselasky	rmpc    = MLX5_ADDR_OF(modify_rmp_in,   in,   ctx);
289290650Shselasky	bitmask = MLX5_ADDR_OF(modify_rmp_in,   in,   bitmask);
290290650Shselasky	wq      = MLX5_ADDR_OF(rmpc,	        rmpc, wq);
291290650Shselasky
292290650Shselasky	MLX5_SET(modify_rmp_in, in,	 rmp_state, MLX5_RMPC_STATE_RDY);
293290650Shselasky	MLX5_SET(modify_rmp_in, in,	 rmpn,      rmpn);
294290650Shselasky	MLX5_SET(wq,		wq,	 lwm,	    lwm);
295290650Shselasky	MLX5_SET(rmp_bitmask,	bitmask, lwm,	    1);
296290650Shselasky	MLX5_SET(rmpc,		rmpc,	 state,	    MLX5_RMPC_STATE_RDY);
297290650Shselasky
298290650Shselasky	err =  mlx5_core_modify_rmp(dev, in, MLX5_ST_SZ_BYTES(modify_rmp_in));
299290650Shselasky
300290650Shselasky	kvfree(in);
301290650Shselasky
302290650Shselasky	return err;
303290650Shselasky}
304290650Shselasky
305290650Shselaskyint mlx5_core_create_xsrq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 *xsrqn)
306290650Shselasky{
307290650Shselasky	u32 out[MLX5_ST_SZ_DW(create_xrc_srq_out)];
308290650Shselasky	int err;
309290650Shselasky
310290650Shselasky	MLX5_SET(create_xrc_srq_in, in, opcode,     MLX5_CMD_OP_CREATE_XRC_SRQ);
311290650Shselasky
312290650Shselasky	memset(out, 0, sizeof(out));
313290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
314290650Shselasky	if (!err)
315290650Shselasky		*xsrqn = MLX5_GET(create_xrc_srq_out, out, xrc_srqn);
316290650Shselasky
317290650Shselasky	return err;
318290650Shselasky}
319290650Shselasky
320290650Shselaskyint mlx5_core_destroy_xsrq(struct mlx5_core_dev *dev, u32 xsrqn)
321290650Shselasky{
322290650Shselasky	u32 in[MLX5_ST_SZ_DW(destroy_xrc_srq_in)];
323290650Shselasky	u32 out[MLX5_ST_SZ_DW(destroy_xrc_srq_out)];
324290650Shselasky
325290650Shselasky	memset(in, 0, sizeof(in));
326290650Shselasky	memset(out, 0, sizeof(out));
327290650Shselasky
328290650Shselasky	MLX5_SET(destroy_xrc_srq_in, in, opcode,   MLX5_CMD_OP_DESTROY_XRC_SRQ);
329290650Shselasky	MLX5_SET(destroy_xrc_srq_in, in, xrc_srqn, xsrqn);
330290650Shselasky
331290650Shselasky	return mlx5_cmd_exec_check_status(dev, in, sizeof(in), out,
332290650Shselasky					  sizeof(out));
333290650Shselasky}
334290650Shselasky
335290650Shselaskyint mlx5_core_query_xsrq(struct mlx5_core_dev *dev, u32 xsrqn, u32 *out)
336290650Shselasky{
337290650Shselasky	u32 in[MLX5_ST_SZ_DW(query_xrc_srq_in)];
338290650Shselasky	void *srqc;
339290650Shselasky	void *xrc_srqc;
340290650Shselasky	int err;
341290650Shselasky
342290650Shselasky	memset(in, 0, sizeof(in));
343290650Shselasky	MLX5_SET(query_xrc_srq_in, in, opcode,   MLX5_CMD_OP_QUERY_XRC_SRQ);
344290650Shselasky	MLX5_SET(query_xrc_srq_in, in, xrc_srqn, xsrqn);
345290650Shselasky
346290650Shselasky	err =  mlx5_cmd_exec_check_status(dev, in, sizeof(in),
347290650Shselasky					  out,
348290650Shselasky					  MLX5_ST_SZ_BYTES(query_xrc_srq_out));
349290650Shselasky	if (!err) {
350290650Shselasky		xrc_srqc = MLX5_ADDR_OF(query_xrc_srq_out, out,
351290650Shselasky					xrc_srq_context_entry);
352290650Shselasky		srqc = MLX5_ADDR_OF(query_srq_out, out, srq_context_entry);
353290650Shselasky		memcpy(srqc, xrc_srqc, MLX5_ST_SZ_BYTES(srqc));
354290650Shselasky	}
355290650Shselasky
356290650Shselasky	return err;
357290650Shselasky}
358290650Shselasky
359290650Shselaskyint mlx5_core_arm_xsrq(struct mlx5_core_dev *dev, u32 xsrqn, u16 lwm)
360290650Shselasky{
361290650Shselasky	u32 in[MLX5_ST_SZ_DW(arm_xrc_srq_in)];
362290650Shselasky	u32 out[MLX5_ST_SZ_DW(arm_xrc_srq_out)];
363290650Shselasky
364290650Shselasky	memset(in, 0, sizeof(in));
365290650Shselasky	memset(out, 0, sizeof(out));
366290650Shselasky
367290650Shselasky	MLX5_SET(arm_xrc_srq_in, in, opcode,   MLX5_CMD_OP_ARM_XRC_SRQ);
368290650Shselasky	MLX5_SET(arm_xrc_srq_in, in, xrc_srqn, xsrqn);
369290650Shselasky	MLX5_SET(arm_xrc_srq_in, in, lwm,      lwm);
370290650Shselasky	MLX5_SET(arm_xrc_srq_in, in, op_mod,
371290650Shselasky		 MLX5_ARM_XRC_SRQ_IN_OP_MOD_XRC_SRQ);
372290650Shselasky
373290650Shselasky	return  mlx5_cmd_exec_check_status(dev, in, sizeof(in), out,
374290650Shselasky					   sizeof(out));
375290650Shselasky
376290650Shselasky}
377290650Shselasky
378290650Shselaskyint mlx5_core_create_rqt(struct mlx5_core_dev *dev, u32 *in, int inlen,
379290650Shselasky			 u32 *rqtn)
380290650Shselasky{
381290650Shselasky	u32 out[MLX5_ST_SZ_DW(create_rqt_out)];
382290650Shselasky	int err;
383290650Shselasky
384290650Shselasky	MLX5_SET(create_rqt_in, in, opcode, MLX5_CMD_OP_CREATE_RQT);
385290650Shselasky
386290650Shselasky	memset(out, 0, sizeof(out));
387290650Shselasky	err = mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
388290650Shselasky	if (!err)
389290650Shselasky		*rqtn = MLX5_GET(create_rqt_out, out, rqtn);
390290650Shselasky
391290650Shselasky	return err;
392290650Shselasky}
393290650Shselasky
394290650Shselaskyint mlx5_core_modify_rqt(struct mlx5_core_dev *dev, u32 rqtn, u32 *in,
395290650Shselasky			 int inlen)
396290650Shselasky{
397290650Shselasky	u32 out[MLX5_ST_SZ_DW(modify_rqt_out)];
398290650Shselasky
399290650Shselasky	MLX5_SET(modify_rqt_in, in, rqtn, rqtn);
400290650Shselasky	MLX5_SET(modify_rqt_in, in, opcode, MLX5_CMD_OP_MODIFY_RQT);
401290650Shselasky
402290650Shselasky	memset(out, 0, sizeof(out));
403290650Shselasky	return mlx5_cmd_exec_check_status(dev, in, inlen, out, sizeof(out));
404290650Shselasky}
405290650Shselasky
406290650Shselaskyvoid mlx5_core_destroy_rqt(struct mlx5_core_dev *dev, u32 rqtn)
407290650Shselasky{
408290650Shselasky	u32 in[MLX5_ST_SZ_DW(destroy_rqt_in)];
409290650Shselasky	u32 out[MLX5_ST_SZ_DW(destroy_rqt_out)];
410290650Shselasky
411290650Shselasky	memset(in, 0, sizeof(in));
412290650Shselasky
413290650Shselasky	MLX5_SET(destroy_rqt_in, in, opcode, MLX5_CMD_OP_DESTROY_RQT);
414290650Shselasky	MLX5_SET(destroy_rqt_in, in, rqtn, rqtn);
415290650Shselasky
416290650Shselasky	mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
417290650Shselasky}
418