Update DPDK version from 19.11 to 20.11 and also support hns3 PMD for Kunpeng 920 and Kunpeng 930. Signed-off-by: speech_white <humin29@huawei.com>
153 lines
4.9 KiB
Diff
153 lines
4.9 KiB
Diff
From 495e9454badc1ee809923d412db13f8e5bae1dca Mon Sep 17 00:00:00 2001
|
|
From: Chengwen Feng <fengchengwen@huawei.com>
|
|
Date: Wed, 21 Apr 2021 16:45:02 +0800
|
|
Subject: [PATCH 178/189] app/testpmd: support cleanup Tx queue mbufs
|
|
|
|
This patch supports cleanup txq mbufs command:
|
|
port cleanup (port_id) txq (queue_id) (free_cnt)
|
|
|
|
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
|
|
Signed-off-by: Lijun Ou <oulijun@huawei.com>
|
|
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
|
---
|
|
app/test-pmd/cmdline.c | 88 +++++++++++++++++++++++++++++
|
|
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++
|
|
2 files changed, 97 insertions(+)
|
|
|
|
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
|
|
index 8446ecc..8832416 100644
|
|
--- a/app/test-pmd/cmdline.c
|
|
+++ b/app/test-pmd/cmdline.c
|
|
@@ -898,6 +898,9 @@ static void cmd_help_long_parsed(void *parsed_result,
|
|
" Register a dynf and Set/clear this flag on Tx. "
|
|
"Testpmd will set this value to any Tx packet "
|
|
"sent from this port\n\n"
|
|
+
|
|
+ "port cleanup (port_id) txq (queue_id) (free_cnt)\n"
|
|
+ " Cleanup txq mbufs for a specific Tx queue\n\n"
|
|
);
|
|
}
|
|
|
|
@@ -2439,6 +2442,90 @@ cmdline_parse_inst_t cmd_config_rss_hash_key = {
|
|
},
|
|
};
|
|
|
|
+/* *** cleanup txq mbufs *** */
|
|
+struct cmd_cleanup_txq_mbufs_result {
|
|
+ cmdline_fixed_string_t port;
|
|
+ cmdline_fixed_string_t keyword;
|
|
+ cmdline_fixed_string_t name;
|
|
+ uint16_t port_id;
|
|
+ uint16_t queue_id;
|
|
+ uint32_t free_cnt;
|
|
+};
|
|
+
|
|
+static void
|
|
+cmd_cleanup_txq_mbufs_parsed(void *parsed_result,
|
|
+ __rte_unused struct cmdline *cl,
|
|
+ __rte_unused void *data)
|
|
+{
|
|
+ struct cmd_cleanup_txq_mbufs_result *res = parsed_result;
|
|
+ uint16_t port_id = res->port_id;
|
|
+ uint16_t queue_id = res->queue_id;
|
|
+ uint32_t free_cnt = res->free_cnt;
|
|
+ struct rte_eth_txq_info qinfo;
|
|
+ int ret;
|
|
+
|
|
+ if (test_done == 0) {
|
|
+ printf("Please stop forwarding first\n");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo)) {
|
|
+ printf("Failed to get port %u Tx queue %u info\n",
|
|
+ port_id, queue_id);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (qinfo.queue_state != RTE_ETH_QUEUE_STATE_STARTED) {
|
|
+ printf("Tx queue %u not started\n", queue_id);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ ret = rte_eth_tx_done_cleanup(port_id, queue_id, free_cnt);
|
|
+ if (ret < 0) {
|
|
+ printf("Failed to cleanup mbuf for port %u Tx queue %u "
|
|
+ "error desc: %s(%d)\n",
|
|
+ port_id, queue_id, strerror(-ret), ret);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ printf("Cleanup port %u Tx queue %u mbuf nums: %u\n",
|
|
+ port_id, queue_id, ret);
|
|
+}
|
|
+
|
|
+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_port =
|
|
+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, port,
|
|
+ "port");
|
|
+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_cleanup =
|
|
+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, keyword,
|
|
+ "cleanup");
|
|
+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_port_id =
|
|
+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, port_id,
|
|
+ RTE_UINT16);
|
|
+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_txq =
|
|
+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, name,
|
|
+ "txq");
|
|
+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_queue_id =
|
|
+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, queue_id,
|
|
+ RTE_UINT16);
|
|
+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_free_cnt =
|
|
+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, free_cnt,
|
|
+ RTE_UINT32);
|
|
+
|
|
+cmdline_parse_inst_t cmd_cleanup_txq_mbufs = {
|
|
+ .f = cmd_cleanup_txq_mbufs_parsed,
|
|
+ .data = NULL,
|
|
+ .help_str = "port cleanup <port_id> txq <queue_id> <free_cnt>",
|
|
+ .tokens = {
|
|
+ (void *)&cmd_cleanup_txq_mbufs_port,
|
|
+ (void *)&cmd_cleanup_txq_mbufs_cleanup,
|
|
+ (void *)&cmd_cleanup_txq_mbufs_port_id,
|
|
+ (void *)&cmd_cleanup_txq_mbufs_txq,
|
|
+ (void *)&cmd_cleanup_txq_mbufs_queue_id,
|
|
+ (void *)&cmd_cleanup_txq_mbufs_free_cnt,
|
|
+ NULL,
|
|
+ },
|
|
+};
|
|
+
|
|
/* *** configure port rxq/txq ring size *** */
|
|
struct cmd_config_rxtx_ring_size {
|
|
cmdline_fixed_string_t port;
|
|
@@ -16947,6 +17034,7 @@ cmdline_parse_ctx_t main_ctx[] = {
|
|
(cmdline_parse_inst_t *)&cmd_showport_rss_hash,
|
|
(cmdline_parse_inst_t *)&cmd_showport_rss_hash_key,
|
|
(cmdline_parse_inst_t *)&cmd_config_rss_hash_key,
|
|
+ (cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs,
|
|
(cmdline_parse_inst_t *)&cmd_dump,
|
|
(cmdline_parse_inst_t *)&cmd_dump_one,
|
|
#ifdef RTE_NET_I40E
|
|
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
|
|
index 9be4500..de90726 100644
|
|
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
|
|
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
|
|
@@ -2415,6 +2415,15 @@ hash of input [IP] packets received on port::
|
|
ipv6-udp-ex <string of hex digits \
|
|
(variable length, NIC dependent)>)
|
|
|
|
+port cleanup txq mbufs
|
|
+~~~~~~~~~~~~~~~~~~~~~~
|
|
+
|
|
+To cleanup txq mbufs currently cached by driver::
|
|
+
|
|
+ testpmd> port cleanup (port_id) txq (queue_id) (free_cnt)
|
|
+
|
|
+If the value of ``free_cnt`` is 0, driver should free all cached mbufs.
|
|
+
|
|
Device Functions
|
|
----------------
|
|
|
|
--
|
|
2.7.4
|
|
|