From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E5007A04FD; Tue, 30 Aug 2022 03:06:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FB9440F18; Tue, 30 Aug 2022 03:06:00 +0200 (CEST) Received: from mail15.f5.com (mail15.f5.com [104.219.106.14]) by mails.dpdk.org (Postfix) with ESMTP id F327040F17; Tue, 30 Aug 2022 03:05:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=f5.com; i=@f5.com; q=dns/txt; s=f5; t=1661821560; x=1693357560; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=VVxD8snFgvq8SZzAM722balZcq4PNvrn8hzayD2/fok=; b=CH1gMoDPwB97FYMDTd4wNUYgHH82m79YANkW7AhySTNf77IAvSNMJDZw I109QZzQp/cENDm5RA3wdA7luGv77Rcehg+T1apfizGjA0uUy8N00lpoj gKZem5B0TjdFjkrSb/jcJlzRIzljwvuQafbGCD6E8Okjrgaijem+sDvEZ HtoI3uk++pdJ9Q7cUJSZyJlQ9jEn3esSeS7rSlim4RVeqJRiObENxJFR6 hwIG3UBXCyWyus0TxJS8Al8mLmLzCEShlIv462LEtGZOZIbtX5vt5pxQf aGSAuT794kIMgN+on6fhrEUJPy/hZLNa7asv4ijDCsLXCgIEuUFP6ZPpM g==; IronPort-SDR: CNn9v2Fw9z1frzYeCLa5WHQo17UMYyjxO5g9Saq1zA0rQQLl4PemGx2676mLEe1vF0PSQLTN0e KBsHOTA8YHrkWhUFRwDxWyYheaZ2AxqtQD0eLjL/lM60d/o1riu0pmkLBsUX8GLmmWiW5pgFqu fgi9YKu/VE1md+IuDpxyyCj8Qt9q9sAQISgmFhxFrug618D9utzeZhPOimu+rcXCcSl1IfmPGU RAwg4dyWn2Nl8C159cNSlS0TIYhWjKeyson5Jd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nvXcG3wiwDqwRPc3DEn7GKn4UOEgFP4yPaJDg4SOo5kv8Z0YxHZ400vsJVXy6 RQxV+UsJJREFfpgDn93d7VTBtn/3DE6kbKqdRjwkC3bLFuIYO57LZvin+9Ka1wax4SPbpXWN WHD6nnlYlrmB2hHjzkV1JUsaCRt0QIb2q7q3c5y7aoOhht7QFEJhgjtbwidzE7heYAd6U= X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="194791746" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="194791746" Received: from unknown (HELO localhost.localdomain) ([10.145.107.55]) by mail.f5net.com with ESMTP; 29 Aug 2022 18:05:58 -0700 From: Aleksandr Miloshenko To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, Aleksandr Miloshenko , stable@dpdk.org Subject: [PATCH v2] net/iavf: do Tx done cleanup starting from Tx tail Date: Mon, 29 Aug 2022 18:05:25 -0700 Message-Id: <20220830010525.24632-1-a.miloshenko@f5.com> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org iavf_xmit_pkts() sets tx_tail to the next of last transmitted Tx descriptor. So the cleanup of Tx done descriptors must be started from tx_tail, not from the next of tx_tail. Otherwise rte_eth_tx_done_cleanup() doesn't free the first Tx done mbuf when tx queue is full. Fixes: 86e44244f95c ("net/iavf: cleanup Tx buffers") Cc: stable@dpdk.org Signed-off-by: Aleksandr Miloshenko --- v2: * Fixed the commit style. drivers/net/iavf/iavf_rxtx.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 109ba756f8..7cd5db6e49 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -3184,14 +3184,14 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq, uint32_t free_cnt) { struct iavf_tx_entry *swr_ring = txq->sw_ring; - uint16_t i, tx_last, tx_id; + uint16_t tx_last, tx_id; uint16_t nb_tx_free_last; uint16_t nb_tx_to_clean; - uint32_t pkt_cnt; + uint32_t pkt_cnt = 0; - /* Start free mbuf from the next of tx_tail */ - tx_last = txq->tx_tail; - tx_id = swr_ring[tx_last].next_id; + /* Start free mbuf from tx_tail */ + tx_id = txq->tx_tail; + tx_last = tx_id; if (txq->nb_free == 0 && iavf_xmit_cleanup(txq)) return 0; @@ -3204,10 +3204,8 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq, /* Loop through swr_ring to count the amount of * freeable mubfs and packets. */ - for (pkt_cnt = 0; pkt_cnt < free_cnt; ) { - for (i = 0; i < nb_tx_to_clean && - pkt_cnt < free_cnt && - tx_id != tx_last; i++) { + while (pkt_cnt < free_cnt) { + do { if (swr_ring[tx_id].mbuf != NULL) { rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf); swr_ring[tx_id].mbuf = NULL; @@ -3220,7 +3218,7 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq, } tx_id = swr_ring[tx_id].next_id; - } + } while (--nb_tx_to_clean && pkt_cnt < free_cnt && tx_id != tx_last); if (txq->rs_thresh > txq->nb_tx_desc - txq->nb_free || tx_id == tx_last) -- 2.37.0