DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: fix flex parser destroy command
@ 2022-06-16  8:07 Gregory Etelson
  2022-06-16  9:15 ` [PATCH v2] " Gregory Etelson
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Etelson @ 2022-06-16  8:07 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, stable, Viacheslav Ovsiienko,
	Xiaoyun Li, Aman Singh, Yuying Zhang

The patch separates flex item destruction function implementation.
Setups with installed JSON development library can use any value in
range [0, FLEX_MAX_PARSERS_NUM - 1] as input flex item ID.
In setups without JSON development library flex item destruction
function is resolved to empty stub.

cc: stable@dpdk.org

Fixes: 2d3d84013508 ("app/testpmd: fix flex item flush")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 app/test-pmd/cmd_flex_item.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/app/test-pmd/cmd_flex_item.c b/app/test-pmd/cmd_flex_item.c
index 78a89c0f8a..f2560dbf83 100644
--- a/app/test-pmd/cmd_flex_item.c
+++ b/app/test-pmd/cmd_flex_item.c
@@ -368,23 +368,12 @@ flex_item_create(portid_t port_id, uint16_t flex_id, const char *filename)
 	free(fp);
 }
 
-#else /* RTE_HAS_JANSSON */
-void flex_item_create(__rte_unused portid_t port_id,
-		      __rte_unused uint16_t flex_id,
-		      __rte_unused const char *filename)
-{
-	printf("cannot create flex item - no JSON library configured\n");
-}
-#endif /* RTE_HAS_JANSSON */
-
 void
 flex_item_destroy(portid_t port_id, uint16_t flex_id)
 {
 	int ret;
 	struct rte_flow_error error;
 	struct flex_item *fp = flex_parser_fetch(port_id, flex_id);
-	if (!flex_id)
-		return;
 	if (fp == FLEX_PARSER_ERR) {
 		printf("Bad parameters: port_id=%u flex_id=%u\n",
 		       port_id, flex_id);
@@ -405,6 +394,22 @@ flex_item_destroy(portid_t port_id, uint16_t flex_id)
 	}
 }
 
+#else /* RTE_HAS_JANSSON */
+void flex_item_create(__rte_unused portid_t port_id,
+		      __rte_unused uint16_t flex_id,
+		      __rte_unused const char *filename)
+{
+	printf("cannot create flex item - no JSON library configured\n");
+}
+
+void
+flex_item_destroy(__rte_unused portid_t port_id, __rte_unused uint16_t flex_id)
+{
+
+}
+
+#endif /* RTE_HAS_JANSSON */
+
 void
 port_flex_item_flush(portid_t port_id)
 {
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] app/testpmd: fix flex parser destroy command
  2022-06-16  8:07 [PATCH] app/testpmd: fix flex parser destroy command Gregory Etelson
@ 2022-06-16  9:15 ` Gregory Etelson
  2022-06-23 11:22   ` Andrew Rybchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Etelson @ 2022-06-16  9:15 UTC (permalink / raw)
  To: dev
  Cc: getelson, matan, rasland, stable, Viacheslav Ovsiienko,
	Xiaoyun Li, Aman Singh, Yuying Zhang

The patch separates flex item destruction function implementation.
Setups with installed JSON development library can use any value in
range [0, FLEX_MAX_PARSERS_NUM - 1] as input flex item ID.
In setups without JSON development library flex item destruction
function is resolved to empty stub.

cc: stable@dpdk.org

Fixes: 2d3d84013508 ("app/testpmd: fix flex item flush")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2: fix compilation warning on setups without JSON library.
---
 app/test-pmd/cmd_flex_item.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/app/test-pmd/cmd_flex_item.c b/app/test-pmd/cmd_flex_item.c
index 78a89c0f8a..63593fd456 100644
--- a/app/test-pmd/cmd_flex_item.c
+++ b/app/test-pmd/cmd_flex_item.c
@@ -20,6 +20,8 @@
 struct flex_item *flex_items[RTE_MAX_ETHPORTS][FLEX_MAX_PARSERS_NUM];
 struct flex_pattern flex_patterns[FLEX_MAX_PATTERNS_NUM];
 
+#ifdef RTE_HAS_JANSSON
+
 static struct flex_item *
 flex_parser_fetch(uint16_t port_id, uint16_t flex_id)
 {
@@ -34,7 +36,6 @@ flex_parser_fetch(uint16_t port_id, uint16_t flex_id)
 	return flex_items[port_id][flex_id];
 }
 
-#ifdef RTE_HAS_JANSSON
 static __rte_always_inline bool
 match_strkey(const char *key, const char *pattern)
 {
@@ -368,23 +369,12 @@ flex_item_create(portid_t port_id, uint16_t flex_id, const char *filename)
 	free(fp);
 }
 
-#else /* RTE_HAS_JANSSON */
-void flex_item_create(__rte_unused portid_t port_id,
-		      __rte_unused uint16_t flex_id,
-		      __rte_unused const char *filename)
-{
-	printf("cannot create flex item - no JSON library configured\n");
-}
-#endif /* RTE_HAS_JANSSON */
-
 void
 flex_item_destroy(portid_t port_id, uint16_t flex_id)
 {
 	int ret;
 	struct rte_flow_error error;
 	struct flex_item *fp = flex_parser_fetch(port_id, flex_id);
-	if (!flex_id)
-		return;
 	if (fp == FLEX_PARSER_ERR) {
 		printf("Bad parameters: port_id=%u flex_id=%u\n",
 		       port_id, flex_id);
@@ -405,6 +395,22 @@ flex_item_destroy(portid_t port_id, uint16_t flex_id)
 	}
 }
 
+#else /* RTE_HAS_JANSSON */
+void flex_item_create(__rte_unused portid_t port_id,
+		      __rte_unused uint16_t flex_id,
+		      __rte_unused const char *filename)
+{
+	printf("cannot create flex item - no JSON library configured\n");
+}
+
+void
+flex_item_destroy(__rte_unused portid_t port_id, __rte_unused uint16_t flex_id)
+{
+
+}
+
+#endif /* RTE_HAS_JANSSON */
+
 void
 port_flex_item_flush(portid_t port_id)
 {
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] app/testpmd: fix flex parser destroy command
  2022-06-16  9:15 ` [PATCH v2] " Gregory Etelson
@ 2022-06-23 11:22   ` Andrew Rybchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Rybchenko @ 2022-06-23 11:22 UTC (permalink / raw)
  To: Gregory Etelson, dev
  Cc: matan, rasland, stable, Viacheslav Ovsiienko, Xiaoyun Li,
	Aman Singh, Yuying Zhang

On 6/16/22 12:15, Gregory Etelson wrote:
> The patch separates flex item destruction function implementation.
> Setups with installed JSON development library can use any value in
> range [0, FLEX_MAX_PARSERS_NUM - 1] as input flex item ID.
> In setups without JSON development library flex item destruction
> function is resolved to empty stub.
> 
> cc: stable@dpdk.org
> 
> Fixes: 2d3d84013508 ("app/testpmd: fix flex item flush")
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
> v2: fix compilation warning on setups without JSON library.
> ---

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-23 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16  8:07 [PATCH] app/testpmd: fix flex parser destroy command Gregory Etelson
2022-06-16  9:15 ` [PATCH v2] " Gregory Etelson
2022-06-23 11:22   ` Andrew Rybchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).