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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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 *------------------------------------------------------------------
21 #include <linux/if_link.h>
22 #include <linux/if_ether.h>
24 #include <vppinfra/linux/sysfs.h>
25 #include <vlib/vlib.h>
26 #include <vlib/unix/unix.h>
27 #include <vlib/pci/pci.h>
28 #include <vnet/ethernet/ethernet.h>
30 #include <rdma/rdma.h>
32 /* Default RSS hash key (from DPDK MLX driver) */
33 static u8 rdma_rss_hash_key[] = {
34 0x2c, 0xc6, 0x81, 0xd1,
35 0x5b, 0xdb, 0xf4, 0xf7,
36 0xfc, 0xa2, 0x83, 0x19,
37 0xdb, 0x1a, 0x3e, 0x94,
38 0x6b, 0x9e, 0x38, 0xd9,
39 0x2c, 0x9c, 0x03, 0xd1,
40 0xad, 0x99, 0x44, 0xa7,
41 0xd9, 0x56, 0x3d, 0x59,
42 0x06, 0x3c, 0x25, 0xf3,
43 0xfc, 0x1f, 0xdc, 0x2a,
46 rdma_main_t rdma_main;
48 #define rdma_log__(lvl, dev, f, ...) \
50 vlib_log((lvl), rdma_main.log_class, "%s: " f, \
51 &(dev)->name, ##__VA_ARGS__); \
54 #define rdma_log(lvl, dev, f, ...) \
55 rdma_log__((lvl), (dev), "%s (%d): " f, strerror(errno), errno, ##__VA_ARGS__)
57 static struct ibv_flow *
58 rdma_rxq_init_flow (const rdma_device_t * rd, struct ibv_qp *qp,
59 const mac_address_t * mac, const mac_address_t * mask,
62 struct ibv_flow *flow;
63 struct raw_eth_flow_attr
65 struct ibv_flow_attr attr;
66 struct ibv_flow_spec_eth spec_eth;
67 } __attribute__ ((packed)) fa;
69 memset (&fa, 0, sizeof (fa));
70 fa.attr.num_of_specs = 1;
72 fa.attr.flags = flags;
73 fa.spec_eth.type = IBV_FLOW_SPEC_ETH;
74 fa.spec_eth.size = sizeof (struct ibv_flow_spec_eth);
76 memcpy (fa.spec_eth.val.dst_mac, mac, sizeof (fa.spec_eth.val.dst_mac));
77 memcpy (fa.spec_eth.mask.dst_mac, mask, sizeof (fa.spec_eth.mask.dst_mac));
79 flow = ibv_create_flow (qp, &fa.attr);
81 rdma_log (VLIB_LOG_LEVEL_ERR, rd, "ibv_create_flow() failed");
86 rdma_rxq_destroy_flow (const rdma_device_t * rd, struct ibv_flow **flow)
91 if (ibv_destroy_flow (*flow))
93 rdma_log (VLIB_LOG_LEVEL_ERR, rd, "ibv_destroy_flow() failed");
102 rdma_dev_set_promisc (rdma_device_t * rd)
104 const mac_address_t all = {.bytes = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0} };
107 err = rdma_rxq_destroy_flow (rd, &rd->flow_mcast);
111 err = rdma_rxq_destroy_flow (rd, &rd->flow_ucast);
115 rd->flow_ucast = rdma_rxq_init_flow (rd, rd->rx_qp, &all, &all, 0);
119 rd->flags |= RDMA_DEVICE_F_PROMISC;
124 rdma_dev_set_ucast (rdma_device_t * rd)
126 const mac_address_t ucast = {.bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
128 const mac_address_t mcast = {.bytes = {0x1, 0x0, 0x0, 0x0, 0x0, 0x0} };
131 err = rdma_rxq_destroy_flow (rd, &rd->flow_mcast);
135 err = rdma_rxq_destroy_flow (rd, &rd->flow_ucast);
139 /* receive only packets with src = our MAC */
140 rd->flow_ucast = rdma_rxq_init_flow (rd, rd->rx_qp, &rd->hwaddr, &ucast, 0);
144 /* receive multicast packets */
145 rd->flow_mcast = rdma_rxq_init_flow (rd, rd->rx_qp, &mcast, &mcast,
146 IBV_FLOW_ATTR_FLAGS_DONT_TRAP
147 /* let others receive mcast packet too (eg. Linux) */
152 rd->flags &= ~RDMA_DEVICE_F_PROMISC;
156 static clib_error_t *
157 rdma_mac_change (vnet_hw_interface_t * hw, const u8 * old, const u8 * new)
159 rdma_main_t *rm = &rdma_main;
160 rdma_device_t *rd = vec_elt_at_index (rm->devices, hw->dev_instance);
161 mac_address_from_bytes (&rd->hwaddr, new);
162 if (!(rd->flags & RDMA_DEVICE_F_PROMISC) && rdma_dev_set_ucast (rd))
164 mac_address_from_bytes (&rd->hwaddr, old);
165 return clib_error_return_unix (0, "MAC update failed");
171 rdma_dev_change_mtu (rdma_device_t * rd)
173 rdma_log__ (VLIB_LOG_LEVEL_ERR, rd, "MTU change not supported");
178 rdma_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hw, u32 flags)
180 rdma_main_t *rm = &rdma_main;
181 rdma_device_t *rd = vec_elt_at_index (rm->devices, hw->dev_instance);
186 return rdma_dev_set_ucast (rd);
187 case ETHERNET_INTERFACE_FLAG_ACCEPT_ALL:
188 return rdma_dev_set_promisc (rd);
189 case ETHERNET_INTERFACE_FLAG_MTU:
190 return rdma_dev_change_mtu (rd);
193 rdma_log__ (VLIB_LOG_LEVEL_ERR, rd, "unknown flag %x requested", flags);
198 rdma_update_state (vnet_main_t * vnm, rdma_device_t * rd, int port)
200 struct ibv_port_attr attr;
204 if (ibv_query_port (rd->ctx, port, &attr))
206 vnet_hw_interface_set_link_speed (vnm, rd->hw_if_index, 0);
207 vnet_hw_interface_set_flags (vnm, rd->hw_if_index, 0);
214 case IBV_PORT_ACTIVE: /* fallthrough */
215 case IBV_PORT_ACTIVE_DEFER:
216 rd->flags |= RDMA_DEVICE_F_LINK_UP;
217 vnet_hw_interface_set_flags (vnm, rd->hw_if_index,
218 VNET_HW_INTERFACE_FLAG_LINK_UP);
221 rd->flags &= ~RDMA_DEVICE_F_LINK_UP;
222 vnet_hw_interface_set_flags (vnm, rd->hw_if_index, 0);
227 switch (attr.active_width)
242 switch (attr.active_speed)
250 case 4: /* fallthrough */
261 vnet_hw_interface_set_link_speed (vnm, rd->hw_if_index, width * speed);
264 static clib_error_t *
265 rdma_async_event_error_ready (clib_file_t * f)
267 rdma_main_t *rm = &rdma_main;
268 rdma_device_t *rd = vec_elt_at_index (rm->devices, f->private_data);
269 return clib_error_return (0, "RDMA async event error for device %U",
270 format_vlib_pci_addr, &rd->pci_addr);
273 static clib_error_t *
274 rdma_async_event_read_ready (clib_file_t * f)
276 vnet_main_t *vnm = vnet_get_main ();
277 rdma_main_t *rm = &rdma_main;
278 rdma_device_t *rd = vec_elt_at_index (rm->devices, f->private_data);
280 struct ibv_async_event event;
281 ret = ibv_get_async_event (rd->ctx, &event);
283 return clib_error_return_unix (0, "ibv_get_async_event() failed");
285 switch (event.event_type)
287 case IBV_EVENT_PORT_ACTIVE:
288 rdma_update_state (vnm, rd, event.element.port_num);
290 case IBV_EVENT_PORT_ERR:
291 rdma_update_state (vnm, rd, event.element.port_num);
293 case IBV_EVENT_DEVICE_FATAL:
294 rd->flags &= ~RDMA_DEVICE_F_LINK_UP;
295 vnet_hw_interface_set_flags (vnm, rd->hw_if_index, 0);
296 vlib_log_emerg (rm->log_class, "Fatal RDMA error for device %U",
297 format_vlib_pci_addr, &rd->pci_addr);
300 rdma_log__ (VLIB_LOG_LEVEL_ERR, rd, "unhandeld RDMA async event %i",
305 ibv_ack_async_event (&event);
309 static clib_error_t *
310 rdma_async_event_init (rdma_device_t * rd)
312 clib_file_t t = { 0 };
315 /* make RDMA async event fd non-blocking */
316 ret = fcntl (rd->ctx->async_fd, F_GETFL);
318 return clib_error_return_unix (0, "fcntl(F_GETFL) failed");
320 ret = fcntl (rd->ctx->async_fd, F_SETFL, ret | O_NONBLOCK);
322 return clib_error_return_unix (0, "fcntl(F_SETFL, O_NONBLOCK) failed");
324 /* register RDMA async event fd */
325 t.read_function = rdma_async_event_read_ready;
326 t.file_descriptor = rd->ctx->async_fd;
327 t.error_function = rdma_async_event_error_ready;
328 t.private_data = rd->dev_instance;
330 format (0, "RMDA %U async event", format_vlib_pci_addr, &rd->pci_addr);
332 rd->async_event_clib_file_index = clib_file_add (&file_main, &t);
337 rdma_async_event_cleanup (rdma_device_t * rd)
339 clib_file_del_by_index (&file_main, rd->async_event_clib_file_index);
342 static clib_error_t *
343 rdma_register_interface (vnet_main_t * vnm, rdma_device_t * rd)
345 return ethernet_register_interface (vnm, rdma_device_class.index,
346 rd->dev_instance, rd->hwaddr.bytes,
347 &rd->hw_if_index, rdma_flag_change);
351 rdma_unregister_interface (vnet_main_t * vnm, rdma_device_t * rd)
353 vnet_hw_interface_set_flags (vnm, rd->hw_if_index, 0);
354 vnet_hw_interface_unassign_rx_thread (vnm, rd->hw_if_index, 0);
355 ethernet_delete_interface (vnm, rd->hw_if_index);
359 rdma_dev_cleanup (rdma_device_t * rd)
361 rdma_main_t *rm = &rdma_main;
365 #define _(fn, arg) if (arg) \
368 if ((rv = fn (arg))) \
369 rdma_log (VLIB_LOG_LEVEL_DEBUG, rd, #fn "() failed (rv = %d)", rv); \
372 _(ibv_destroy_flow, rd->flow_mcast);
373 _(ibv_destroy_flow, rd->flow_ucast);
374 _(ibv_dereg_mr, rd->mr);
375 vec_foreach (txq, rd->txqs)
377 _(ibv_destroy_qp, txq->qp);
378 _(ibv_destroy_cq, txq->cq);
380 vec_foreach (rxq, rd->rxqs)
382 _(ibv_destroy_wq, rxq->wq);
383 _(ibv_destroy_cq, rxq->cq);
385 _(ibv_destroy_rwq_ind_table, rd->rx_rwq_ind_tbl);
386 _(ibv_destroy_qp, rd->rx_qp);
387 _(ibv_dealloc_pd, rd->pd);
388 _(ibv_close_device, rd->ctx);
391 clib_error_free (rd->error);
396 pool_put (rm->devices, rd);
399 static clib_error_t *
400 rdma_rxq_init (vlib_main_t * vm, rdma_device_t * rd, u16 qid, u32 n_desc)
403 struct ibv_wq_init_attr wqia;
404 struct ibv_wq_attr wqa;
406 vec_validate_aligned (rd->rxqs, qid, CLIB_CACHE_LINE_BYTES);
407 rxq = vec_elt_at_index (rd->rxqs, qid);
410 if ((rxq->cq = ibv_create_cq (rd->ctx, n_desc, NULL, NULL, 0)) == 0)
411 return clib_error_return_unix (0, "Create CQ Failed");
413 memset (&wqia, 0, sizeof (wqia));
414 wqia.wq_type = IBV_WQT_RQ;
415 wqia.max_wr = n_desc;
419 if ((rxq->wq = ibv_create_wq (rd->ctx, &wqia)) == 0)
420 return clib_error_return_unix (0, "Create WQ Failed");
422 memset (&wqa, 0, sizeof (wqa));
423 wqa.attr_mask = IBV_WQ_ATTR_STATE;
424 wqa.wq_state = IBV_WQS_RDY;
425 if (ibv_modify_wq (rxq->wq, &wqa) != 0)
426 return clib_error_return_unix (0, "Modify WQ (RDY) Failed");
431 static clib_error_t *
432 rdma_rxq_finalize (vlib_main_t * vm, rdma_device_t * rd)
434 struct ibv_rwq_ind_table_init_attr rwqia;
435 struct ibv_qp_init_attr_ex qpia;
436 struct ibv_wq **ind_tbl;
439 ASSERT (is_pow2 (vec_len (rd->rxqs))
440 && "rxq number should be a power of 2");
442 ind_tbl = vec_new (struct ibv_wq *, vec_len (rd->rxqs));
443 vec_foreach_index (i, rd->rxqs)
444 ind_tbl[i] = vec_elt_at_index (rd->rxqs, i)->wq;
445 memset (&rwqia, 0, sizeof (rwqia));
446 rwqia.log_ind_tbl_size = min_log2 (vec_len (ind_tbl));
447 rwqia.ind_tbl = ind_tbl;
448 if ((rd->rx_rwq_ind_tbl = ibv_create_rwq_ind_table (rd->ctx, &rwqia)) == 0)
449 return clib_error_return_unix (0, "RWQ indirection table create failed");
452 memset (&qpia, 0, sizeof (qpia));
453 qpia.qp_type = IBV_QPT_RAW_PACKET;
455 IBV_QP_INIT_ATTR_PD | IBV_QP_INIT_ATTR_IND_TABLE |
456 IBV_QP_INIT_ATTR_RX_HASH;
458 qpia.rwq_ind_tbl = rd->rx_rwq_ind_tbl;
459 STATIC_ASSERT_SIZEOF (rdma_rss_hash_key, 40);
460 qpia.rx_hash_conf.rx_hash_key_len = sizeof (rdma_rss_hash_key);
461 qpia.rx_hash_conf.rx_hash_key = rdma_rss_hash_key;
462 qpia.rx_hash_conf.rx_hash_function = IBV_RX_HASH_FUNC_TOEPLITZ;
463 qpia.rx_hash_conf.rx_hash_fields_mask =
464 IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4;
465 if ((rd->rx_qp = ibv_create_qp_ex (rd->ctx, &qpia)) == 0)
466 return clib_error_return_unix (0, "Queue Pair create failed");
468 if (rdma_dev_set_ucast (rd))
469 return clib_error_return_unix (0, "Set unicast mode failed");
474 static clib_error_t *
475 rdma_txq_init (vlib_main_t * vm, rdma_device_t * rd, u16 qid, u32 n_desc)
478 struct ibv_qp_init_attr qpia;
479 struct ibv_qp_attr qpa;
482 vec_validate_aligned (rd->txqs, qid, CLIB_CACHE_LINE_BYTES);
483 txq = vec_elt_at_index (rd->txqs, qid);
486 if ((txq->cq = ibv_create_cq (rd->ctx, n_desc, NULL, NULL, 0)) == 0)
487 return clib_error_return_unix (0, "Create CQ Failed");
489 memset (&qpia, 0, sizeof (qpia));
490 qpia.send_cq = txq->cq;
491 qpia.recv_cq = txq->cq;
492 qpia.cap.max_send_wr = n_desc;
493 qpia.cap.max_send_sge = 1;
494 qpia.qp_type = IBV_QPT_RAW_PACKET;
497 if ((txq->qp = ibv_create_qp (rd->pd, &qpia)) == 0)
498 return clib_error_return_unix (0, "Queue Pair create failed");
500 memset (&qpa, 0, sizeof (qpa));
501 qp_flags = IBV_QP_STATE | IBV_QP_PORT;
502 qpa.qp_state = IBV_QPS_INIT;
504 if (ibv_modify_qp (txq->qp, &qpa, qp_flags) != 0)
505 return clib_error_return_unix (0, "Modify QP (init) Failed");
507 memset (&qpa, 0, sizeof (qpa));
508 qp_flags = IBV_QP_STATE;
509 qpa.qp_state = IBV_QPS_RTR;
510 if (ibv_modify_qp (txq->qp, &qpa, qp_flags) != 0)
511 return clib_error_return_unix (0, "Modify QP (receive) Failed");
513 memset (&qpa, 0, sizeof (qpa));
514 qp_flags = IBV_QP_STATE;
515 qpa.qp_state = IBV_QPS_RTS;
516 if (ibv_modify_qp (txq->qp, &qpa, qp_flags) != 0)
517 return clib_error_return_unix (0, "Modify QP (send) Failed");
521 static clib_error_t *
522 rdma_dev_init (vlib_main_t * vm, rdma_device_t * rd, u32 rxq_size,
523 u32 txq_size, u32 rxq_num)
526 vlib_buffer_main_t *bm = vm->buffer_main;
527 vlib_thread_main_t *tm = vlib_get_thread_main ();
531 return clib_error_return_unix (0, "Device Open Failed");
533 if ((rd->pd = ibv_alloc_pd (rd->ctx)) == 0)
534 return clib_error_return_unix (0, "PD Alloc Failed");
536 ethernet_mac_address_generate (rd->hwaddr.bytes);
538 for (i = 0; i < rxq_num; i++)
539 if ((err = rdma_rxq_init (vm, rd, i, rxq_size)))
541 if ((err = rdma_rxq_finalize (vm, rd)))
544 for (i = 0; i < tm->n_vlib_mains; i++)
545 if ((err = rdma_txq_init (vm, rd, i, txq_size)))
548 if ((rd->mr = ibv_reg_mr (rd->pd, (void *) bm->buffer_mem_start,
550 IBV_ACCESS_LOCAL_WRITE)) == 0)
551 return clib_error_return_unix (0, "Register MR Failed");
557 sysfs_path_to_pci_addr (char *path, vlib_pci_addr_t * addr)
563 s = clib_sysfs_link_to_name (path);
564 unformat_init_string (&in, (char *) s, strlen ((char *) s));
565 rv = unformat (&in, "%U", unformat_vlib_pci_addr, addr);
572 rdma_create_if (vlib_main_t * vm, rdma_create_if_args_t * args)
574 vnet_main_t *vnm = vnet_get_main ();
575 rdma_main_t *rm = &rdma_main;
576 rdma_device_t *rd = 0;
577 struct ibv_device **dev_list = 0;
582 args->rxq_size = args->rxq_size ? args->rxq_size : 2 * VLIB_FRAME_SIZE;
583 args->txq_size = args->txq_size ? args->txq_size : 2 * VLIB_FRAME_SIZE;
584 args->rxq_num = args->rxq_num ? args->rxq_num : 1;
586 if (!is_pow2 (args->rxq_num))
588 args->rv = VNET_API_ERROR_INVALID_VALUE;
590 clib_error_return (0, "rx queue number must be a power of two");
594 if (!is_pow2 (args->rxq_size) || !is_pow2 (args->txq_size))
596 args->rv = VNET_API_ERROR_INVALID_VALUE;
598 clib_error_return (0, "queue size must be a power of two");
602 pool_get_zero (rm->devices, rd);
603 rd->dev_instance = rd - rm->devices;
604 rd->per_interface_next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
605 rd->name = vec_dup (args->name);
607 /* check if device exist and if it is bound to mlx5_core */
608 s = format (s, "/sys/class/net/%s/device/driver/module%c", args->ifname, 0);
609 s2 = clib_sysfs_link_to_name ((char *) s);
611 if (s2 == 0 || strncmp ((char *) s2, "mlx5_core", 9) != 0)
614 clib_error_return (0,
615 "invalid interface (only mlx5 supported for now)");
619 /* extract PCI address */
620 vec_reset_length (s);
621 s = format (s, "/sys/class/net/%s/device%c", args->ifname, 0);
622 if (sysfs_path_to_pci_addr ((char *) s, &rd->pci_addr) == 0)
624 args->error = clib_error_return (0, "cannot find PCI address");
628 dev_list = ibv_get_device_list (&n_devs);
632 clib_error_return_unix (0,
633 "no RDMA devices available, errno = %d. "
634 "Is the ib_uverbs module loaded?", errno);
638 for (int i = 0; i < n_devs; i++)
640 vlib_pci_addr_t addr;
642 vec_reset_length (s);
643 s = format (s, "%s/device%c", dev_list[i]->dev_path, 0);
645 if (sysfs_path_to_pci_addr ((char *) s, &addr) == 0)
648 if (addr.as_u32 != rd->pci_addr.as_u32)
651 if ((rd->ctx = ibv_open_device (dev_list[i])))
656 rdma_dev_init (vm, rd, args->rxq_size, args->txq_size, args->rxq_num)))
659 if ((args->error = rdma_register_interface (vnm, rd)))
662 if ((args->error = rdma_async_event_init (rd)))
665 rdma_update_state (vnm, rd, 1);
667 vnet_sw_interface_t *sw = vnet_get_hw_sw_interface (vnm, rd->hw_if_index);
668 args->sw_if_index = rd->sw_if_index = sw->sw_if_index;
670 * FIXME: add support for interrupt mode
671 * vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, rd->hw_if_index);
672 * hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
674 vnet_hw_interface_set_input_node (vnm, rd->hw_if_index,
675 rdma_input_node.index);
676 vec_foreach_index (qid, rd->rxqs)
677 vnet_hw_interface_assign_rx_thread (vnm, rd->hw_if_index, qid, ~0);
681 rdma_unregister_interface (vnm, rd);
683 rdma_dev_cleanup (rd);
685 ibv_free_device_list (dev_list);
689 args->rv = VNET_API_ERROR_INVALID_INTERFACE;
690 vlib_log_err (rm->log_class, "%U", format_clib_error, args->error);
694 rdma_delete_if (vlib_main_t * vm, rdma_device_t * rd)
696 rdma_async_event_cleanup (rd);
697 rdma_unregister_interface (vnet_get_main (), rd);
698 rdma_dev_cleanup (rd);
701 static clib_error_t *
702 rdma_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
704 vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
705 rdma_main_t *rm = &rdma_main;
706 rdma_device_t *rd = vec_elt_at_index (rm->devices, hi->dev_instance);
707 uword is_up = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) != 0;
709 if (rd->flags & RDMA_DEVICE_F_ERROR)
710 return clib_error_return (0, "device is in error state");
714 vnet_hw_interface_set_flags (vnm, rd->hw_if_index,
715 VNET_HW_INTERFACE_FLAG_LINK_UP);
716 rd->flags |= RDMA_DEVICE_F_ADMIN_UP;
720 vnet_hw_interface_set_flags (vnm, rd->hw_if_index, 0);
721 rd->flags &= ~RDMA_DEVICE_F_ADMIN_UP;
727 rdma_set_interface_next_node (vnet_main_t * vnm, u32 hw_if_index,
730 rdma_main_t *rm = &rdma_main;
731 vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
732 rdma_device_t *rd = pool_elt_at_index (rm->devices, hw->dev_instance);
734 /* Shut off redirection */
735 if (node_index == ~0)
737 rd->per_interface_next_index = node_index;
741 rd->per_interface_next_index =
742 vlib_node_add_next (vlib_get_main (), rdma_input_node.index, node_index);
745 static char *rdma_tx_func_error_strings[] = {
747 foreach_rdma_tx_func_error
752 VNET_DEVICE_CLASS (rdma_device_class) =
754 .name = "RDMA interface",
755 .format_device = format_rdma_device,
756 .format_device_name = format_rdma_device_name,
757 .admin_up_down_function = rdma_interface_admin_up_down,
758 .rx_redirect_to_node = rdma_set_interface_next_node,
759 .tx_function_n_errors = RDMA_TX_N_ERROR,
760 .tx_function_error_strings = rdma_tx_func_error_strings,
761 .mac_addr_change_function = rdma_mac_change,
766 rdma_init (vlib_main_t * vm)
768 rdma_main_t *rm = &rdma_main;
770 rm->log_class = vlib_log_register_class ("rdma", 0);
775 VLIB_INIT_FUNCTION (rdma_init);
778 * fd.io coding-style-patch-verification: ON
781 * eval: (c-set-style "gnu")