DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: <getelson@nvidia.com>, <matan@nvidia.com>, <rasland@nvidia.com>,
	<stable@dpdk.org>, Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Xiaoyun Li <xiaoyun.li@intel.com>,
	Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>
Subject: [PATCH] app/testpmd: fix flex parser destroy command
Date: Thu, 16 Jun 2022 11:07:44 +0300	[thread overview]
Message-ID: <20220616080744.5832-1-getelson@nvidia.com> (raw)

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


             reply	other threads:[~2022-06-16  8:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16  8:07 Gregory Etelson [this message]
2022-06-16  9:15 ` [PATCH v2] " Gregory Etelson
2022-06-23 11:22   ` Andrew Rybchenko

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=20220616080744.5832-1-getelson@nvidia.com \
    --to=getelson@nvidia.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    --cc=xiaoyun.li@intel.com \
    --cc=yuying.zhang@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).