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 03AEBA00C4; Sun, 24 Apr 2022 08:13:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26458410E0; Sun, 24 Apr 2022 08:13:38 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 2AB7440141 for ; Sun, 24 Apr 2022 08:13:34 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KmHrZ620SzhYS7; Sun, 24 Apr 2022 14:13:18 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sun, 24 Apr 2022 14:13:32 +0800 From: Chengwen Feng To: , , , CC: Subject: [PATCH v3 2/3] examples/dma: fix Tx drop statistic is not collected Date: Sun, 24 Apr 2022 14:07:40 +0800 Message-ID: <20220424060741.33214-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220424060741.33214-1-fengchengwen@huawei.com> References: <20220411025634.33032-1-fengchengwen@huawei.com> <20220424060741.33214-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 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 Acked-by: Bruce Richardson --- 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