DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
@ 2021-10-26 15:20 Gregory Etelson
  2021-11-03 19:12 ` Ferruh Yigit
  2021-11-05 15:56 ` Ferruh Yigit
  0 siblings, 2 replies; 6+ messages in thread
From: Gregory Etelson @ 2021-10-26 15:20 UTC (permalink / raw)
  To: dev, getelson; +Cc: matan, rasland, Xiaoyun Li, Viacheslav Ovsiienko

Testpmd provides 2 sets of flex item create and destroy functions
One for hosts with JSON library. These functions parse
flex item configuration stored in JSON file and create or destroy
flex item object. The second functions set is for hosts without JSON
library for compilation compatibility.

On hosts without JSON library, current implementation issues
"no JSON library" notification on port close.
The notification was triggered by port destructors that include
flex items flush routine.

The patch introduces single implementation for testpmd
flex item destroy.

Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/cmd_flex_item.c | 72 ++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 37 deletions(-)

diff --git a/app/test-pmd/cmd_flex_item.c b/app/test-pmd/cmd_flex_item.c
index 45103e45a8..908bcb3f47 100644
--- a/app/test-pmd/cmd_flex_item.c
+++ b/app/test-pmd/cmd_flex_item.c
@@ -20,13 +20,6 @@
 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 __rte_always_inline bool
-match_strkey(const char *key, const char *pattern)
-{
-	return strncmp(key, pattern, strlen(key)) == 0;
-}
-
 static struct flex_item *
 flex_parser_fetch(uint16_t port_id, uint16_t flex_id)
 {
@@ -41,30 +34,11 @@ flex_parser_fetch(uint16_t port_id, uint16_t flex_id)
 	return flex_items[port_id][flex_id];
 }
 
-void
-flex_item_destroy(portid_t port_id, uint16_t flex_id)
+#ifdef RTE_HAS_JANSSON
+static __rte_always_inline bool
+match_strkey(const char *key, const char *pattern)
 {
-	int ret;
-	struct rte_flow_error error;
-	struct flex_item *fp = flex_parser_fetch(port_id, flex_id);
-	if (fp == FLEX_PARSER_ERR) {
-		printf("Bad parameters: port_id=%u flex_id=%u\n",
-		       port_id, flex_id);
-		return;
-	}
-	if (!fp)
-		return;
-	ret = rte_flow_flex_item_release(port_id, fp->flex_handle, &error);
-	if (!ret) {
-		free(fp);
-		flex_items[port_id][flex_id] = NULL;
-		printf("port-%u: released flex item #%u\n",
-		       port_id, flex_id);
-
-	} else {
-		printf("port-%u: cannot release flex item #%u: %s\n",
-		       port_id, flex_id, error.message);
-	}
+	return strncmp(key, pattern, strlen(key)) == 0;
 }
 
 static int
@@ -399,15 +373,37 @@ void flex_item_create(__rte_unused portid_t port_id,
 		      __rte_unused uint16_t flex_id,
 		      __rte_unused const char *filename)
 {
-	printf("no JSON library\n");
+	printf("cannot create flex item - no JSON library configured\n");
 }
+#endif /* RTE_HAS_JANSSON */
 
-void flex_item_destroy(__rte_unused portid_t port_id,
-		       __rte_unused uint16_t flex_id)
+void
+flex_item_destroy(portid_t port_id, uint16_t flex_id)
 {
-	printf("no JSON library\n");
+	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);
+		return;
+	}
+	if (!fp)
+		return;
+	ret = rte_flow_flex_item_release(port_id, fp->flex_handle, &error);
+	if (!ret) {
+		free(fp);
+		flex_items[port_id][flex_id] = NULL;
+		printf("port-%u: released flex item #%u\n",
+		       port_id, flex_id);
+
+	} else {
+		printf("port-%u: cannot release flex item #%u: %s\n",
+		       port_id, flex_id, error.message);
+	}
 }
-#endif /* RTE_HAS_JANSSON */
 
 void
 port_flex_item_flush(portid_t port_id)
@@ -415,8 +411,10 @@ port_flex_item_flush(portid_t port_id)
 	uint16_t i;
 
 	for (i = 0; i < FLEX_MAX_PARSERS_NUM; i++) {
-		flex_item_destroy(port_id, i);
-		flex_items[port_id][i] = NULL;
+		if (flex_items[port_id][i] != NULL) {
+			flex_item_destroy(port_id, i);
+			flex_items[port_id][i] = NULL;
+		}
 	}
 }
 
