From 5b873e3b8c8cbb175fa014b0c28944892ce6c3b3 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Thu, 8 Feb 2018 15:44:20 +0000 Subject: at DPDK queue setup take into account device descriptor limits. Change-Id: Idf7c65a8499f41d2cd53342f91f2b87e902faf58 Signed-off-by: Konstantin Ananyev --- app/nginx/src/tldk/be.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app/nginx/src/tldk/be.c') diff --git a/app/nginx/src/tldk/be.c b/app/nginx/src/tldk/be.c index 4cb1b1c..3d17b60 100644 --- a/app/nginx/src/tldk/be.c +++ b/app/nginx/src/tldk/be.c @@ -293,7 +293,7 @@ be_queue_init(struct tldk_ctx *tcx, const tldk_conf_t *cf) { int32_t socket, rc; uint16_t queue_id; - uint32_t port_id, i; + uint32_t port_id, i, nb_rxd, nb_txd; struct rte_eth_dev_info dev_info; const struct tldk_ctx_conf *ctx; const struct tldk_port_conf *pcf; @@ -305,8 +305,12 @@ be_queue_init(struct tldk_ctx *tcx, const tldk_conf_t *cf) pcf = &cf->port[port_id]; rte_eth_dev_info_get(port_id, &dev_info); + dev_info.default_rxconf.rx_drop_en = 1; - dev_info.default_txconf.tx_free_thresh = TX_RING_SIZE / 2; + + nb_rxd = RTE_MIN(RX_RING_SIZE, dev_info.rx_desc_lim.nb_max); + nb_txd = RTE_MIN(TX_RING_SIZE, dev_info.tx_desc_lim.nb_max); + dev_info.default_txconf.tx_free_thresh = nb_txd / 2; if (pcf->tx_offload != 0) { RTE_LOG(ERR, USER1, @@ -317,7 +321,7 @@ be_queue_init(struct tldk_ctx *tcx, const tldk_conf_t *cf) socket = rte_eth_dev_socket_id(port_id); - rc = rte_eth_rx_queue_setup(port_id, queue_id, RX_RING_SIZE, + rc = rte_eth_rx_queue_setup(port_id, queue_id, nb_rxd, socket, &dev_info.default_rxconf, tcx->mpool); if (rc < 0) { RTE_LOG(ERR, USER1, @@ -326,7 +330,7 @@ be_queue_init(struct tldk_ctx *tcx, const tldk_conf_t *cf) return rc; } - rc = rte_eth_tx_queue_setup(port_id, queue_id, TX_RING_SIZE, + rc = rte_eth_tx_queue_setup(port_id, queue_id, nb_txd, socket, &dev_info.default_txconf); if (rc < 0) { RTE_LOG(ERR, USER1, -- cgit 1.2.3-korg