rdma: optimize tx wqe_init
[vpp.git] / src / plugins / rdma / output.c
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17
18 #include <vlib/vlib.h>
19 #include <vlib/unix/unix.h>
20 #include <vlib/pci/pci.h>
21 #include <vppinfra/ring.h>
22 #include <vnet/ethernet/ethernet.h>
23 #include <vnet/devices/devices.h>
24 #include <rdma/rdma.h>
25
26 #define RDMA_TX_RETRIES 5
27
28 #define RDMA_TXQ_DV_DSEG_SZ(txq)        (RDMA_MLX5_WQE_DS * RDMA_TXQ_DV_SQ_SZ(txq))
29 #define RDMA_TXQ_DV_DSEG2WQE(d)         (((d) + RDMA_MLX5_WQE_DS - 1) / RDMA_MLX5_WQE_DS)
30
31 /*
32  * MLX5 direct verbs tx/free functions
33  */
34
35 static_always_inline void
36 rdma_device_output_free_mlx5 (vlib_main_t * vm,
37                               const vlib_node_runtime_t * node,
38                               rdma_txq_t * txq)
39 {
40   u16 idx = txq->dv_cq_idx;
41   u32 cq_mask = pow2_mask (txq->dv_cq_log2sz);
42   u32 sq_mask = pow2_mask (txq->dv_sq_log2sz);
43   u32 mask = pow2_mask (txq->bufs_log2sz);
44   u32 buf_sz = RDMA_TXQ_BUF_SZ (txq);
45   u32 log2_cq_sz = txq->dv_cq_log2sz;
46   struct mlx5_cqe64 *cqes = txq->dv_cq_cqes, *cur = cqes + (idx & cq_mask);
47   u8 op_own, saved;
48   const rdma_mlx5_wqe_t *wqe;
49
50   for (;;)
51     {
52       op_own = *(volatile u8 *) &cur->op_own;
53       if (((idx >> log2_cq_sz) & MLX5_CQE_OWNER_MASK) !=
54           (op_own & MLX5_CQE_OWNER_MASK) || (op_own >> 4) == MLX5_CQE_INVALID)
55         break;
56       if (PREDICT_FALSE ((op_own >> 4)) != MLX5_CQE_REQ)
57         vlib_error_count (vm, node->node_index, RDMA_TX_ERROR_COMPLETION, 1);
58       idx++;
59       cur = cqes + (idx & cq_mask);
60     }
61
62   if (idx == txq->dv_cq_idx)
63     return;                     /* nothing to do */
64
65   cur = cqes + ((idx - 1) & cq_mask);
66   saved = cur->op_own;
67   (void) saved;
68   cur->op_own = 0xf0;
69   txq->dv_cq_idx = idx;
70
71   /* retrieve original WQE and get new tail counter */
72   wqe = txq->dv_sq_wqes + (be16toh (cur->wqe_counter) & sq_mask);
73   if (PREDICT_FALSE (wqe->ctrl.imm == RDMA_TXQ_DV_INVALID_ID))
74     return;                     /* can happen if CQE reports error for an intermediate WQE */
75
76   ASSERT (RDMA_TXQ_USED_SZ (txq->head, wqe->ctrl.imm) <= buf_sz &&
77           RDMA_TXQ_USED_SZ (wqe->ctrl.imm, txq->tail) < buf_sz);
78
79   /* free sent buffers and update txq head */
80   vlib_buffer_free_from_ring (vm, txq->bufs, txq->head & mask, buf_sz,
81                               RDMA_TXQ_USED_SZ (txq->head, wqe->ctrl.imm));
82   txq->head = wqe->ctrl.imm;
83
84   /* ring doorbell */
85   CLIB_MEMORY_STORE_BARRIER ();
86   txq->dv_cq_dbrec[0] = htobe32 (idx);
87 }
88
89 static_always_inline void
90 rdma_device_output_tx_mlx5_doorbell (rdma_txq_t * txq, rdma_mlx5_wqe_t * last,
91                                      const u16 tail, u32 sq_mask)
92 {
93   last->ctrl.imm = tail;        /* register item to free */
94   last->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;        /* generate a CQE so we can free buffers */
95
96   ASSERT (tail != txq->tail &&
97           RDMA_TXQ_AVAIL_SZ (txq, txq->head, txq->tail) >=
98           RDMA_TXQ_USED_SZ (txq->tail, tail));
99
100   CLIB_MEMORY_STORE_BARRIER ();
101   txq->dv_sq_dbrec[MLX5_SND_DBR] = htobe32 (tail);
102   CLIB_COMPILER_BARRIER ();
103   txq->dv_sq_db[0] = *(u64 *) (txq->dv_sq_wqes + (txq->tail & sq_mask));
104   txq->tail = tail;
105 }
106
107 static_always_inline void
108 rdma_mlx5_wqe_init (rdma_mlx5_wqe_t * wqe, const void *tmpl,
109                     vlib_buffer_t * b, const u16 tail)
110 {
111   u16 sz = b->current_length;
112   const void *cur = vlib_buffer_get_current (b);
113   uword addr = pointer_to_uword (cur);
114
115   clib_memcpy_fast (wqe, tmpl, RDMA_MLX5_WQE_SZ);
116   /* speculatively copy at least MLX5_ETH_L2_INLINE_HEADER_SIZE (18-bytes) */
117   clib_memcpy_fast (wqe->eseg.inline_hdr_start,
118                     cur, MLX5_ETH_L2_INLINE_HEADER_SIZE);
119
120   wqe->wqe_index_lo = tail;
121   wqe->wqe_index_hi = tail >> 8;
122   if (PREDICT_TRUE (sz >= MLX5_ETH_L2_INLINE_HEADER_SIZE))
123     {
124       /* inline_hdr_sz is set to MLX5_ETH_L2_INLINE_HEADER_SIZE
125          in the template */
126       wqe->dseg.byte_count = htobe32 (sz - MLX5_ETH_L2_INLINE_HEADER_SIZE);
127       wqe->dseg.addr = htobe64 (addr + MLX5_ETH_L2_INLINE_HEADER_SIZE);
128     }
129   else
130     {
131       /* dseg.byte_count and desg.addr are set to 0 in the template */
132       wqe->eseg.inline_hdr_sz = htobe16 (sz);
133     }
134 }
135
136 /*
137  * specific data path for chained buffers, supporting ring wrap-around
138  * contrary to the normal path - otherwise we may fail to enqueue chained
139  * buffers because we are close to the end of the ring while we still have
140  * plenty of descriptors available
141  */
142 static_always_inline u32
143 rdma_device_output_tx_mlx5_chained (vlib_main_t * vm,
144                                     const vlib_node_runtime_t * node,
145                                     const rdma_device_t * rd,
146                                     rdma_txq_t * txq, u32 n_left_from, u32 n,
147                                     u32 * bi, vlib_buffer_t ** b,
148                                     rdma_mlx5_wqe_t * wqe, u16 tail)
149 {
150   rdma_mlx5_wqe_t *last = wqe;
151   u32 wqe_n = RDMA_TXQ_AVAIL_SZ (txq, txq->head, tail);
152   u32 sq_mask = pow2_mask (txq->dv_sq_log2sz);
153   u32 mask = pow2_mask (txq->bufs_log2sz);
154   u32 dseg_mask = RDMA_TXQ_DV_DSEG_SZ (txq) - 1;
155   const u32 lkey = wqe[0].dseg.lkey;
156
157   vlib_buffer_copy_indices (txq->bufs + (txq->tail & mask), bi,
158                             n_left_from - n);
159
160   while (n >= 1 && wqe_n >= 1)
161     {
162       u32 *bufs = txq->bufs + (tail & mask);
163       rdma_mlx5_wqe_t *wqe = txq->dv_sq_wqes + (tail & sq_mask);
164
165       /* setup the head WQE */
166       rdma_mlx5_wqe_init (wqe, txq->dv_wqe_tmpl, b[0], tail);
167
168       bufs[0] = bi[0];
169
170       if (b[0]->flags & VLIB_BUFFER_NEXT_PRESENT)
171         {
172           /*
173            * max number of available dseg:
174            *  - 4 dseg per WQEBB available
175            *  - max 32 dseg per WQE (5-bits length field in WQE ctrl)
176            */
177 #define RDMA_MLX5_WQE_DS_MAX    (1 << 5)
178           const u32 dseg_max =
179             clib_min (RDMA_MLX5_WQE_DS * (wqe_n - 1), RDMA_MLX5_WQE_DS_MAX);
180           vlib_buffer_t *chained_b = b[0];
181           u32 chained_n = 0;
182
183           /* there are exactly 4 dseg per WQEBB and we rely on that */
184           STATIC_ASSERT (RDMA_MLX5_WQE_DS *
185                          sizeof (struct mlx5_wqe_data_seg) ==
186                          MLX5_SEND_WQE_BB, "wrong size");
187
188           /*
189            * iterate over fragments, supporting ring wrap-around contrary to
190            * the normal path - otherwise we may fail to enqueue chained
191            * buffers because we are close to the end of the ring while we
192            * still have plenty of descriptors available
193            */
194           while (chained_n < dseg_max
195                  && chained_b->flags & VLIB_BUFFER_NEXT_PRESENT)
196             {
197               struct mlx5_wqe_data_seg *dseg = (void *) txq->dv_sq_wqes;
198               dseg += ((tail + 1) * RDMA_MLX5_WQE_DS + chained_n) & dseg_mask;
199               if (((clib_address_t) dseg & (MLX5_SEND_WQE_BB - 1)) == 0)
200                 {
201                   /*
202                    * start of new WQEBB
203                    * head/tail are shared between buffers and descriptor
204                    * In order to maintain 1:1 correspondance between
205                    * buffer index and descriptor index, we build
206                    * 4-fragments chains and save the head
207                    */
208                   chained_b->flags &= ~(VLIB_BUFFER_NEXT_PRESENT |
209                                         VLIB_BUFFER_TOTAL_LENGTH_VALID);
210                   u32 idx = tail + 1 + RDMA_TXQ_DV_DSEG2WQE (chained_n);
211                   idx &= mask;
212                   txq->bufs[idx] = chained_b->next_buffer;
213                 }
214
215               chained_b = vlib_get_buffer (vm, chained_b->next_buffer);
216               dseg->byte_count = htobe32 (chained_b->current_length);
217               dseg->lkey = lkey;
218               dseg->addr = htobe64 (vlib_buffer_get_current_va (chained_b));
219
220               chained_n += 1;
221             }
222
223           if (chained_b->flags & VLIB_BUFFER_NEXT_PRESENT)
224             {
225               /*
226                * no descriptors left: drop the chain including 1st WQE
227                * skip the problematic packet and continue
228                */
229               vlib_buffer_free_from_ring (vm, txq->bufs, tail & mask,
230                                           RDMA_TXQ_BUF_SZ (txq), 1 +
231                                           RDMA_TXQ_DV_DSEG2WQE (chained_n));
232               vlib_error_count (vm, node->node_index,
233                                 dseg_max == chained_n ?
234                                 RDMA_TX_ERROR_SEGMENT_SIZE_EXCEEDED :
235                                 RDMA_TX_ERROR_NO_FREE_SLOTS, 1);
236
237               /* fixup tail to overwrite wqe head with next packet */
238               tail -= 1;
239             }
240           else
241             {
242               /* update WQE descriptor with new dseg number */
243               ((u8 *) & wqe[0].ctrl.qpn_ds)[3] = RDMA_MLX5_WQE_DS + chained_n;
244
245               tail += RDMA_TXQ_DV_DSEG2WQE (chained_n);
246               wqe_n -= RDMA_TXQ_DV_DSEG2WQE (chained_n);
247
248               last = wqe;
249             }
250         }
251       else
252         {
253           /* not chained */
254           last = wqe;
255         }
256
257       tail += 1;
258       bi += 1;
259       b += 1;
260       wqe_n -= 1;
261       n -= 1;
262     }
263
264   if (n == n_left_from)
265     return 0;                   /* we fail to enqueue even a single packet */
266
267   rdma_device_output_tx_mlx5_doorbell (txq, last, tail, sq_mask);
268   return n_left_from - n;
269 }
270
271 static_always_inline u32
272 rdma_device_output_tx_mlx5 (vlib_main_t * vm,
273                             const vlib_node_runtime_t * node,
274                             const rdma_device_t * rd, rdma_txq_t * txq,
275                             const u32 n_left_from, u32 * bi,
276                             vlib_buffer_t ** b)
277 {
278   u32 sq_mask = pow2_mask (txq->dv_sq_log2sz);
279   u32 mask = pow2_mask (txq->bufs_log2sz);
280   rdma_mlx5_wqe_t *wqe = txq->dv_sq_wqes + (txq->tail & sq_mask);
281   u32 n = n_left_from;
282   u16 tail = txq->tail;
283
284   ASSERT (RDMA_TXQ_BUF_SZ (txq) <= RDMA_TXQ_DV_SQ_SZ (txq));
285
286   while (n >= 4)
287     {
288       u32 flags = b[0]->flags | b[1]->flags | b[2]->flags | b[3]->flags;
289       if (PREDICT_FALSE (flags & VLIB_BUFFER_NEXT_PRESENT))
290         return rdma_device_output_tx_mlx5_chained (vm, node, rd, txq,
291                                                    n_left_from, n, bi, b, wqe,
292                                                    tail);
293
294       if (PREDICT_TRUE (n >= 8))
295         {
296           vlib_prefetch_buffer_header (b + 4, LOAD);
297           vlib_prefetch_buffer_header (b + 5, LOAD);
298           vlib_prefetch_buffer_header (b + 6, LOAD);
299           vlib_prefetch_buffer_header (b + 7, LOAD);
300           clib_prefetch_load (wqe + 4);
301         }
302
303       rdma_mlx5_wqe_init (wqe + 0, txq->dv_wqe_tmpl, b[0], tail + 0);
304       rdma_mlx5_wqe_init (wqe + 1, txq->dv_wqe_tmpl, b[1], tail + 1);
305       rdma_mlx5_wqe_init (wqe + 2, txq->dv_wqe_tmpl, b[2], tail + 2);
306       rdma_mlx5_wqe_init (wqe + 3, txq->dv_wqe_tmpl, b[3], tail + 3);
307
308       b += 4;
309       tail += 4;
310       wqe += 4;
311       n -= 4;
312     }
313
314   while (n >= 1)
315     {
316       if (PREDICT_FALSE (b[0]->flags & VLIB_BUFFER_NEXT_PRESENT))
317         return rdma_device_output_tx_mlx5_chained (vm, node, rd, txq,
318                                                    n_left_from, n, bi, b, wqe,
319                                                    tail);
320
321       rdma_mlx5_wqe_init (wqe, txq->dv_wqe_tmpl, b[0], tail);
322
323       b += 1;
324       tail += 1;
325       wqe += 1;
326       n -= 1;
327     }
328
329   vlib_buffer_copy_indices (txq->bufs + (txq->tail & mask), bi, n_left_from);
330
331   rdma_device_output_tx_mlx5_doorbell (txq, &wqe[-1], tail, sq_mask);
332   return n_left_from;
333 }
334
335 /*
336  * standard ibverb tx/free functions
337  */
338
339 static_always_inline void
340 rdma_device_output_free_ibverb (vlib_main_t * vm,
341                                 const vlib_node_runtime_t * node,
342                                 rdma_txq_t * txq)
343 {
344   struct ibv_wc wc[VLIB_FRAME_SIZE];
345   u32 mask = pow2_mask (txq->bufs_log2sz);
346   u16 tail;
347   int n;
348
349   n = ibv_poll_cq (txq->ibv_cq, VLIB_FRAME_SIZE, wc);
350   if (n <= 0)
351     {
352       if (PREDICT_FALSE (n < 0))
353         vlib_error_count (vm, node->node_index, RDMA_TX_ERROR_COMPLETION, 1);
354       return;
355     }
356
357   while (PREDICT_FALSE (IBV_WC_SUCCESS != wc[n - 1].status))
358     {
359       vlib_error_count (vm, node->node_index, RDMA_TX_ERROR_COMPLETION, 1);
360       n--;
361       if (0 == n)
362         return;
363     }
364
365   tail = wc[n - 1].wr_id;
366   vlib_buffer_free_from_ring (vm, txq->bufs, txq->head & mask,
367                               RDMA_TXQ_BUF_SZ (txq),
368                               RDMA_TXQ_USED_SZ (txq->head, tail));
369   txq->head = tail;
370 }
371
372 static_always_inline u32
373 rdma_device_output_tx_ibverb (vlib_main_t * vm,
374                               const vlib_node_runtime_t * node,
375                               const rdma_device_t * rd, rdma_txq_t * txq,
376                               u32 n_left_from, u32 * bi, vlib_buffer_t ** b)
377 {
378   struct ibv_send_wr wr[VLIB_FRAME_SIZE], *w = wr;
379   struct ibv_sge sge[VLIB_FRAME_SIZE], *s = sge;
380   u32 mask = txq->bufs_log2sz;
381   u32 n = n_left_from;
382
383   memset (w, 0, n_left_from * sizeof (w[0]));
384
385   while (n >= 4)
386     {
387       if (PREDICT_TRUE (n >= 8))
388         {
389           vlib_prefetch_buffer_header (b[4 + 0], LOAD);
390           vlib_prefetch_buffer_header (b[4 + 1], LOAD);
391           vlib_prefetch_buffer_header (b[4 + 2], LOAD);
392           vlib_prefetch_buffer_header (b[4 + 3], LOAD);
393
394           CLIB_PREFETCH (&s[4 + 0], 4 * sizeof (s[0]), STORE);
395
396           CLIB_PREFETCH (&w[4 + 0], CLIB_CACHE_LINE_BYTES, STORE);
397           CLIB_PREFETCH (&w[4 + 1], CLIB_CACHE_LINE_BYTES, STORE);
398           CLIB_PREFETCH (&w[4 + 2], CLIB_CACHE_LINE_BYTES, STORE);
399           CLIB_PREFETCH (&w[4 + 3], CLIB_CACHE_LINE_BYTES, STORE);
400         }
401
402       s[0].addr = vlib_buffer_get_current_va (b[0]);
403       s[0].length = b[0]->current_length;
404       s[0].lkey = rd->lkey;
405
406       s[1].addr = vlib_buffer_get_current_va (b[1]);
407       s[1].length = b[1]->current_length;
408       s[1].lkey = rd->lkey;
409
410       s[2].addr = vlib_buffer_get_current_va (b[2]);
411       s[2].length = b[2]->current_length;
412       s[2].lkey = rd->lkey;
413
414       s[3].addr = vlib_buffer_get_current_va (b[3]);
415       s[3].length = b[3]->current_length;
416       s[3].lkey = rd->lkey;
417
418       w[0].next = &w[0] + 1;
419       w[0].sg_list = &s[0];
420       w[0].num_sge = 1;
421       w[0].opcode = IBV_WR_SEND;
422
423       w[1].next = &w[1] + 1;
424       w[1].sg_list = &s[1];
425       w[1].num_sge = 1;
426       w[1].opcode = IBV_WR_SEND;
427
428       w[2].next = &w[2] + 1;
429       w[2].sg_list = &s[2];
430       w[2].num_sge = 1;
431       w[2].opcode = IBV_WR_SEND;
432
433       w[3].next = &w[3] + 1;
434       w[3].sg_list = &s[3];
435       w[3].num_sge = 1;
436       w[3].opcode = IBV_WR_SEND;
437
438       s += 4;
439       w += 4;
440       b += 4;
441       n -= 4;
442     }
443
444   while (n >= 1)
445     {
446       s[0].addr = vlib_buffer_get_current_va (b[0]);
447       s[0].length = b[0]->current_length;
448       s[0].lkey = rd->lkey;
449
450       w[0].next = &w[0] + 1;
451       w[0].sg_list = &s[0];
452       w[0].num_sge = 1;
453       w[0].opcode = IBV_WR_SEND;
454
455       s += 1;
456       w += 1;
457       b += 1;
458       n -= 1;
459     }
460
461   w[-1].wr_id = txq->tail;      /* register item to free */
462   w[-1].next = 0;               /* fix next pointer in WR linked-list */
463   w[-1].send_flags = IBV_SEND_SIGNALED; /* generate a CQE so we can free buffers */
464
465   w = wr;
466   if (PREDICT_FALSE (0 != ibv_post_send (txq->ibv_qp, w, &w)))
467     {
468       vlib_error_count (vm, node->node_index, RDMA_TX_ERROR_SUBMISSION,
469                         n_left_from - (w - wr));
470       n_left_from = w - wr;
471     }
472
473   vlib_buffer_copy_indices (txq->bufs + (txq->tail & mask), bi, n_left_from);
474   txq->tail += n_left_from;
475   return n_left_from;
476 }
477
478 /*
479  * common tx/free functions
480  */
481
482 static_always_inline void
483 rdma_device_output_free (vlib_main_t * vm, const vlib_node_runtime_t * node,
484                          rdma_txq_t * txq, int is_mlx5dv)
485 {
486   if (is_mlx5dv)
487     rdma_device_output_free_mlx5 (vm, node, txq);
488   else
489     rdma_device_output_free_ibverb (vm, node, txq);
490 }
491
492 static_always_inline u32
493 rdma_device_output_tx_try (vlib_main_t * vm, const vlib_node_runtime_t * node,
494                            const rdma_device_t * rd, rdma_txq_t * txq,
495                            u32 n_left_from, u32 * bi, int is_mlx5dv)
496 {
497   vlib_buffer_t *b[VLIB_FRAME_SIZE];
498   u32 mask = pow2_mask (txq->bufs_log2sz);
499
500   /* do not enqueue more packet than ring space */
501   n_left_from = clib_min (n_left_from, RDMA_TXQ_AVAIL_SZ (txq, txq->head,
502                                                           txq->tail));
503   /* avoid wrap-around logic in core loop */
504   n_left_from = clib_min (n_left_from, RDMA_TXQ_BUF_SZ (txq) -
505                           (txq->tail & mask));
506
507   /* if ring is full, do nothing */
508   if (PREDICT_FALSE (n_left_from == 0))
509     return 0;
510
511   vlib_get_buffers (vm, bi, b, n_left_from);
512
513   return is_mlx5dv ?
514     rdma_device_output_tx_mlx5 (vm, node, rd, txq, n_left_from, bi, b) :
515     rdma_device_output_tx_ibverb (vm, node, rd, txq, n_left_from, bi, b);
516 }
517
518 static_always_inline uword
519 rdma_device_output_tx (vlib_main_t * vm, vlib_node_runtime_t * node,
520                        vlib_frame_t * frame, rdma_device_t * rd,
521                        int is_mlx5dv)
522 {
523   u32 thread_index = vm->thread_index;
524   rdma_txq_t *txq =
525     vec_elt_at_index (rd->txqs, thread_index % vec_len (rd->txqs));
526   u32 *from;
527   u32 n_left_from;
528   int i;
529
530   ASSERT (RDMA_TXQ_BUF_SZ (txq) >= VLIB_FRAME_SIZE);
531
532   from = vlib_frame_vector_args (frame);
533   n_left_from = frame->n_vectors;
534
535   clib_spinlock_lock_if_init (&txq->lock);
536
537   for (i = 0; i < RDMA_TX_RETRIES && n_left_from > 0; i++)
538     {
539       u32 n_enq;
540       rdma_device_output_free (vm, node, txq, is_mlx5dv);
541       n_enq = rdma_device_output_tx_try (vm, node, rd, txq, n_left_from, from,
542                                          is_mlx5dv);
543
544       n_left_from -= n_enq;
545       from += n_enq;
546     }
547
548   clib_spinlock_unlock_if_init (&txq->lock);
549
550   if (PREDICT_FALSE (n_left_from))
551     {
552       vlib_buffer_free (vm, from, n_left_from);
553       vlib_error_count (vm, node->node_index,
554                         RDMA_TX_ERROR_NO_FREE_SLOTS, n_left_from);
555     }
556
557   return frame->n_vectors - n_left_from;
558 }
559
560 VNET_DEVICE_CLASS_TX_FN (rdma_device_class) (vlib_main_t * vm,
561                                              vlib_node_runtime_t * node,
562                                              vlib_frame_t * frame)
563 {
564   rdma_main_t *rm = &rdma_main;
565   vnet_interface_output_runtime_t *ord = (void *) node->runtime_data;
566   rdma_device_t *rd = pool_elt_at_index (rm->devices, ord->dev_instance);
567
568   if (PREDICT_TRUE (rd->flags & RDMA_DEVICE_F_MLX5DV))
569     return rdma_device_output_tx (vm, node, frame, rd, 1 /* is_mlx5dv */ );
570
571   return rdma_device_output_tx (vm, node, frame, rd, 0 /* is_mlx5dv */ );
572 }
573
574 /*
575  * fd.io coding-style-patch-verification: ON
576  *
577  * Local Variables:
578  * eval: (c-set-style "gnu")
579  * End:
580  */