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