diff options
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r-- | src/plugins/dpdk/device/common.c | 8 | ||||
-rw-r--r-- | src/plugins/dpdk/device/dpdk.h | 1 | ||||
-rw-r--r-- | src/plugins/dpdk/device/init.c | 21 | ||||
-rw-r--r-- | src/plugins/dpdk/device/node.c | 17 |
4 files changed, 28 insertions, 19 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c index 2521abde97a..e9b033ec1af 100644 --- a/src/plugins/dpdk/device/common.c +++ b/src/plugins/dpdk/device/common.c @@ -21,6 +21,7 @@ #include <vnet/ip/ip.h> #include <vnet/ethernet/ethernet.h> #include <vnet/ethernet/arp_packet.h> +#include <vnet/interface/rx_queue_funcs.h> #include <dpdk/buffer.h> #include <dpdk/device/dpdk.h> #include <dpdk/device/dpdk_priv.h> @@ -122,11 +123,8 @@ dpdk_device_setup (dpdk_device_t * xd) for (j = 0; j < xd->rx_q_used; j++) { dpdk_rx_queue_t *rxq = vec_elt_at_index (xd->rx_queues, j); - uword tidx = vnet_get_device_input_thread_index (dm->vnet_main, - xd->hw_if_index, j); - unsigned lcore = vlib_worker_threads[tidx].cpu_id; - u16 socket_id = rte_lcore_to_socket_id (lcore); - u8 bpidx = vlib_buffer_pool_get_default_for_numa (vm, socket_id); + u8 bpidx = vlib_buffer_pool_get_default_for_numa ( + vm, vnet_hw_if_get_rx_queue_numa_node (vnm, rxq->queue_index)); vlib_buffer_pool_t *bp = vlib_get_buffer_pool (vm, bpidx); struct rte_mempool *mp = dpdk_mempool_by_buffer_pool_index[bpidx]; diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index 504bac5b6ee..3712015d438 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -165,6 +165,7 @@ typedef struct { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); u8 buffer_pool_index; + u32 queue_index; } dpdk_rx_queue_t; typedef struct diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index a1eead20541..8e4bf558a19 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -22,6 +22,7 @@ #include <vlib/log.h> #include <vnet/ethernet/ethernet.h> +#include <vnet/interface/rx_queue_funcs.h> #include <dpdk/buffer.h> #include <dpdk/device/dpdk.h> #include <dpdk/cryptodev/cryptodev.h> @@ -414,6 +415,9 @@ dpdk_lib_init (dpdk_main_t * dm) else xd->rx_q_used = 1; + vec_validate_aligned (xd->rx_queues, xd->rx_q_used - 1, + CLIB_CACHE_LINE_BYTES); + xd->flags |= DPDK_DEVICE_FLAG_PMD; /* workaround for drivers not setting driver_name */ @@ -724,25 +728,30 @@ dpdk_lib_init (dpdk_main_t * dm) sw = vnet_get_hw_sw_interface (dm->vnet_main, xd->hw_if_index); xd->sw_if_index = sw->sw_if_index; - vnet_hw_interface_set_input_node (dm->vnet_main, xd->hw_if_index, - dpdk_input_node.index); + vnet_hw_if_set_input_node (dm->vnet_main, xd->hw_if_index, + dpdk_input_node.index); if (devconf->workers) { int i; q = 0; clib_bitmap_foreach (i, devconf->workers) { - vnet_hw_interface_assign_rx_thread (dm->vnet_main, xd->hw_if_index, q++, - vdm->first_worker_thread_index + i); + dpdk_rx_queue_t *rxq = vec_elt_at_index (xd->rx_queues, q); + rxq->queue_index = vnet_hw_if_register_rx_queue ( + dm->vnet_main, xd->hw_if_index, q++, + vdm->first_worker_thread_index + i); } } else for (q = 0; q < xd->rx_q_used; q++) { - vnet_hw_interface_assign_rx_thread (dm->vnet_main, xd->hw_if_index, q, /* any */ - ~1); + dpdk_rx_queue_t *rxq = vec_elt_at_index (xd->rx_queues, q); + rxq->queue_index = vnet_hw_if_register_rx_queue ( + dm->vnet_main, xd->hw_if_index, q, VNET_HW_IF_RXQ_THREAD_ANY); } + vnet_hw_if_update_runtime_data (dm->vnet_main, xd->hw_if_index); + /*Get vnet hardware interface */ hi = vnet_get_hw_interface (dm->vnet_main, xd->hw_if_index); diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index e7d836fe0f8..2eec74eaab2 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -25,6 +25,7 @@ #include <vnet/mpls/packet.h> #include <vnet/handoff.h> #include <vnet/devices/devices.h> +#include <vnet/interface/rx_queue_funcs.h> #include <vnet/feature/feature.h> #include <dpdk/device/dpdk_priv.h> @@ -463,21 +464,21 @@ VLIB_NODE_FN (dpdk_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node, dpdk_main_t *dm = &dpdk_main; dpdk_device_t *xd; uword n_rx_packets = 0; - vnet_device_input_runtime_t *rt = (void *) node->runtime_data; - vnet_device_and_queue_t *dq; + vnet_hw_if_rxq_poll_vector_t *pv; u32 thread_index = node->thread_index; /* * Poll all devices on this cpu for input/interrupts. */ - /* *INDENT-OFF* */ - foreach_device_and_queue (dq, rt->devices_and_queues) + + pv = vnet_hw_if_get_rxq_poll_vector (vm, node); + + for (int i = 0; i < vec_len (pv); i++) { - xd = vec_elt_at_index(dm->devices, dq->dev_instance); - n_rx_packets += dpdk_device_input (vm, dm, xd, node, thread_index, - dq->queue_id); + xd = vec_elt_at_index (dm->devices, pv[i].dev_instance); + n_rx_packets += + dpdk_device_input (vm, dm, xd, node, thread_index, pv[i].queue_id); } - /* *INDENT-ON* */ return n_rx_packets; } |