[v9,09/10] app/testpmd: fix unused function warnings

Message ID 1619805162-10684-10-git-send-email-jizh@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: enable testpmd on Windows |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Zhou April 30, 2021, 5:52 p.m. UTC
  Function print_fdir_mask and print_fdir_flex_payload is only called
when either i40e or ixgbe presents. Add #if defined to remove
"unused function" compilation warning.

Signed-off-by: Jie Zhou <jizh@microsoft.com>
Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
---
 app/test-pmd/config.c | 82 +++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 41 deletions(-)
  

Comments

Tal Shnaiderman May 3, 2021, 5:43 p.m. UTC | #1
> Subject: [PATCH v9 09/10] app/testpmd: fix unused function warnings
> 
> External email: Use caution opening links or attachments
> 
> 
> Function print_fdir_mask and print_fdir_flex_payload is only called when
> either i40e or ixgbe presents. Add #if defined to remove "unused function"
> compilation warning.
> 
> Signed-off-by: Jie Zhou <jizh@microsoft.com>
> Signed-off-by: Jie Zhou <jizh@linux.microsoft.com>
> ---
>  app/test-pmd/config.c | 82 +++++++++++++++++++++----------------------
>  1 file changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
> c626d5ce8..4eecad38f 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -4365,6 +4365,47 @@ set_record_burst_stats(uint8_t on_off)
>         record_burst_stats = on_off;
>  }
> 
> +static char*
> +flowtype_to_str(uint16_t flow_type)
> +{
> +       struct flow_type_info {
> +               char str[32];
> +               uint16_t ftype;
> +       };
> +
> +       uint8_t i;
> +       static struct flow_type_info 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},
> +               {"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},
> +       };
> +
> +       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;
> +}
> +
> +#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
> +
>  static inline void
>  print_fdir_mask(struct rte_eth_fdir_masks *mask)  { @@ -4424,47 +4465,6
> @@ print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf,
> uint32_t num)
>         printf("\n");
>  }
> 
> -static char *
> -flowtype_to_str(uint16_t flow_type)
> -{
> -       struct flow_type_info {
> -               char str[32];
> -               uint16_t ftype;
> -       };
> -
> -       uint8_t i;
> -       static struct flow_type_info 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},
> -               {"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},
> -       };
> -
> -       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;
> -}
> -
> -#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
> -
>  static inline void
>  print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t
> num)  {
> --
> 2.30.0.vfs.0.2

Acked-by: Tal Shnaiderman <talshn@nvidia.com>
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index c626d5ce8..4eecad38f 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4365,6 +4365,47 @@  set_record_burst_stats(uint8_t on_off)
 	record_burst_stats = on_off;
 }
 
+static char*
+flowtype_to_str(uint16_t flow_type)
+{
+	struct flow_type_info {
+		char str[32];
+		uint16_t ftype;
+	};
+
+	uint8_t i;
+	static struct flow_type_info 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},
+		{"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},
+	};
+
+	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;
+}
+
+#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
+
 static inline void
 print_fdir_mask(struct rte_eth_fdir_masks *mask)
 {
@@ -4424,47 +4465,6 @@  print_fdir_flex_payload(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
 	printf("\n");
 }
 
-static char *
-flowtype_to_str(uint16_t flow_type)
-{
-	struct flow_type_info {
-		char str[32];
-		uint16_t ftype;
-	};
-
-	uint8_t i;
-	static struct flow_type_info 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},
-		{"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},
-	};
-
-	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;
-}
-
-#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE)
-
 static inline void
 print_fdir_flex_mask(struct rte_eth_fdir_flex_conf *flex_conf, uint32_t num)
 {