-- 
2.33.1


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
  2021-10-26 15:20 [dpdk-dev] [PATCH] app/testpmd: fix flex item flush Gregory Etelson
@ 2021-11-03 19:12 ` Ferruh Yigit
  2021-11-05 15:56 ` Ferruh Yigit
  1 sibling, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2021-11-03 19:12 UTC (permalink / raw)
  To: Gregory Etelson, Ori Kam
  Cc: matan, rasland, Xiaoyun Li, Viacheslav Ovsiienko, dev,
	Thomas Monjalon, David Marchand

On 10/26/2021 4:20 PM, Gregory Etelson wrote:
> Testpmd provides 2 sets of flex item create and destroy functions
> One for hosts with JSON library. These functions parse
> flex item configuration stored in JSON file and create or destroy
> flex item object. The second functions set is for hosts without JSON
> library for compilation compatibility.
> 
> On hosts without JSON library, current implementation issues
> "no JSON library" notification on port close.
> The notification was triggered by port destructors that include
> flex items flush routine.
> 
> The patch introduces single implementation for testpmd
> flex item destroy.
> 
> Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands")
> Signed-off-by: Gregory Etelson<getelson@nvidia.com>
> ---
>   app/test-pmd/cmd_flex_item.c | 72 ++++++++++++++++++------------------


Hi Gregory, Ori,

I just recognized that 'cmd_flex_item.c' doesn't have an explicit maintainer,
which makes it fallback to Xialyoun, but I don't think that is related to
existing coverage.

Since the file is related to rte_flow and only user of it (also author of it)
is nvidia, can one of you take the maintainership of the file?

It is easier to add it to 'Flow API' block in MAINTAINERS file,
that Ori already is the maintainer, if that suits.

And perhaps, if you guys are OK, Gregory can be added to 'Flow API' too,
it is good to have multiple maintainers.

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
  2021-10-26 15:20 [dpdk-dev] [PATCH] app/testpmd: fix flex item flush Gregory Etelson
  2021-11-03 19:12 ` Ferruh Yigit
@ 2021-11-05 15:56 ` Ferruh Yigit
  2021-11-05 17:03   ` Slava Ovsiienko
  1 sibling, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2021-11-05 15:56 UTC (permalink / raw)
  To: Gregory Etelson, Viacheslav Ovsiienko, Ori Kam
  Cc: matan, rasland, Xiaoyun Li, dev

On 10/26/2021 4:20 PM, Gregory Etelson wrote:
> Testpmd provides 2 sets of flex item create and destroy functions
> One for hosts with JSON library. These functions parse
> flex item configuration stored in JSON file and create or destroy
> flex item object. The second functions set is for hosts without JSON
> library for compilation compatibility.
> 
> On hosts without JSON library, current implementation issues
> "no JSON library" notification on port close.
> The notification was triggered by port destructors that include
> flex items flush routine.
> 
> The patch introduces single implementation for testpmd
> flex item destroy.
> 
> Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands")
> Signed-off-by: Gregory Etelson<getelson@nvidia.com>

Hi Viacheslav, Ori,

Can you please help on reviewing this patch?

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
  2021-11-05 15:56 ` Ferruh Yigit
@ 2021-11-05 17:03   ` Slava Ovsiienko
  2021-11-05 18:56     ` Ferruh Yigit
  2021-11-05 21:21     ` Ferruh Yigit
  0 siblings, 2 replies; 6+ messages in thread
From: Slava Ovsiienko @ 2021-11-05 17:03 UTC (permalink / raw)
  To: Ferruh Yigit, Gregory Etelson, Ori Kam
  Cc: Matan Azrad, Raslan Darawsheh, Xiaoyun Li, dev

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Friday, November 5, 2021 17:57
> To: Gregory Etelson <getelson@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>
> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>; Xiaoyun Li <xiaoyun.li@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
> 
> On 10/26/2021 4:20 PM, Gregory Etelson wrote:
> > Testpmd provides 2 sets of flex item create and destroy functions One
> > for hosts with JSON library. These functions parse flex item
> > configuration stored in JSON file and create or destroy flex item
> > object. The second functions set is for hosts without JSON library for
> > compilation compatibility.
> >
> > On hosts without JSON library, current implementation issues "no JSON
> > library" notification on port close.
> > The notification was triggered by port destructors that include flex
> > items flush routine.
> >
> > The patch introduces single implementation for testpmd flex item
> > destroy.
> >
> > Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands")
> > Signed-off-by: Gregory Etelson<getelson@nvidia.com>
> 
> Hi Viacheslav, Ori,
> 
> Can you please help on reviewing this patch?
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

I've already reviewed this one internally, so just posting the confirmation.
As for maintainership of cmd_flex_item.c  - we talked with Ori,  he don't
mind if I would take the responsibility for this. What should we do for that? Send patch
to update MAINTAINERS ?

With best regards,
Slava

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
  2021-11-05 17:03   ` Slava Ovsiienko
