xref: /dpdk/drivers/common/mlx5/linux/mlx5_glue.c (revision 9f3b3a96dec2f4c01cc92a132d763b8887d29e6a)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018 6WIND S.A.
3  * Copyright 2018 Mellanox Technologies, Ltd
4  */
5 
6 #include <errno.h>
7 #include <stdalign.h>
8 #include <stddef.h>
9 #include <stdint.h>
10 #include <stdlib.h>
11 #include <rte_memory.h>
12 /*
13  * Not needed by this file; included to work around the lack of off_t
14  * definition for mlx5dv.h with unpatched rdma-core versions.
15  */
16 #include <sys/types.h>
17 
18 #include "mlx5_glue.h"
19 #include "../mlx5_malloc.h"
20 
21 static int
22 mlx5_glue_fork_init(void)
23 {
24 	return ibv_fork_init();
25 }
26 
27 static struct ibv_pd *
28 mlx5_glue_alloc_pd(struct ibv_context *context)
29 {
30 	return ibv_alloc_pd(context);
31 }
32 
33 static int
34 mlx5_glue_dealloc_pd(struct ibv_pd *pd)
35 {
36 	return ibv_dealloc_pd(pd);
37 }
38 
39 static struct ibv_device **
40 mlx5_glue_get_device_list(int *num_devices)
41 {
42 	return ibv_get_device_list(num_devices);
43 }
44 
45 static void
46 mlx5_glue_free_device_list(struct ibv_device **list)
47 {
48 	ibv_free_device_list(list);
49 }
50 
51 static struct ibv_context *
52 mlx5_glue_open_device(struct ibv_device *device)
53 {
54 	return ibv_open_device(device);
55 }
56 
57 static int
58 mlx5_glue_close_device(struct ibv_context *context)
59 {
60 	return ibv_close_device(context);
61 }
62 
63 static int
64 mlx5_glue_query_device(struct ibv_context *context,
65 		       struct ibv_device_attr *device_attr)
66 {
67 	return ibv_query_device(context, device_attr);
68 }
69 
70 static int
71 mlx5_glue_query_device_ex(struct ibv_context *context,
72 			  const struct ibv_query_device_ex_input *input,
73 			  struct ibv_device_attr_ex *attr)
74 {
75 	return ibv_query_device_ex(context, input, attr);
76 }
77 
78 static int
79 mlx5_glue_query_rt_values_ex(struct ibv_context *context,
80 			  struct ibv_values_ex *values)
81 {
82 	return ibv_query_rt_values_ex(context, values);
83 }
84 
85 static int
86 mlx5_glue_query_port(struct ibv_context *context, uint8_t port_num,
87 		     struct ibv_port_attr *port_attr)
88 {
89 	return ibv_query_port(context, port_num, port_attr);
90 }
91 
92 static struct ibv_comp_channel *
93 mlx5_glue_create_comp_channel(struct ibv_context *context)
94 {
95 	return ibv_create_comp_channel(context);
96 }
97 
98 static int
99 mlx5_glue_destroy_comp_channel(struct ibv_comp_channel *channel)
100 {
101 	return ibv_destroy_comp_channel(channel);
102 }
103 
104 static struct ibv_cq *
105 mlx5_glue_create_cq(struct ibv_context *context, int cqe, void *cq_context,
106 		    struct ibv_comp_channel *channel, int comp_vector)
107 {
108 	return ibv_create_cq(context, cqe, cq_context, channel, comp_vector);
109 }
110 
111 static int
112 mlx5_glue_destroy_cq(struct ibv_cq *cq)
113 {
114 	return ibv_destroy_cq(cq);
115 }
116 
117 static int
118 mlx5_glue_get_cq_event(struct ibv_comp_channel *channel, struct ibv_cq **cq,
119 		       void **cq_context)
120 {
121 	return ibv_get_cq_event(channel, cq, cq_context);
122 }
123 
124 static void
125 mlx5_glue_ack_cq_events(struct ibv_cq *cq, unsigned int nevents)
126 {
127 	ibv_ack_cq_events(cq, nevents);
128 }
129 
130 static struct ibv_rwq_ind_table *
131 mlx5_glue_create_rwq_ind_table(struct ibv_context *context,
132 			       struct ibv_rwq_ind_table_init_attr *init_attr)
133 {
134 	return ibv_create_rwq_ind_table(context, init_attr);
135 }
136 
137 static int
138 mlx5_glue_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table)
139 {
140 	return ibv_destroy_rwq_ind_table(rwq_ind_table);
141 }
142 
143 static struct ibv_wq *
144 mlx5_glue_create_wq(struct ibv_context *context,
145 		    struct ibv_wq_init_attr *wq_init_attr)
146 {
147 	return ibv_create_wq(context, wq_init_attr);
148 }
149 
150 static int
151 mlx5_glue_destroy_wq(struct ibv_wq *wq)
152 {
153 	return ibv_destroy_wq(wq);
154 }
155 static int
156 mlx5_glue_modify_wq(struct ibv_wq *wq, struct ibv_wq_attr *wq_attr)
157 {
158 	return ibv_modify_wq(wq, wq_attr);
159 }
160 
161 static struct ibv_flow *
162 mlx5_glue_create_flow(struct ibv_qp *qp, struct ibv_flow_attr *flow)
163 {
164 	return ibv_create_flow(qp, flow);
165 }
166 
167 static int
168 mlx5_glue_destroy_flow(struct ibv_flow *flow_id)
169 {
170 	return ibv_destroy_flow(flow_id);
171 }
172 
173 static int
174 mlx5_glue_destroy_flow_action(void *action)
175 {
176 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
177 #ifdef HAVE_MLX5DV_DR
178 	return mlx5dv_dr_action_destroy(action);
179 #else
180 	struct mlx5dv_flow_action_attr *attr = action;
181 	int res = 0;
182 	switch (attr->type) {
183 	case MLX5DV_FLOW_ACTION_TAG:
184 		break;
185 	default:
186 		res = ibv_destroy_flow_action(attr->action);
187 		break;
188 	}
189 	mlx5_free(action);
190 	return res;
191 #endif
192 #else
193 	(void)action;
194 	return -ENOTSUP;
195 #endif
196 }
197 
198 static struct ibv_qp *
199 mlx5_glue_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr)
200 {
201 	return ibv_create_qp(pd, qp_init_attr);
202 }
203 
204 static struct ibv_qp *
205 mlx5_glue_create_qp_ex(struct ibv_context *context,
206 		       struct ibv_qp_init_attr_ex *qp_init_attr_ex)
207 {
208 	return ibv_create_qp_ex(context, qp_init_attr_ex);
209 }
210 
211 static int
212 mlx5_glue_destroy_qp(struct ibv_qp *qp)
213 {
214 	return ibv_destroy_qp(qp);
215 }
216 
217 static int
218 mlx5_glue_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask)
219 {
220 	return ibv_modify_qp(qp, attr, attr_mask);
221 }
222 
223 static struct ibv_mr *
224 mlx5_glue_reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access)
225 {
226 	return ibv_reg_mr(pd, addr, length, access);
227 }
228 
229 static struct ibv_mr *
230 mlx5_glue_alloc_null_mr(struct ibv_pd *pd)
231 {
232 #ifdef HAVE_IBV_DEVX_OBJ
233 	return ibv_alloc_null_mr(pd);
234 #else
235 	(void)pd;
236 	errno = ENOTSUP;
237 	return NULL;
238 #endif
239 }
240 
241 static int
242 mlx5_glue_dereg_mr(struct ibv_mr *mr)
243 {
244 	return ibv_dereg_mr(mr);
245 }
246 
247 static struct ibv_counter_set *
248 mlx5_glue_create_counter_set(struct ibv_context *context,
249 			     struct ibv_counter_set_init_attr *init_attr)
250 {
251 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
252 	(void)context;
253 	(void)init_attr;
254 	return NULL;
255 #else
256 	return ibv_create_counter_set(context, init_attr);
257 #endif
258 }
259 
260 static int
261 mlx5_glue_destroy_counter_set(struct ibv_counter_set *cs)
262 {
263 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
264 	(void)cs;
265 	return -ENOTSUP;
266 #else
267 	return ibv_destroy_counter_set(cs);
268 #endif
269 }
270 
271 static int
272 mlx5_glue_describe_counter_set(struct ibv_context *context,
273 			       uint16_t counter_set_id,
274 			       struct ibv_counter_set_description *cs_desc)
275 {
276 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
277 	(void)context;
278 	(void)counter_set_id;
279 	(void)cs_desc;
280 	return -ENOTSUP;
281 #else
282 	return ibv_describe_counter_set(context, counter_set_id, cs_desc);
283 #endif
284 }
285 
286 static int
287 mlx5_glue_query_counter_set(struct ibv_query_counter_set_attr *query_attr,
288 			    struct ibv_counter_set_data *cs_data)
289 {
290 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
291 	(void)query_attr;
292 	(void)cs_data;
293 	return -ENOTSUP;
294 #else
295 	return ibv_query_counter_set(query_attr, cs_data);
296 #endif
297 }
298 
299 static struct ibv_counters *
300 mlx5_glue_create_counters(struct ibv_context *context,
301 			  struct ibv_counters_init_attr *init_attr)
302 {
303 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
304 	(void)context;
305 	(void)init_attr;
306 	errno = ENOTSUP;
307 	return NULL;
308 #else
309 	return ibv_create_counters(context, init_attr);
310 #endif
311 }
312 
313 static int
314 mlx5_glue_destroy_counters(struct ibv_counters *counters)
315 {
316 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
317 	(void)counters;
318 	return -ENOTSUP;
319 #else
320 	return ibv_destroy_counters(counters);
321 #endif
322 }
323 
324 static int
325 mlx5_glue_attach_counters(struct ibv_counters *counters,
326 			  struct ibv_counter_attach_attr *attr,
327 			  struct ibv_flow *flow)
328 {
329 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
330 	(void)counters;
331 	(void)attr;
332 	(void)flow;
333 	return -ENOTSUP;
334 #else
335 	return ibv_attach_counters_point_flow(counters, attr, flow);
336 #endif
337 }
338 
339 static int
340 mlx5_glue_query_counters(struct ibv_counters *counters,
341 			 uint64_t *counters_value,
342 			 uint32_t ncounters,
343 			 uint32_t flags)
344 {
345 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
346 	(void)counters;
347 	(void)counters_value;
348 	(void)ncounters;
349 	(void)flags;
350 	return -ENOTSUP;
351 #else
352 	return ibv_read_counters(counters, counters_value, ncounters, flags);
353 #endif
354 }
355 
356 static void
357 mlx5_glue_ack_async_event(struct ibv_async_event *event)
358 {
359 	ibv_ack_async_event(event);
360 }
361 
362 static int
363 mlx5_glue_get_async_event(struct ibv_context *context,
364 			  struct ibv_async_event *event)
365 {
366 	return ibv_get_async_event(context, event);
367 }
368 
369 static const char *
370 mlx5_glue_port_state_str(enum ibv_port_state port_state)
371 {
372 	return ibv_port_state_str(port_state);
373 }
374 
375 static struct ibv_cq *
376 mlx5_glue_cq_ex_to_cq(struct ibv_cq_ex *cq)
377 {
378 	return ibv_cq_ex_to_cq(cq);
379 }
380 
381 static void *
382 mlx5_glue_dr_create_flow_action_dest_flow_tbl(void *tbl)
383 {
384 #ifdef HAVE_MLX5DV_DR
385 	return mlx5dv_dr_action_create_dest_table(tbl);
386 #else
387 	(void)tbl;
388 	errno = ENOTSUP;
389 	return NULL;
390 #endif
391 }
392 
393 static void *
394 mlx5_glue_dr_create_flow_action_dest_port(void *domain, uint32_t port)
395 {
396 #ifdef HAVE_MLX5DV_DR_DEVX_PORT
397 	return mlx5dv_dr_action_create_dest_ib_port(domain, port);
398 #else
399 #ifdef HAVE_MLX5DV_DR_ESWITCH
400 	return mlx5dv_dr_action_create_dest_vport(domain, port);
401 #else
402 	(void)domain;
403 	(void)port;
404 	errno = ENOTSUP;
405 	return NULL;
406 #endif
407 #endif
408 }
409 
410 static void *
411 mlx5_glue_dr_create_flow_action_drop(void)
412 {
413 #ifdef HAVE_MLX5DV_DR_ESWITCH
414 	return mlx5dv_dr_action_create_drop();
415 #else
416 	errno = ENOTSUP;
417 	return NULL;
418 #endif
419 }
420 
421 static void *
422 mlx5_glue_dr_create_flow_action_push_vlan(struct mlx5dv_dr_domain *domain,
423 					  rte_be32_t vlan_tag)
424 {
425 #ifdef HAVE_MLX5DV_DR_VLAN
426 	return mlx5dv_dr_action_create_push_vlan(domain, vlan_tag);
427 #else
428 	(void)domain;
429 	(void)vlan_tag;
430 	errno = ENOTSUP;
431 	return NULL;
432 #endif
433 }
434 
435 static void *
436 mlx5_glue_dr_create_flow_action_pop_vlan(void)
437 {
438 #ifdef HAVE_MLX5DV_DR_VLAN
439 	return mlx5dv_dr_action_create_pop_vlan();
440 #else
441 	errno = ENOTSUP;
442 	return NULL;
443 #endif
444 }
445 
446 static void *
447 mlx5_glue_dr_create_flow_tbl(void *domain, uint32_t level)
448 {
449 #ifdef HAVE_MLX5DV_DR
450 	return mlx5dv_dr_table_create(domain, level);
451 #else
452 	(void)domain;
453 	(void)level;
454 	errno = ENOTSUP;
455 	return NULL;
456 #endif
457 }
458 
459 static int
460 mlx5_glue_dr_destroy_flow_tbl(void *tbl)
461 {
462 #ifdef HAVE_MLX5DV_DR
463 	return mlx5dv_dr_table_destroy(tbl);
464 #else
465 	(void)tbl;
466 	errno = ENOTSUP;
467 	return errno;
468 #endif
469 }
470 
471 static void *
472 mlx5_glue_dr_create_domain(struct ibv_context *ctx,
473 			   enum  mlx5dv_dr_domain_type domain)
474 {
475 #ifdef HAVE_MLX5DV_DR
476 	return mlx5dv_dr_domain_create(ctx, domain);
477 #else
478 	(void)ctx;
479 	(void)domain;
480 	errno = ENOTSUP;
481 	return NULL;
482 #endif
483 }
484 
485 static int
486 mlx5_glue_dr_destroy_domain(void *domain)
487 {
488 #ifdef HAVE_MLX5DV_DR
489 	return mlx5dv_dr_domain_destroy(domain);
490 #else
491 	(void)domain;
492 	errno = ENOTSUP;
493 	return errno;
494 #endif
495 }
496 
497 static int
498 mlx5_glue_dr_sync_domain(void *domain, uint32_t flags)
499 {
500 #ifdef HAVE_MLX5DV_DR
501 	return mlx5dv_dr_domain_sync(domain, flags);
502 #else
503 	(void)domain;
504 	(void)flags;
505 	errno = ENOTSUP;
506 	return errno;
507 #endif
508 }
509 
510 static struct ibv_cq_ex *
511 mlx5_glue_dv_create_cq(struct ibv_context *context,
512 		       struct ibv_cq_init_attr_ex *cq_attr,
513 		       struct mlx5dv_cq_init_attr *mlx5_cq_attr)
514 {
515 	return mlx5dv_create_cq(context, cq_attr, mlx5_cq_attr);
516 }
517 
518 static struct ibv_wq *
519 mlx5_glue_dv_create_wq(struct ibv_context *context,
520 		       struct ibv_wq_init_attr *wq_attr,
521 		       struct mlx5dv_wq_init_attr *mlx5_wq_attr)
522 {
523 #ifndef HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT
524 	(void)context;
525 	(void)wq_attr;
526 	(void)mlx5_wq_attr;
527 	errno = ENOTSUP;
528 	return NULL;
529 #else
530 	return mlx5dv_create_wq(context, wq_attr, mlx5_wq_attr);
531 #endif
532 }
533 
534 static int
535 mlx5_glue_dv_query_device(struct ibv_context *ctx,
536 			  struct mlx5dv_context *attrs_out)
537 {
538 	return mlx5dv_query_device(ctx, attrs_out);
539 }
540 
541 static int
542 mlx5_glue_dv_set_context_attr(struct ibv_context *ibv_ctx,
543 			      enum mlx5dv_set_ctx_attr_type type, void *attr)
544 {
545 	return mlx5dv_set_context_attr(ibv_ctx, type, attr);
546 }
547 
548 static int
549 mlx5_glue_dv_init_obj(struct mlx5dv_obj *obj, uint64_t obj_type)
550 {
551 	return mlx5dv_init_obj(obj, obj_type);
552 }
553 
554 static struct ibv_qp *
555 mlx5_glue_dv_create_qp(struct ibv_context *context,
556 		       struct ibv_qp_init_attr_ex *qp_init_attr_ex,
557 		       struct mlx5dv_qp_init_attr *dv_qp_init_attr)
558 {
559 #ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT
560 	return mlx5dv_create_qp(context, qp_init_attr_ex, dv_qp_init_attr);
561 #else
562 	(void)context;
563 	(void)qp_init_attr_ex;
564 	(void)dv_qp_init_attr;
565 	errno = ENOTSUP;
566 	return NULL;
567 #endif
568 }
569 
570 static void *
571 mlx5_glue_dv_create_flow_matcher(struct ibv_context *context,
572 				 struct mlx5dv_flow_matcher_attr *matcher_attr,
573 				 void *tbl)
574 {
575 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
576 #ifdef HAVE_MLX5DV_DR
577 	(void)context;
578 	return mlx5dv_dr_matcher_create(tbl, matcher_attr->priority,
579 					matcher_attr->match_criteria_enable,
580 					matcher_attr->match_mask);
581 #else
582 	(void)tbl;
583 	return mlx5dv_create_flow_matcher(context, matcher_attr);
584 #endif
585 #else
586 	(void)context;
587 	(void)matcher_attr;
588 	(void)tbl;
589 	errno = ENOTSUP;
590 	return NULL;
591 #endif
592 }
593 
594 static void *
595 mlx5_glue_dv_create_flow(void *matcher,
596 			 void *match_value,
597 			 size_t num_actions,
598 			 void *actions[])
599 {
600 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
601 #ifdef HAVE_MLX5DV_DR
602 	return mlx5dv_dr_rule_create(matcher, match_value, num_actions,
603 				     (struct mlx5dv_dr_action **)actions);
604 #else
605 	size_t i;
606 	struct mlx5dv_flow_action_attr actions_attr[8];
607 
608 	if (num_actions > 8)
609 		return NULL;
610 	for (i = 0; i < num_actions; i++)
611 		actions_attr[i] =
612 			*((struct mlx5dv_flow_action_attr *)(actions[i]));
613 	return mlx5dv_create_flow(matcher, match_value,
614 				  num_actions, actions_attr);
615 #endif
616 #else
617 	(void)matcher;
618 	(void)match_value;
619 	(void)num_actions;
620 	(void)actions;
621 	return NULL;
622 #endif
623 }
624 
625 static void *
626 mlx5_glue_dv_create_flow_action_counter(void *counter_obj, uint32_t offset)
627 {
628 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
629 #ifdef HAVE_MLX5DV_DR
630 	return mlx5dv_dr_action_create_flow_counter(counter_obj, offset);
631 #else
632 	struct mlx5dv_flow_action_attr *action;
633 
634 	(void)offset;
635 	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
636 	if (!action)
637 		return NULL;
638 	action->type = MLX5DV_FLOW_ACTION_COUNTERS_DEVX;
639 	action->obj = counter_obj;
640 	return action;
641 #endif
642 #else
643 	(void)counter_obj;
644 	(void)offset;
645 	errno = ENOTSUP;
646 	return NULL;
647 #endif
648 }
649 
650 static void *
651 mlx5_glue_dv_create_flow_action_dest_ibv_qp(void *qp)
652 {
653 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
654 #ifdef HAVE_MLX5DV_DR
655 	return mlx5dv_dr_action_create_dest_ibv_qp(qp);
656 #else
657 	struct mlx5dv_flow_action_attr *action;
658 
659 	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
660 	if (!action)
661 		return NULL;
662 	action->type = MLX5DV_FLOW_ACTION_DEST_IBV_QP;
663 	action->obj = qp;
664 	return action;
665 #endif
666 #else
667 	(void)qp;
668 	errno = ENOTSUP;
669 	return NULL;
670 #endif
671 }
672 
673 static void *
674 mlx5_glue_dv_create_flow_action_dest_devx_tir(void *tir)
675 {
676 #ifdef HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR
677 	return mlx5dv_dr_action_create_dest_devx_tir(tir);
678 #else
679 	(void)tir;
680 	errno = ENOTSUP;
681 	return NULL;
682 #endif
683 }
684 
685 static void *
686 mlx5_glue_dv_create_flow_action_modify_header
687 					(struct ibv_context *ctx,
688 					 enum mlx5dv_flow_table_type ft_type,
689 					 void *domain, uint64_t flags,
690 					 size_t actions_sz,
691 					 uint64_t actions[])
692 {
693 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
694 #ifdef HAVE_MLX5DV_DR
695 	(void)ctx;
696 	(void)ft_type;
697 	return mlx5dv_dr_action_create_modify_header(domain, flags, actions_sz,
698 						     (__be64 *)actions);
699 #else
700 	struct mlx5dv_flow_action_attr *action;
701 
702 	(void)domain;
703 	(void)flags;
704 	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
705 	if (!action)
706 		return NULL;
707 	action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
708 	action->action = mlx5dv_create_flow_action_modify_header
709 		(ctx, actions_sz, actions, ft_type);
710 	return action;
711 #endif
712 #else
713 	(void)ctx;
714 	(void)ft_type;
715 	(void)domain;
716 	(void)flags;
717 	(void)actions_sz;
718 	(void)actions;
719 	errno = ENOTSUP;
720 	return NULL;
721 #endif
722 }
723 
724 static void *
725 mlx5_glue_dv_create_flow_action_packet_reformat
726 		(struct ibv_context *ctx,
727 		 enum mlx5dv_flow_action_packet_reformat_type reformat_type,
728 		 enum mlx5dv_flow_table_type ft_type,
729 		 struct mlx5dv_dr_domain *domain,
730 		 uint32_t flags, size_t data_sz, void *data)
731 {
732 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
733 #ifdef HAVE_MLX5DV_DR
734 	(void)ctx;
735 	(void)ft_type;
736 	return mlx5dv_dr_action_create_packet_reformat(domain, flags,
737 						       reformat_type, data_sz,
738 						       data);
739 #else
740 	(void)domain;
741 	(void)flags;
742 	struct mlx5dv_flow_action_attr *action;
743 
744 	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
745 	if (!action)
746 		return NULL;
747 	action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
748 	action->action = mlx5dv_create_flow_action_packet_reformat
749 		(ctx, data_sz, data, reformat_type, ft_type);
750 	return action;
751 #endif
752 #else
753 	(void)ctx;
754 	(void)reformat_type;
755 	(void)ft_type;
756 	(void)domain;
757 	(void)flags;
758 	(void)data_sz;
759 	(void)data;
760 	errno = ENOTSUP;
761 	return NULL;
762 #endif
763 }
764 
765 static void *
766 mlx5_glue_dv_create_flow_action_tag(uint32_t tag)
767 {
768 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
769 #ifdef HAVE_MLX5DV_DR
770 	return mlx5dv_dr_action_create_tag(tag);
771 #else /* HAVE_MLX5DV_DR */
772 	struct mlx5dv_flow_action_attr *action;
773 
774 	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
775 	if (!action)
776 		return NULL;
777 	action->type = MLX5DV_FLOW_ACTION_TAG;
778 	action->tag_value = tag;
779 	return action;
780 #endif /* HAVE_MLX5DV_DR */
781 #else /* HAVE_IBV_FLOW_DV_SUPPORT */
782 	(void)tag;
783 	errno = ENOTSUP;
784 	return NULL;
785 #endif /* HAVE_IBV_FLOW_DV_SUPPORT */
786 }
787 
788 static void *
789 mlx5_glue_dv_create_flow_action_meter(struct mlx5dv_dr_flow_meter_attr *attr)
790 {
791 #if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)
792 	return mlx5dv_dr_action_create_flow_meter(attr);
793 #else
794 	(void)attr;
795 	errno = ENOTSUP;
796 	return NULL;
797 #endif
798 }
799 
800 static int
801 mlx5_glue_dv_modify_flow_action_meter(void *action,
802 				      struct mlx5dv_dr_flow_meter_attr *attr,
803 				      uint64_t modify_bits)
804 {
805 #if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)
806 	return mlx5dv_dr_action_modify_flow_meter(action, attr, modify_bits);
807 #else
808 	(void)action;
809 	(void)attr;
810 	(void)modify_bits;
811 	errno = ENOTSUP;
812 	return errno;
813 #endif
814 }
815 
816 static void *
817 mlx5_glue_dr_create_flow_action_default_miss(void)
818 {
819 #if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS)
820 	return mlx5dv_dr_action_create_default_miss();
821 #else
822 	errno = ENOTSUP;
823 	return NULL;
824 #endif
825 }
826 
827 static int
828 mlx5_glue_dv_destroy_flow(void *flow_id)
829 {
830 #ifdef HAVE_MLX5DV_DR
831 	return mlx5dv_dr_rule_destroy(flow_id);
832 #else
833 	return ibv_destroy_flow(flow_id);
834 #endif
835 }
836 
837 static int
838 mlx5_glue_dv_destroy_flow_matcher(void *matcher)
839 {
840 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
841 #ifdef HAVE_MLX5DV_DR
842 	return mlx5dv_dr_matcher_destroy(matcher);
843 #else
844 	return mlx5dv_destroy_flow_matcher(matcher);
845 #endif
846 #else
847 	(void)matcher;
848 	errno = ENOTSUP;
849 	return errno;
850 #endif
851 }
852 
853 static struct ibv_context *
854 mlx5_glue_dv_open_device(struct ibv_device *device)
855 {
856 #ifdef HAVE_IBV_DEVX_OBJ
857 	return mlx5dv_open_device(device,
858 				  &(struct mlx5dv_context_attr){
859 					.flags = MLX5DV_CONTEXT_FLAGS_DEVX,
860 				  });
861 #else
862 	(void)device;
863 	errno = ENOTSUP;
864 	return NULL;
865 #endif
866 }
867 
868 static struct mlx5dv_devx_obj *
869 mlx5_glue_devx_obj_create(struct ibv_context *ctx,
870 			  const void *in, size_t inlen,
871 			  void *out, size_t outlen)
872 {
873 #ifdef HAVE_IBV_DEVX_OBJ
874 	return mlx5dv_devx_obj_create(ctx, in, inlen, out, outlen);
875 #else
876 	(void)ctx;
877 	(void)in;
878 	(void)inlen;
879 	(void)out;
880 	(void)outlen;
881 	errno = ENOTSUP;
882 	return NULL;
883 #endif
884 }
885 
886 static int
887 mlx5_glue_devx_obj_destroy(struct mlx5dv_devx_obj *obj)
888 {
889 #ifdef HAVE_IBV_DEVX_OBJ
890 	return mlx5dv_devx_obj_destroy(obj);
891 #else
892 	(void)obj;
893 	return -ENOTSUP;
894 #endif
895 }
896 
897 static int
898 mlx5_glue_devx_obj_query(struct mlx5dv_devx_obj *obj,
899 			 const void *in, size_t inlen,
900 			 void *out, size_t outlen)
901 {
902 #ifdef HAVE_IBV_DEVX_OBJ
903 	return mlx5dv_devx_obj_query(obj, in, inlen, out, outlen);
904 #else
905 	(void)obj;
906 	(void)in;
907 	(void)inlen;
908 	(void)out;
909 	(void)outlen;
910 	return -ENOTSUP;
911 #endif
912 }
913 
914 static int
915 mlx5_glue_devx_obj_modify(struct mlx5dv_devx_obj *obj,
916 			  const void *in, size_t inlen,
917 			  void *out, size_t outlen)
918 {
919 #ifdef HAVE_IBV_DEVX_OBJ
920 	return mlx5dv_devx_obj_modify(obj, in, inlen, out, outlen);
921 #else
922 	(void)obj;
923 	(void)in;
924 	(void)inlen;
925 	(void)out;
926 	(void)outlen;
927 	return -ENOTSUP;
928 #endif
929 }
930 
931 static int
932 mlx5_glue_devx_general_cmd(struct ibv_context *ctx,
933 			   const void *in, size_t inlen,
934 			   void *out, size_t outlen)
935 {
936 #ifdef HAVE_IBV_DEVX_OBJ
937 	return mlx5dv_devx_general_cmd(ctx, in, inlen, out, outlen);
938 #else
939 	(void)ctx;
940 	(void)in;
941 	(void)inlen;
942 	(void)out;
943 	(void)outlen;
944 	return -ENOTSUP;
945 #endif
946 }
947 
948 static struct mlx5dv_devx_cmd_comp *
949 mlx5_glue_devx_create_cmd_comp(struct ibv_context *ctx)
950 {
951 #ifdef HAVE_IBV_DEVX_ASYNC
952 	return mlx5dv_devx_create_cmd_comp(ctx);
953 #else
954 	(void)ctx;
955 	errno = -ENOTSUP;
956 	return NULL;
957 #endif
958 }
959 
960 static void
961 mlx5_glue_devx_destroy_cmd_comp(struct mlx5dv_devx_cmd_comp *cmd_comp)
962 {
963 #ifdef HAVE_IBV_DEVX_ASYNC
964 	mlx5dv_devx_destroy_cmd_comp(cmd_comp);
965 #else
966 	(void)cmd_comp;
967 	errno = -ENOTSUP;
968 #endif
969 }
970 
971 static int
972 mlx5_glue_devx_obj_query_async(struct mlx5dv_devx_obj *obj, const void *in,
973 			       size_t inlen, size_t outlen, uint64_t wr_id,
974 			       struct mlx5dv_devx_cmd_comp *cmd_comp)
975 {
976 #ifdef HAVE_IBV_DEVX_ASYNC
977 	return mlx5dv_devx_obj_query_async(obj, in, inlen, outlen, wr_id,
978 					   cmd_comp);
979 #else
980 	(void)obj;
981 	(void)in;
982 	(void)inlen;
983 	(void)outlen;
984 	(void)wr_id;
985 	(void)cmd_comp;
986 	return -ENOTSUP;
987 #endif
988 }
989 
990 static int
991 mlx5_glue_devx_get_async_cmd_comp(struct mlx5dv_devx_cmd_comp *cmd_comp,
992 				  struct mlx5dv_devx_async_cmd_hdr *cmd_resp,
993 				  size_t cmd_resp_len)
994 {
995 #ifdef HAVE_IBV_DEVX_ASYNC
996 	return mlx5dv_devx_get_async_cmd_comp(cmd_comp, cmd_resp,
997 					      cmd_resp_len);
998 #else
999 	(void)cmd_comp;
1000 	(void)cmd_resp;
1001 	(void)cmd_resp_len;
1002 	return -ENOTSUP;
1003 #endif
1004 }
1005 
1006 static struct mlx5dv_devx_umem *
1007 mlx5_glue_devx_umem_reg(struct ibv_context *context, void *addr, size_t size,
1008 			uint32_t access)
1009 {
1010 #ifdef HAVE_IBV_DEVX_OBJ
1011 	return mlx5dv_devx_umem_reg(context, addr, size, access);
1012 #else
1013 	(void)context;
1014 	(void)addr;
1015 	(void)size;
1016 	(void)access;
1017 	errno = -ENOTSUP;
1018 	return NULL;
1019 #endif
1020 }
1021 
1022 static int
1023 mlx5_glue_devx_umem_dereg(struct mlx5dv_devx_umem *dv_devx_umem)
1024 {
1025 #ifdef HAVE_IBV_DEVX_OBJ
1026 	return mlx5dv_devx_umem_dereg(dv_devx_umem);
1027 #else
1028 	(void)dv_devx_umem;
1029 	return -ENOTSUP;
1030 #endif
1031 }
1032 
1033 static int
1034 mlx5_glue_devx_qp_query(struct ibv_qp *qp,
1035 			const void *in, size_t inlen,
1036 			void *out, size_t outlen)
1037 {
1038 #ifdef HAVE_IBV_DEVX_QP
1039 	return mlx5dv_devx_qp_query(qp, in, inlen, out, outlen);
1040 #else
1041 	(void)qp;
1042 	(void)in;
1043 	(void)inlen;
1044 	(void)out;
1045 	(void)outlen;
1046 	errno = ENOTSUP;
1047 	return errno;
1048 #endif
1049 }
1050 
1051 static int
1052 mlx5_glue_devx_port_query(struct ibv_context *ctx,
1053 			  uint32_t port_num,
1054 			  struct mlx5dv_devx_port *mlx5_devx_port)
1055 {
1056 #ifdef HAVE_MLX5DV_DR_DEVX_PORT
1057 	return mlx5dv_query_devx_port(ctx, port_num, mlx5_devx_port);
1058 #else
1059 	(void)ctx;
1060 	(void)port_num;
1061 	(void)mlx5_devx_port;
1062 	errno = ENOTSUP;
1063 	return errno;
1064 #endif
1065 }
1066 
1067 static int
1068 mlx5_glue_dr_dump_domain(FILE *file, void *domain)
1069 {
1070 #ifdef HAVE_MLX5_DR_FLOW_DUMP
1071 	return mlx5dv_dump_dr_domain(file, domain);
1072 #else
1073 	RTE_SET_USED(file);
1074 	RTE_SET_USED(domain);
1075 	return -ENOTSUP;
1076 #endif
1077 }
1078 
1079 static void *
1080 mlx5_glue_dr_create_flow_action_sampler
1081 			(struct mlx5dv_dr_flow_sampler_attr *attr)
1082 {
1083 #ifdef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
1084 	return mlx5dv_dr_action_create_flow_sampler(attr);
1085 #else
1086 	(void)attr;
1087 	errno = ENOTSUP;
1088 	return NULL;
1089 #endif
1090 }
1091 
1092 static void *
1093 mlx5_glue_dr_action_create_dest_array
1094 			(void *domain,
1095 			 size_t num_dest,
1096 			 struct mlx5dv_dr_action_dest_attr *dests[])
1097 {
1098 #ifdef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
1099 	return mlx5dv_dr_action_create_dest_array
1100 				(domain,
1101 				num_dest,
1102 				dests);
1103 #else
1104 	(void)domain;
1105 	(void)num_dest;
1106 	(void)dests;
1107 	errno = ENOTSUP;
1108 	return NULL;
1109 #endif
1110 }
1111 
1112 static int
1113 mlx5_glue_devx_query_eqn(struct ibv_context *ctx, uint32_t cpus,
1114 			 uint32_t *eqn)
1115 {
1116 #ifdef HAVE_IBV_DEVX_OBJ
1117 	return mlx5dv_devx_query_eqn(ctx, cpus, eqn);
1118 #else
1119 	(void)ctx;
1120 	(void)cpus;
1121 	(void)eqn;
1122 	return -ENOTSUP;
1123 #endif
1124 }
1125 
1126 static struct mlx5dv_devx_event_channel *
1127 mlx5_glue_devx_create_event_channel(struct ibv_context *ctx, int flags)
1128 {
1129 #ifdef HAVE_IBV_DEVX_EVENT
1130 	return mlx5dv_devx_create_event_channel(ctx, flags);
1131 #else
1132 	(void)ctx;
1133 	(void)flags;
1134 	errno = ENOTSUP;
1135 	return NULL;
1136 #endif
1137 }
1138 
1139 static void
1140 mlx5_glue_devx_destroy_event_channel(struct mlx5dv_devx_event_channel *eventc)
1141 {
1142 #ifdef HAVE_IBV_DEVX_EVENT
1143 	mlx5dv_devx_destroy_event_channel(eventc);
1144 #else
1145 	(void)eventc;
1146 #endif
1147 }
1148 
1149 static int
1150 mlx5_glue_devx_subscribe_devx_event(struct mlx5dv_devx_event_channel *eventc,
1151 				    struct mlx5dv_devx_obj *obj,
1152 				    uint16_t events_sz, uint16_t events_num[],
1153 				    uint64_t cookie)
1154 {
1155 #ifdef HAVE_IBV_DEVX_EVENT
1156 	return mlx5dv_devx_subscribe_devx_event(eventc, obj, events_sz,
1157 						events_num, cookie);
1158 #else
1159 	(void)eventc;
1160 	(void)obj;
1161 	(void)events_sz;
1162 	(void)events_num;
1163 	(void)cookie;
1164 	return -ENOTSUP;
1165 #endif
1166 }
1167 
1168 static int
1169 mlx5_glue_devx_subscribe_devx_event_fd(struct mlx5dv_devx_event_channel *eventc,
1170 				       int fd, struct mlx5dv_devx_obj *obj,
1171 				       uint16_t event_num)
1172 {
1173 #ifdef HAVE_IBV_DEVX_EVENT
1174 	return mlx5dv_devx_subscribe_devx_event_fd(eventc, fd, obj, event_num);
1175 #else
1176 	(void)eventc;
1177 	(void)fd;
1178 	(void)obj;
1179 	(void)event_num;
1180 	return -ENOTSUP;
1181 #endif
1182 }
1183 
1184 static ssize_t
1185 mlx5_glue_devx_get_event(struct mlx5dv_devx_event_channel *eventc,
1186 			 struct mlx5dv_devx_async_event_hdr *event_data,
1187 			 size_t event_resp_len)
1188 {
1189 #ifdef HAVE_IBV_DEVX_EVENT
1190 	return mlx5dv_devx_get_event(eventc, event_data, event_resp_len);
1191 #else
1192 	(void)eventc;
1193 	(void)event_data;
1194 	(void)event_resp_len;
1195 	errno = ENOTSUP;
1196 	return -1;
1197 #endif
1198 }
1199 
1200 static struct mlx5dv_devx_uar *
1201 mlx5_glue_devx_alloc_uar(struct ibv_context *context, uint32_t flags)
1202 {
1203 #ifdef HAVE_IBV_DEVX_OBJ
1204 	return mlx5dv_devx_alloc_uar(context, flags);
1205 #else
1206 	(void)context;
1207 	(void)flags;
1208 	errno = ENOTSUP;
1209 	return NULL;
1210 #endif
1211 }
1212 
1213 static void
1214 mlx5_glue_devx_free_uar(struct mlx5dv_devx_uar *devx_uar)
1215 {
1216 #ifdef HAVE_IBV_DEVX_OBJ
1217 	mlx5dv_devx_free_uar(devx_uar);
1218 #else
1219 	(void)devx_uar;
1220 #endif
1221 }
1222 
1223 static struct mlx5dv_var *
1224 mlx5_glue_dv_alloc_var(struct ibv_context *context, uint32_t flags)
1225 {
1226 #ifdef HAVE_IBV_VAR
1227 	return mlx5dv_alloc_var(context, flags);
1228 #else
1229 	(void)context;
1230 	(void)flags;
1231 	errno = ENOTSUP;
1232 	return NULL;
1233 #endif
1234 }
1235 
1236 static void
1237 mlx5_glue_dv_free_var(struct mlx5dv_var *var)
1238 {
1239 #ifdef HAVE_IBV_VAR
1240 	mlx5dv_free_var(var);
1241 #else
1242 	(void)var;
1243 	errno = ENOTSUP;
1244 #endif
1245 }
1246 
1247 static void
1248 mlx5_glue_dr_reclaim_domain_memory(void *domain, uint32_t enable)
1249 {
1250 #ifdef HAVE_MLX5DV_DR_MEM_RECLAIM
1251 	mlx5dv_dr_domain_set_reclaim_device_memory(domain, enable);
1252 #else
1253 	(void)(enable);
1254 	(void)(domain);
1255 #endif
1256 }
1257 
1258 static struct mlx5dv_pp *
1259 mlx5_glue_dv_alloc_pp(struct ibv_context *context,
1260 		      size_t pp_context_sz,
1261 		      const void *pp_context,
1262 		      uint32_t flags)
1263 {
1264 #ifdef HAVE_MLX5DV_PP_ALLOC
1265 	return mlx5dv_pp_alloc(context, pp_context_sz, pp_context, flags);
1266 #else
1267 	RTE_SET_USED(context);
1268 	RTE_SET_USED(pp_context_sz);
1269 	RTE_SET_USED(pp_context);
1270 	RTE_SET_USED(flags);
1271 	errno = ENOTSUP;
1272 	return NULL;
1273 #endif
1274 }
1275 
1276 static void
1277 mlx5_glue_dv_free_pp(struct mlx5dv_pp *pp)
1278 {
1279 #ifdef HAVE_MLX5DV_PP_ALLOC
1280 	mlx5dv_pp_free(pp);
1281 #else
1282 	RTE_SET_USED(pp);
1283 #endif
1284 }
1285 
1286 __rte_cache_aligned
1287 const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
1288 	.version = MLX5_GLUE_VERSION,
1289 	.fork_init = mlx5_glue_fork_init,
1290 	.alloc_pd = mlx5_glue_alloc_pd,
1291 	.dealloc_pd = mlx5_glue_dealloc_pd,
1292 	.get_device_list = mlx5_glue_get_device_list,
1293 	.free_device_list = mlx5_glue_free_device_list,
1294 	.open_device = mlx5_glue_open_device,
1295 	.close_device = mlx5_glue_close_device,
1296 	.query_device = mlx5_glue_query_device,
1297 	.query_device_ex = mlx5_glue_query_device_ex,
1298 	.query_rt_values_ex = mlx5_glue_query_rt_values_ex,
1299 	.query_port = mlx5_glue_query_port,
1300 	.create_comp_channel = mlx5_glue_create_comp_channel,
1301 	.destroy_comp_channel = mlx5_glue_destroy_comp_channel,
1302 	.create_cq = mlx5_glue_create_cq,
1303 	.destroy_cq = mlx5_glue_destroy_cq,
1304 	.get_cq_event = mlx5_glue_get_cq_event,
1305 	.ack_cq_events = mlx5_glue_ack_cq_events,
1306 	.create_rwq_ind_table = mlx5_glue_create_rwq_ind_table,
1307 	.destroy_rwq_ind_table = mlx5_glue_destroy_rwq_ind_table,
1308 	.create_wq = mlx5_glue_create_wq,
1309 	.destroy_wq = mlx5_glue_destroy_wq,
1310 	.modify_wq = mlx5_glue_modify_wq,
1311 	.create_flow = mlx5_glue_create_flow,
1312 	.destroy_flow = mlx5_glue_destroy_flow,
1313 	.destroy_flow_action = mlx5_glue_destroy_flow_action,
1314 	.create_qp = mlx5_glue_create_qp,
1315 	.create_qp_ex = mlx5_glue_create_qp_ex,
1316 	.destroy_qp = mlx5_glue_destroy_qp,
1317 	.modify_qp = mlx5_glue_modify_qp,
1318 	.reg_mr = mlx5_glue_reg_mr,
1319 	.alloc_null_mr = mlx5_glue_alloc_null_mr,
1320 	.dereg_mr = mlx5_glue_dereg_mr,
1321 	.create_counter_set = mlx5_glue_create_counter_set,
1322 	.destroy_counter_set = mlx5_glue_destroy_counter_set,
1323 	.describe_counter_set = mlx5_glue_describe_counter_set,
1324 	.query_counter_set = mlx5_glue_query_counter_set,
1325 	.create_counters = mlx5_glue_create_counters,
1326 	.destroy_counters = mlx5_glue_destroy_counters,
1327 	.attach_counters = mlx5_glue_attach_counters,
1328 	.query_counters = mlx5_glue_query_counters,
1329 	.ack_async_event = mlx5_glue_ack_async_event,
1330 	.get_async_event = mlx5_glue_get_async_event,
1331 	.port_state_str = mlx5_glue_port_state_str,
1332 	.cq_ex_to_cq = mlx5_glue_cq_ex_to_cq,
1333 	.dr_create_flow_action_dest_flow_tbl =
1334 		mlx5_glue_dr_create_flow_action_dest_flow_tbl,
1335 	.dr_create_flow_action_dest_port =
1336 		mlx5_glue_dr_create_flow_action_dest_port,
1337 	.dr_create_flow_action_drop =
1338 		mlx5_glue_dr_create_flow_action_drop,
1339 	.dr_create_flow_action_push_vlan =
1340 		mlx5_glue_dr_create_flow_action_push_vlan,
1341 	.dr_create_flow_action_pop_vlan =
1342 		mlx5_glue_dr_create_flow_action_pop_vlan,
1343 	.dr_create_flow_tbl = mlx5_glue_dr_create_flow_tbl,
1344 	.dr_destroy_flow_tbl = mlx5_glue_dr_destroy_flow_tbl,
1345 	.dr_create_domain = mlx5_glue_dr_create_domain,
1346 	.dr_destroy_domain = mlx5_glue_dr_destroy_domain,
1347 	.dr_sync_domain = mlx5_glue_dr_sync_domain,
1348 	.dv_create_cq = mlx5_glue_dv_create_cq,
1349 	.dv_create_wq = mlx5_glue_dv_create_wq,
1350 	.dv_query_device = mlx5_glue_dv_query_device,
1351 	.dv_set_context_attr = mlx5_glue_dv_set_context_attr,
1352 	.dv_init_obj = mlx5_glue_dv_init_obj,
1353 	.dv_create_qp = mlx5_glue_dv_create_qp,
1354 	.dv_create_flow_matcher = mlx5_glue_dv_create_flow_matcher,
1355 	.dv_create_flow = mlx5_glue_dv_create_flow,
1356 	.dv_create_flow_action_counter =
1357 		mlx5_glue_dv_create_flow_action_counter,
1358 	.dv_create_flow_action_dest_ibv_qp =
1359 		mlx5_glue_dv_create_flow_action_dest_ibv_qp,
1360 	.dv_create_flow_action_dest_devx_tir =
1361 		mlx5_glue_dv_create_flow_action_dest_devx_tir,
1362 	.dv_create_flow_action_modify_header =
1363 		mlx5_glue_dv_create_flow_action_modify_header,
1364 	.dv_create_flow_action_packet_reformat =
1365 		mlx5_glue_dv_create_flow_action_packet_reformat,
1366 	.dv_create_flow_action_tag =  mlx5_glue_dv_create_flow_action_tag,
1367 	.dv_create_flow_action_meter = mlx5_glue_dv_create_flow_action_meter,
1368 	.dv_modify_flow_action_meter = mlx5_glue_dv_modify_flow_action_meter,
1369 	.dr_create_flow_action_default_miss =
1370 		mlx5_glue_dr_create_flow_action_default_miss,
1371 	.dv_destroy_flow = mlx5_glue_dv_destroy_flow,
1372 	.dv_destroy_flow_matcher = mlx5_glue_dv_destroy_flow_matcher,
1373 	.dv_open_device = mlx5_glue_dv_open_device,
1374 	.devx_obj_create = mlx5_glue_devx_obj_create,
1375 	.devx_obj_destroy = mlx5_glue_devx_obj_destroy,
1376 	.devx_obj_query = mlx5_glue_devx_obj_query,
1377 	.devx_obj_modify = mlx5_glue_devx_obj_modify,
1378 	.devx_general_cmd = mlx5_glue_devx_general_cmd,
1379 	.devx_create_cmd_comp = mlx5_glue_devx_create_cmd_comp,
1380 	.devx_destroy_cmd_comp = mlx5_glue_devx_destroy_cmd_comp,
1381 	.devx_obj_query_async = mlx5_glue_devx_obj_query_async,
1382 	.devx_get_async_cmd_comp = mlx5_glue_devx_get_async_cmd_comp,
1383 	.devx_umem_reg = mlx5_glue_devx_umem_reg,
1384 	.devx_umem_dereg = mlx5_glue_devx_umem_dereg,
1385 	.devx_qp_query = mlx5_glue_devx_qp_query,
1386 	.devx_port_query = mlx5_glue_devx_port_query,
1387 	.dr_dump_domain = mlx5_glue_dr_dump_domain,
1388 	.dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory,
1389 	.dr_create_flow_action_sampler =
1390 		mlx5_glue_dr_create_flow_action_sampler,
1391 	.dr_create_flow_action_dest_array =
1392 		mlx5_glue_dr_action_create_dest_array,
1393 	.devx_query_eqn = mlx5_glue_devx_query_eqn,
1394 	.devx_create_event_channel = mlx5_glue_devx_create_event_channel,
1395 	.devx_destroy_event_channel = mlx5_glue_devx_destroy_event_channel,
1396 	.devx_subscribe_devx_event = mlx5_glue_devx_subscribe_devx_event,
1397 	.devx_subscribe_devx_event_fd = mlx5_glue_devx_subscribe_devx_event_fd,
1398 	.devx_get_event = mlx5_glue_devx_get_event,
1399 	.devx_alloc_uar = mlx5_glue_devx_alloc_uar,
1400 	.devx_free_uar = mlx5_glue_devx_free_uar,
1401 	.dv_alloc_var = mlx5_glue_dv_alloc_var,
1402 	.dv_free_var = mlx5_glue_dv_free_var,
1403 	.dv_alloc_pp = mlx5_glue_dv_alloc_pp,
1404 	.dv_free_pp = mlx5_glue_dv_free_pp,
1405 };
1406