DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,
	<kevin.laatz@intel.com>,  <bruce.richardson@intel.com>
Cc: <dev@dpdk.org>
Subject: [PATCH v3 2/3] examples/dma: fix Tx drop statistic is not collected
Date: Sun, 24 Apr 2022 14:07:40 +0800	[thread overview]
Message-ID: <20220424060741.33214-3-fengchengwen@huawei.com> (raw)
In-Reply-To: <20220424060741.33214-1-fengchengwen@huawei.com>

The Tx drop statistic was designed to collected by
rte_eth_dev_tx_buffer mechanism, but the application uses
rte_eth_tx_burst to send packets and this lead the Tx drop statistic
was not collected.

This patch removes rte_eth_dev_tx_buffer mechanism to fix the problem.

Fixes: 632bcd9b5d4f ("examples/ioat: print statistics")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/dma/dmafwd.c | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c
index a03ca05129..dd576bcf77 100644
--- a/examples/dma/dmafwd.c
+++ b/examples/dma/dmafwd.c
@@ -122,7 +122,6 @@ static uint32_t max_frame_size;
 /* ethernet addresses of ports */
 static struct rte_ether_addr dma_ports_eth_addr[RTE_MAX_ETHPORTS];
 
-static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS];
 struct rte_mempool *dma_pktmbuf_pool;
 
 /* Print out statistics for one port. */
@@ -484,10 +483,13 @@ dma_tx_port(struct rxtx_port_config *tx_config)
 
 		port_statistics.tx[tx_config->rxtx_port] += nb_tx;
 
-		/* Free any unsent packets. */
-		if (unlikely(nb_tx < nb_dq))
+		if (unlikely(nb_tx < nb_dq)) {
+			port_statistics.tx_dropped[tx_config->rxtx_port] +=
+				(nb_dq - nb_tx);
+			/* Free any unsent packets. */
 			rte_mempool_put_bulk(dma_pktmbuf_pool,
 			(void *)&mbufs[nb_tx], nb_dq - nb_tx);
+		}
 	}
 }
 /* >8 End of transmitting packets from dmadev. */
@@ -970,25 +972,6 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 			"rte_eth_tx_queue_setup:err=%d,port=%u\n",
 			ret, portid);
 
-	/* Initialize TX buffers */
-	tx_buffer[portid] = rte_zmalloc_socket("tx_buffer",
-			RTE_ETH_TX_BUFFER_SIZE(MAX_PKT_BURST), 0,
-			rte_eth_dev_socket_id(portid));
-	if (tx_buffer[portid] == NULL)
-		rte_exit(EXIT_FAILURE,
-			"Cannot allocate buffer for tx on port %u\n",
-			portid);
-
-	rte_eth_tx_buffer_init(tx_buffer[portid], MAX_PKT_BURST);
-
-	ret = rte_eth_tx_buffer_set_err_callback(tx_buffer[portid],
-		rte_eth_tx_buffer_count_callback,
-		&port_statistics.tx_dropped[portid]);
-	if (ret < 0)
-		rte_exit(EXIT_FAILURE,
-			"Cannot set error callback for tx buffer on port %u\n",
-			portid);
-
 	/* Start device. 8< */
 	ret = rte_eth_dev_start(portid);
 	if (ret < 0)
-- 
2.33.0


  parent reply	other threads:[~2022-04-24  6:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  2:56 [PATCH 0/4] bugfix and enhance features for DMA example Chengwen Feng
2022-04-11  2:56 ` [PATCH 1/4] examples/dma: fix MTU configuration Chengwen Feng
2022-04-11  2:56 ` [PATCH 2/4] examples/dma: fix Tx drop statistic is not collected Chengwen Feng
2022-04-11  2:56 ` [PATCH 3/4] examples/dma: support enqueue drop statistic Chengwen Feng
2022-04-11  2:56 ` [PATCH 4/4] examples/dma: add minimal copy size parameter Chengwen Feng
2022-04-11  9:27   ` Bruce Richardson
2022-04-11 12:23     ` fengchengwen
2022-04-11 12:14 ` [PATCH v2 0/4] bugfix and enhance features for DMA example Chengwen Feng
2022-04-11 12:14   ` [PATCH v2 1/4] examples/dma: fix MTU configuration Chengwen Feng
2022-04-11 12:14   ` [PATCH v2 2/4] examples/dma: fix Tx drop statistic is not collected Chengwen Feng
2022-04-13 14:57     ` Bruce Richardson
2022-04-11 12:14   ` [PATCH v2 3/4] examples/dma: support enqueue drop statistic Chengwen Feng
2022-04-13 15:01     ` Bruce Richardson
2022-04-16  6:19       ` fengchengwen
2022-04-19  8:45         ` Bruce Richardson
2022-04-19 12:09           ` fengchengwen
2022-04-24  3:55             ` fengchengwen
2022-04-11 12:14   ` [PATCH v2 4/4] examples/dma: add force minimal copy size parameter Chengwen Feng
2022-04-13 15:04     ` Bruce Richardson
2022-04-24  6:07 ` [PATCH v3 0/3] bugfix and enhance features for DMA example Chengwen Feng
2022-04-24  6:07   ` [PATCH v3 1/3] examples/dma: fix MTU configuration Chengwen Feng
2022-05-11  2:26     ` fengchengwen
2022-04-24  6:07   ` Chengwen Feng [this message]
2022-04-27 10:54     ` [PATCH v3 2/3] examples/dma: fix Tx drop statistic is not collected Kevin Laatz
2022-04-24  6:07   ` [PATCH v3 3/3] examples/dma: add force minimal copy size parameter Chengwen Feng
2022-04-27 10:54     ` Kevin Laatz
2022-06-06 21:35   ` [PATCH v3 0/3] bugfix and enhance features for DMA example Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220424060741.33214-3-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@xilinx.com \
    --cc=kevin.laatz@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).