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

Signed-off-by: Stephen Hemminger <[email protected]>
---
 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

Reply via email to