@ 2021-11-05 18:56     ` Ferruh Yigit
  2021-11-05 21:21     ` Ferruh Yigit
  1 sibling, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2021-11-05 18:56 UTC (permalink / raw)
  To: Slava Ovsiienko, Gregory Etelson, Ori Kam
  Cc: Matan Azrad, Raslan Darawsheh, Xiaoyun Li, dev

On 11/5/2021 5:03 PM, Slava Ovsiienko wrote:
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Friday, November 5, 2021 17:57
>> To: Gregory Etelson <getelson@nvidia.com>; Slava Ovsiienko
>> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>
>> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
>> <rasland@nvidia.com>; Xiaoyun Li <xiaoyun.li@intel.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
>>
>> On 10/26/2021 4:20 PM, Gregory Etelson wrote:
>>> Testpmd provides 2 sets of flex item create and destroy functions One
>>> for hosts with JSON library. These functions parse flex item
>>> configuration stored in JSON file and create or destroy flex item
>>> object. The second functions set is for hosts without JSON library for
>>> compilation compatibility.
>>>
>>> On hosts without JSON library, current implementation issues "no JSON
>>> library" notification on port close.
>>> The notification was triggered by port destructors that include flex
>>> items flush routine.
>>>
>>> The patch introduces single implementation for testpmd flex item
>>> destroy.
>>>
>>> Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands")
>>> Signed-off-by: Gregory Etelson<getelson@nvidia.com>
>>
>> Hi Viacheslav, Ori,
>>
>> Can you please help on reviewing this patch?
> Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 
> I've already reviewed this one internally, so just posting the confirmation.
> As for maintainership of cmd_flex_item.c  - we talked with Ori,  he don't
> mind if I would take the responsibility for this. What should we do for that? Send patch
> to update MAINTAINERS ?
> 

Great, thanks.
Yes a maintainers file update is required.

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
  2021-11-05 17:03   ` Slava Ovsiienko
  2021-11-05 18:56     ` Ferruh Yigit
@ 2021-11-05 21:21     ` Ferruh Yigit
  1 sibling, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2021-11-05 21:21 UTC (permalink / raw)
  To: Slava Ovsiienko, Gregory Etelson, Ori Kam
  Cc: Matan Azrad, Raslan Darawsheh, Xiaoyun Li, dev

On 11/5/2021 5:03 PM, Slava Ovsiienko wrote:
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@intel.com>
>> Sent: Friday, November 5, 2021 17:57
>> To: Gregory Etelson <getelson@nvidia.com>; Slava Ovsiienko
>> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>
>> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
>> <rasland@nvidia.com>; Xiaoyun Li <xiaoyun.li@intel.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix flex item flush
>>
>> On 10/26/2021 4:20 PM, Gregory Etelson wrote:
>>> Testpmd provides 2 sets of flex item create and destroy functions One
>>> for hosts with JSON library. These functions parse flex item
>>> configuration stored in JSON file and create or destroy flex item
>>> object. The second functions set is for hosts without JSON library for
>>> compilation compatibility.
>>>
>>> On hosts without JSON library, current implementation issues "no JSON
>>> library" notification on port close.
>>> The notification was triggered by port destructors that include flex
>>> items flush routine.
>>>
>>> The patch introduces single implementation for testpmd flex item
>>> destroy.
>>>
>>> Fixes: 59f3a8acbcdb ("app/testpmd: add flex item commands")
>>> Signed-off-by: Gregory Etelson<getelson@nvidia.com>
>>
>> Hi Viacheslav, Ori,
>>
>> Can you please help on reviewing this patch?
> Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> 

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

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

end of thread, other threads:[~2021-11-05 21:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 15:20 [dpdk-dev] [PATCH] app/testpmd: fix flex item flush Gregory Etelson
2021-11-03 19:12 ` Ferruh Yigit
2021-11-05 15:56 ` Ferruh Yigit
2021-11-05 17:03   ` Slava Ovsiienko
2021-11-05 18:56     ` Ferruh Yigit
2021-11-05 21:21     ` Ferruh Yigit

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).