#include <vlib/unix/unix.h>
#include <vlib/pci/pci.h>
#include <vnet/ethernet/ethernet.h>
+#include <vnet/interface/rx_queue_funcs.h>
#include <rdma/rdma.h>
rdma_unregister_interface (vnet_main_t * vnm, rdma_device_t * rd)
{
vnet_hw_interface_set_flags (vnm, rd->hw_if_index, 0);
- vnet_hw_interface_unassign_rx_thread (vnm, rd->hw_if_index, 0);
ethernet_delete_interface (vnm, rd->hw_if_index);
}
* vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, rd->hw_if_index);
* hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
*/
- vnet_hw_interface_set_input_node (vnm, rd->hw_if_index,
- rdma_input_node.index);
- vec_foreach_index (qid, rd->rxqs)
- vnet_hw_interface_assign_rx_thread (vnm, rd->hw_if_index, qid, ~0);
+ vnet_hw_if_set_input_node (vnm, rd->hw_if_index, rdma_input_node.index);
+ vec_foreach_index (qid, rd->rxqs)
+ {
+ u32 queue_index = vnet_hw_if_register_rx_queue (
+ vnm, rd->hw_if_index, qid, VNET_HW_IF_RXQ_THREAD_ANY);
+ rd->rxqs[qid].queue_index = queue_index;
+ }
+ vnet_hw_if_update_runtime_data (vnm, rd->hw_if_index);
vec_free (s);
return;
#undef _
};
-/* *INDENT-OFF* */
VNET_DEVICE_CLASS (rdma_device_class) =
{
.name = "RDMA interface",
.tx_function_error_strings = rdma_tx_func_error_strings,
.mac_addr_change_function = rdma_mac_change,
};
-/* *INDENT-ON* */
clib_error_t *
rdma_init (vlib_main_t * vm)
return 0;
}
-/* *INDENT-OFF* */
VLIB_INIT_FUNCTION (rdma_init) =
{
.runs_after = VLIB_INITS ("pci_bus_init"),
};
-/* *INDENT-OFF* */
/*
* fd.io coding-style-patch-verification: ON
#include <vlib/pci/pci.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/devices/devices.h>
+#include <vnet/interface/rx_queue_funcs.h>
#include <rdma/rdma.h>
{
u32 n_rx = 0;
rdma_main_t *rm = &rdma_main;
- vnet_device_input_runtime_t *rt = (void *) node->runtime_data;
- vnet_device_and_queue_t *dq;
-
- foreach_device_and_queue (dq, rt->devices_and_queues)
- {
- rdma_device_t *rd;
- rd = vec_elt_at_index (rm->devices, dq->dev_instance);
- if (PREDICT_TRUE (rd->flags & RDMA_DEVICE_F_ADMIN_UP) == 0)
- continue;
-
- if (PREDICT_TRUE (rd->flags & RDMA_DEVICE_F_ERROR))
- continue;
-
- if (PREDICT_TRUE (rd->flags & RDMA_DEVICE_F_MLX5DV))
- n_rx += rdma_device_input_inline (vm, node, frame, rd, dq->queue_id, 1);
- else
- n_rx += rdma_device_input_inline (vm, node, frame, rd, dq->queue_id, 0);
- }
+ vnet_hw_if_rxq_poll_vector_t *pv;
+ pv = vnet_hw_if_get_rxq_poll_vector (vm, node);
+ for (int i = 0; i < vec_len (pv); i++)
+ {
+ rdma_device_t *rd;
+ rd = vec_elt_at_index (rm->devices, pv[i].dev_instance);
+ if (PREDICT_TRUE (rd->flags & RDMA_DEVICE_F_ADMIN_UP) == 0)
+ continue;
+
+ if (PREDICT_TRUE (rd->flags & RDMA_DEVICE_F_ERROR))
+ continue;
+
+ if (PREDICT_TRUE (rd->flags & RDMA_DEVICE_F_MLX5DV))
+ n_rx +=
+ rdma_device_input_inline (vm, node, frame, rd, pv[i].queue_id, 1);
+ else
+ n_rx +=
+ rdma_device_input_inline (vm, node, frame, rd, pv[i].queue_id, 0);
+ }
return n_rx;
}