1 Star 0 Fork 75

chenjiji09/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0100-examples-dma-fix-Tx-drop-statistics.patch 2.58 KB
一键复制 编辑 原始数据 按行查看 历史
liudongdong3 提交于 2022-06-16 16:03 . sync patches from 22.07
From 5059d5fd27626e1d34b6dcaa2e74c7a5f1c7ee1f Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Sun, 24 Apr 2022 14:07:40 +0800
Subject: [PATCH 100/122] examples/dma: fix Tx drop statistics
The Tx drop statistic was designed to be 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>
Acked-by: Kevin Laatz <kevin.laatz@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 cfd978ec6c..d7d39b6a14 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.22.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenjiji09/dpdk.git
git@gitee.com:chenjiji09/dpdk.git
chenjiji09
dpdk
dpdk
master

搜索帮助