t.file_descriptor = rd->ctx->async_fd;
t.error_function = rdma_async_event_error_ready;
t.private_data = rd->dev_instance;
- t.description = format (0, "%s async event", rd->name);
+ t.description = format (0, "%v async event", rd->name);
rd->async_event_clib_file_index = clib_file_add (&file_main, &t);
return 0;
ethernet_mac_address_generate (rd->hwaddr.bytes);
+ /*
+ * /!\ WARNING /!\ creation order is important
+ * We *must* create TX queues *before* RX queues, otherwise we will receive
+ * the broacast packets we sent
+ */
+ for (i = 0; i < tm->n_vlib_mains; i++)
+ if ((err = rdma_txq_init (vm, rd, i, txq_size)))
+ return err;
+
for (i = 0; i < rxq_num; i++)
if ((err = rdma_rxq_init (vm, rd, i, rxq_size)))
return err;
if ((err = rdma_rxq_finalize (vm, rd)))
return err;
- for (i = 0; i < tm->n_vlib_mains; i++)
- if ((err = rdma_txq_init (vm, rd, i, txq_size)))
- return err;
-
if ((rd->mr = ibv_reg_mr (rd->pd, (void *) bm->buffer_mem_start,
bm->buffer_mem_size,
IBV_ACCESS_LOCAL_WRITE)) == 0)
u8 *s;
s = clib_sysfs_link_to_name (path);
+ if (!s)
+ return 0;
+
unformat_init_string (&in, (char *) s, strlen ((char *) s));
rv = unformat (&in, "%U", unformat_vlib_pci_addr, addr);
unformat_free (&in);
pool_get_zero (rm->devices, rd);
rd->dev_instance = rd - rm->devices;
rd->per_interface_next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
- rd->name = format (0, "%s", args->name);
rd->linux_ifname = format (0, "%s", args->ifname);
+ if (!args->name || 0 == args->name[0])
+ rd->name = format (0, "%s/%d", args->ifname, rd->dev_instance);
+ else
+ rd->name = format (0, "%s", args->name);
+
rd->pci = vlib_pci_get_device_info (vm, &pci_addr, &args->error);
if (!rd->pci)
goto err2;
+
+ /* if we failed to parse NUMA node, default to 0 */
+ if (-1 == rd->pci->numa_node)
+ rd->pci->numa_node = 0;
+
rd->pool = vlib_buffer_pool_get_default_for_numa (vm, rd->pci->numa_node);
if (strncmp ((char *) rd->pci->driver_name, "mlx5_core", 9))
rdma_main_t *rm = &rdma_main;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
rdma_device_t *rd = pool_elt_at_index (rm->devices, hw->dev_instance);
-
- /* Shut off redirection */
- if (node_index == ~0)
- {
- rd->per_interface_next_index = node_index;
- return;
- }
-
rd->per_interface_next_index =
+ ~0 ==
+ node_index ? VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT :
vlib_node_add_next (vlib_get_main (), rdma_input_node.index, node_index);
}
return 0;
}
-VLIB_INIT_FUNCTION (rdma_init);
+/* *INDENT-OFF* */
+VLIB_INIT_FUNCTION (rdma_init) =
+{
+ .runs_after = VLIB_INITS ("pci_bus_init"),
+};
+/* *INDENT-OFF* */
/*
* fd.io coding-style-patch-verification: ON