DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Aman Singh <aman.deep.singh@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH v4 06/23] app/testpmd: move str_to_flowtype to i40e
Date: Wed,  5 Aug 2026 22:09:00 -0700	[thread overview]
Message-ID: <20260806051004.166778-7-stephen@networkplumber.org> (raw)
In-Reply-To: <20260806051004.166778-1-stephen@networkplumber.org>

Only the i40e internal command is still using str_to_flowtype()
so move it to there.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test-pmd/config.c                 | 62 ---------------------------
 app/test-pmd/testpmd.h                |  3 --
 drivers/net/intel/i40e/i40e_testpmd.c | 51 ++++++++++++++++++++++
 3 files changed, 51 insertions(+), 65 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 582e7287be..230640ea44 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3,7 +3,6 @@
  * Copyright 2013-2014 6WIND S.A.
  */
 
-#include <ctype.h>
 #include <stdarg.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -182,35 +181,6 @@ static const struct {
 	},
 };
 
-static const struct {
-	char str[32];
-	uint16_t ftype;
-} flowtype_str_table[] = {
-	{"raw", RTE_ETH_FLOW_RAW},
-	{"ipv4", RTE_ETH_FLOW_IPV4},
-	{"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
-	{"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
-	{"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
-	{"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
-	{"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
-	{"ipv6", RTE_ETH_FLOW_IPV6},
-	{"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
-	{"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
-	{"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
-	{"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
-	{"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
-	{"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
-	{"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
-	{"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
-	{"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
-	{"port", RTE_ETH_FLOW_PORT},
-	{"vxlan", RTE_ETH_FLOW_VXLAN},
-	{"geneve", RTE_ETH_FLOW_GENEVE},
-	{"nvgre", RTE_ETH_FLOW_NVGRE},
-	{"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
-	{"gtpu", RTE_ETH_FLOW_GTPU},
-};
-
 static void
 print_ethaddr(const char *name, struct rte_ether_addr *eth_addr)
 {
@@ -7024,38 +6994,6 @@ set_record_burst_stats(uint8_t on_off)
 	record_burst_stats = on_off;
 }
 
-uint16_t
-str_to_flowtype(const char *string)
-{
-	uint8_t i;
-
-	for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
-		if (!strcmp(flowtype_str_table[i].str, string))
-			return flowtype_str_table[i].ftype;
-	}
-
-	if (isdigit(string[0])) {
-		int val = atoi(string);
-		if (val > 0 && val < 64)
-			return (uint16_t)val;
-	}
-
-	return RTE_ETH_FLOW_UNKNOWN;
-}
-
-const char*
-flowtype_to_str(uint16_t flow_type)
-{
-	uint8_t i;
-
-	for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
-		if (flowtype_str_table[i].ftype == flow_type)
-			return flowtype_str_table[i].str;
-	}
-
-	return NULL;
-}
-
 void
 set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f7c10ab6b8..ed94bd65c6 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1325,9 +1325,6 @@ int parse_hairpin_map(const char *hpmap);
 uint64_t str_to_rsstypes(const char *str);
 const char *rsstypes_to_str(uint64_t rss_type);
 
-uint16_t str_to_flowtype(const char *string);
-const char *flowtype_to_str(uint16_t flow_type);
-
 /* For registering driver specific testpmd commands. */
 struct testpmd_driver_commands {
 	TAILQ_ENTRY(testpmd_driver_commands) next;
diff --git a/drivers/net/intel/i40e/i40e_testpmd.c b/drivers/net/intel/i40e/i40e_testpmd.c
index 21f596297b..8ae1db698f 100644
--- a/drivers/net/intel/i40e/i40e_testpmd.c
+++ b/drivers/net/intel/i40e/i40e_testpmd.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2016 Intel Corporation.
  */
 
+#include <ctype.h>
 #include <stdlib.h>
 
 #include <rte_pmd_i40e.h>
@@ -465,6 +466,56 @@ static cmdline_parse_inst_t cmd_show_queue_region_info_all = {
 };
 
 /* *** deal with flow director filter *** */
+
+static const struct {
+	char str[32];
+	uint16_t ftype;
+} flowtype_str_table[] = {
+	{"raw", RTE_ETH_FLOW_RAW},
+	{"ipv4", RTE_ETH_FLOW_IPV4},
+	{"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+	{"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+	{"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+	{"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+	{"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+	{"ipv6", RTE_ETH_FLOW_IPV6},
+	{"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+	{"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+	{"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+	{"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+	{"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+	{"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
+	{"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
+	{"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
+	{"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
+	{"port", RTE_ETH_FLOW_PORT},
+	{"vxlan", RTE_ETH_FLOW_VXLAN},
+	{"geneve", RTE_ETH_FLOW_GENEVE},
+	{"nvgre", RTE_ETH_FLOW_NVGRE},
+	{"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
+	{"gtpu", RTE_ETH_FLOW_GTPU},
+};
+
+static uint16_t
+str_to_flowtype(const char *string)
+{
+	uint8_t i;
+
+	for (i = 0; i < RTE_DIM(flowtype_str_table); i++) {
+		if (!strcmp(flowtype_str_table[i].str, string))
+			return flowtype_str_table[i].ftype;
+	}
+
+	if (isdigit(string[0])) {
+		int val = atoi(string);
+		if (val > 0 && val < 64)
+			return (uint16_t)val;
+	}
+
+	return RTE_ETH_FLOW_UNKNOWN;
+}
+
+
 struct cmd_flow_director_result {
 	cmdline_fixed_string_t flow_director_filter;
 	portid_t port_id;
-- 
2.53.0


  parent reply	other threads:[~2026-08-06  5:10 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 16:51 [PATCH v2 00/22] ethdev: clean up legacy flow director Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 01/22] drivers/net: remove unused include in dpaa Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 02/22] ethdev: use DPDK byte order conversion Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 03/22] net/ixgbe: remove experimental FDIR API Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 04/22] net/i40e: " Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 05/22] app/testpmd: remove support for flow director Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 06/22] net/gve: include IP, UDP and TCP headers Stephen Hemminger
2026-08-03 18:04   ` Joshua Washington
2026-08-03 16:51 ` [PATCH v2 07/22] crypto/dpaa_sec: include UDP header Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 08/22] net/nfp: break implicit dependency on rte_eth_ctrl.h Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 09/22] net/mana: include used network headers Stephen Hemminger
2026-08-03 17:09   ` [EXTERNAL] " Long Li
2026-08-03 16:51 ` [PATCH v2 10/22] gro: include headers directly Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 11/22] app/test: " Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 12/22] node: get UDP header Stephen Hemminger
2026-08-03 16:51 ` [PATCH v2 13/22] net/rnp: include network headers Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 14/22] net/r8169: get " Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 15/22] net/ngbe: include network protocol headers Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 16/22] examples: include network headers Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 17/22] net/mlx5: include rte_flow as needed Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 18/22] net/sfc: include rte_flow Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 19/22] net/intel/common: include network headers Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 20/22] net/enetfec: add missing sys/types.h include Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 21/22] ethdev, drivers: isolate flow director Stephen Hemminger
2026-08-03 16:52 ` [PATCH v2 22/22] doc: add release note about rte_ethdev changes Stephen Hemminger
2026-08-04 15:44 ` [PATCH v3 00/23] ethdev: isolate legacy flow director Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 01/23] drivers/net: remove unused include in dpaa Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 02/23] ethdev: use DPDK byte order conversion Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 03/23] net/ixgbe: remove experimental FDIR API Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 04/23] net/i40e: " Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 05/23] app/testpmd: remove support for flow director Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 06/23] app/testpmd: move str_to_flowtype to i40e Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 07/23] app/test: include headers directly Stephen Hemminger
2026-08-04 15:53     ` Marat Khalili
2026-08-04 15:44   ` [PATCH v3 08/23] gro: " Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 09/23] crypto/dpaa_sec: include UDP header Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 10/23] net/gve: include UDP, SCTP and TCP headers Stephen Hemminger
2026-08-04 15:44   ` [PATCH v3 11/23] net/nfp: break implicit dependency on rte_eth_ctrl.h Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 12/23] net/mana: include used network headers Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 13/23] node: get UDP header Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 14/23] net/rnp: include network headers Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 15/23] net/r8169: get " Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 16/23] net/ngbe: include network protocol headers Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 17/23] examples: include network headers Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 18/23] net/mlx5: include rte_flow as needed Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 19/23] net/sfc: include rte_flow Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 20/23] net/intel/common: include network headers Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 21/23] net/enetfec: add missing sys/types.h include Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 22/23] ethdev, drivers: isolate flow director Stephen Hemminger
2026-08-04 15:45   ` [PATCH v3 23/23] doc: add release note about rte_ethdev changes Stephen Hemminger
2026-08-06  5:08 ` [PATCH v4 00/23] ethdev: refactor remaining uses of flow director Stephen Hemminger
2026-08-06  5:08   ` [PATCH v4 01/23] drivers/net: remove unused include in dpaa and dpaa2 Stephen Hemminger
2026-08-06  6:13     ` Hemant Agrawal
2026-08-06  5:08   ` [PATCH v4 02/23] ethdev: use DPDK byte order conversion Stephen Hemminger
2026-08-06  5:08   ` [PATCH v4 03/23] net/ixgbe: remove experimental FDIR API Stephen Hemminger
2026-08-06  5:08   ` [PATCH v4 04/23] net/i40e: " Stephen Hemminger
2026-08-06  5:08   ` [PATCH v4 05/23] app/testpmd: remove support for flow director Stephen Hemminger
2026-08-06  5:09   ` Stephen Hemminger [this message]
2026-08-06  5:09   ` [PATCH v4 07/23] app/test: include headers directly Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 08/23] gro: " Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 09/23] crypto/dpaa_sec: include UDP header Stephen Hemminger
2026-08-06  6:12     ` Hemant Agrawal
2026-08-06  5:09   ` [PATCH v4 10/23] net/gve: include UDP, SCTP and TCP headers Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 11/23] net/nfp: break implicit dependency on rte_eth_ctrl.h Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 12/23] net/mana: include used network headers Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 13/23] node: get UDP header Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 14/23] net/rnp: include network headers Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 15/23] net/r8169: get " Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 16/23] net/ngbe: include network protocol headers Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 17/23] examples: include network headers Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 18/23] net/mlx5: include rte_flow as needed Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 19/23] net/sfc: include rte_flow Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 20/23] net/intel/common: include network headers Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 21/23] net/enetfec: add missing sys/types.h include Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 22/23] ethdev, drivers: isolate flow director Stephen Hemminger
2026-08-06  5:09   ` [PATCH v4 23/23] doc: add release note about rte_ethdev changes Stephen Hemminger

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=20260806051004.166778-7-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=aman.deep.singh@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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