diff options
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r-- | src/plugins/dpdk/device/common.c | 6 | ||||
-rw-r--r-- | src/plugins/dpdk/device/dpdk.h | 1 | ||||
-rw-r--r-- | src/plugins/dpdk/device/dpdk_priv.h | 8 | ||||
-rw-r--r-- | src/plugins/dpdk/device/node.c | 3 |
4 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c index aedc3f5227d..c65cec6734d 100644 --- a/src/plugins/dpdk/device/common.c +++ b/src/plugins/dpdk/device/common.c @@ -78,8 +78,11 @@ dpdk_device_setup (dpdk_device_t * xd) dpdk_device_error (xd, "rte_eth_tx_queue_setup", rv); } + vec_validate_aligned (xd->buffer_pool_for_queue, xd->rx_q_used - 1, + CLIB_CACHE_LINE_BYTES); for (j = 0; j < xd->rx_q_used; j++) { + dpdk_mempool_private_t *privp; uword tidx = vnet_get_device_input_thread_index (dm->vnet_main, xd->hw_if_index, j); unsigned lcore = vlib_worker_threads[tidx].lcore_id; @@ -95,6 +98,9 @@ dpdk_device_setup (dpdk_device_t * xd) SOCKET_ID_ANY, 0, dm->pktmbuf_pools[socket_id]); + privp = rte_mempool_get_priv (dm->pktmbuf_pools[socket_id]); + xd->buffer_pool_for_queue[j] = privp->buffer_pool_index; + if (rv < 0) dpdk_device_error (xd, "rte_eth_rx_queue_setup", rv); } diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index a0c57ea21b3..1ed3b280385 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -194,6 +194,7 @@ typedef struct u16 rx_q_used; u16 nb_rx_desc; u16 *cpu_socket_id_by_queue; + u8 *buffer_pool_for_queue; struct rte_eth_conf port_conf; struct rte_eth_txconf tx_conf; diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h index 52b4ca4b303..a95d03cfba4 100644 --- a/src/plugins/dpdk/device/dpdk_priv.h +++ b/src/plugins/dpdk/device/dpdk_priv.h @@ -51,6 +51,14 @@ _(proc-type) \ _(file-prefix) \ _(vdev) +typedef struct +{ + /* must be first */ + struct rte_pktmbuf_pool_private mbp_priv; + u8 buffer_pool_index; +} dpdk_mempool_private_t; + + static inline void dpdk_get_xstats (dpdk_device_t * xd) { diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index cf8b9699206..82978216817 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -347,6 +347,9 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd, /* Update buffer template */ vnet_buffer (bt)->sw_if_index[VLIB_RX] = xd->vlib_sw_if_index; bt->error = node->errors[DPDK_ERROR_NONE]; + /* as DPDK is allocating empty buffers from mempool provided before interface + start for each queue, it is safe to store this in the template */ + bt->buffer_pool_index = xd->buffer_pool_for_queue[queue_id]; mb_index = 0; |