From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafal Kozik Subject: [PATCH] fix repopulation of tx_mbufs table Date: Fri, 23 Nov 2018 09:23:02 +0100 Message-ID: <1542961382-5234-1-git-send-email-rk@semihalf.com> Cc: mw@semihalf.com, mk@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, matua@amazon.com, igorch@amazon.com, Rafal Kozik To: dev@dpdk.org, keith.wiles@intel.com Return-path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id 47ACF1B4FC for ; Fri, 23 Nov 2018 09:23:06 +0100 (CET) Received: by mail-lj1-f196.google.com with SMTP id g11-v6so9965093ljk.3 for ; Fri, 23 Nov 2018 00:23:06 -0800 (PST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If in one TX cycle NIC does not send any packet, pktgen tries to allocate 0 mbufs from pool. In such case DPDK return error and packets will not be send. As no packet will be send in next iteration this situation will repeat. Checking if taking more mbufs is needed will prevent this situation. Fixes: f034b381d19f ("cleanup and fix for FVL NIC performance") Signed-off-by: Rafal Kozik --- app/pktgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/pktgen.c b/app/pktgen.c index 2d9ff59..b4d3dfe 100644 --- a/app/pktgen.c +++ b/app/pktgen.c @@ -1054,7 +1054,8 @@ pktgen_send_pkts(port_info_t *info, uint16_t qid, struct rte_mempool *mp) uint16_t saved = info->q[qid].tx_mbufs.len; uint16_t nb_pkts = info->tx_burst - saved; - rc = pg_pktmbuf_alloc_bulk(mp, + if (likely(nb_pkts > 0)) + rc = pg_pktmbuf_alloc_bulk(mp, &info->q[qid].tx_mbufs.m_table[saved], nb_pkts); if (rc == 0) { @@ -1070,7 +1071,8 @@ pktgen_send_pkts(port_info_t *info, uint16_t qid, struct rte_mempool *mp) uint16_t saved = info->q[qid].tx_mbufs.len; uint16_t nb_pkts = txCnt - saved; - rc = pg_pktmbuf_alloc_bulk(mp, + if (likely(nb_pkts > 0)) + rc = pg_pktmbuf_alloc_bulk(mp, &info->q[qid].tx_mbufs.m_table[saved], nb_pkts); if (rc == 0) { -- 2.7.4