patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic
       [not found] <1545748697-3385-4-git-send-email-motih@mellanox.com>
@ 2018-12-27 22:20 ` Mordechay Haimovsky
  2018-12-29 20:12   ` [dpdk-stable] [dpdk-dev] " Slava Ovsiienko
  0 siblings, 1 reply; 4+ messages in thread
From: Mordechay Haimovsky @ 2018-12-27 22:20 UTC (permalink / raw)
  To: dev; +Cc: Mordechay Haimovsky, stable

This commit fixes the logic for searching and allocating a shared
counter in mlx5_flow_verbs.
Now only the shared counters in the counters list are checked for
a match and not all the counters as before.

Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
v2:
* Modified commit header
---
 drivers/net/mlx5/mlx5_flow_verbs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 81ec59d..409e1cd 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -121,13 +121,13 @@
 	struct mlx5_flow_counter *cnt;
 	int ret;
 
-	LIST_FOREACH(cnt, &priv->flow_counters, next) {
-		if (!cnt->shared || cnt->shared != shared)
-			continue;
-		if (cnt->id != id)
-			continue;
-		cnt->ref_cnt++;
-		return cnt;
+	if (shared) {
+		LIST_FOREACH(cnt, &priv->flow_counters, next) {
+			if (cnt->shared && cnt->id == id) {
+				cnt->ref_cnt++;
+				return cnt;
+			}
+		}
 	}
 	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
 	if (!cnt) {
-- 
1.8.3.1

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic
  2018-12-27 22:20 ` [dpdk-stable] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic Mordechay Haimovsky
@ 2018-12-29 20:12   ` Slava Ovsiienko
  2018-12-31  7:23     ` Shahaf Shuler
  2019-01-02  6:58     ` Mordechay Haimovsky
  0 siblings, 2 replies; 4+ messages in thread
From: Slava Ovsiienko @ 2018-12-29 20:12 UTC (permalink / raw)
  To: Mordechay Haimovsky, dev; +Cc: Mordechay Haimovsky, stable

Moti, don't you forget to update flow_verbs_counter_release() ?
Only shared counters should be removed from the list.

WBR,
Slava

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Mordechay Haimovsky
> Sent: Friday, December 28, 2018 0:20
> To: dev@dpdk.org
> Cc: Mordechay Haimovsky <motih@mellanox.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter allocation
> logic
> 
> This commit fixes the logic for searching and allocating a shared counter in
> mlx5_flow_verbs.
> Now only the shared counters in the counters list are checked for a match
> and not all the counters as before.
> 
> Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> ---
> v2:
> * Modified commit header
> ---
>  drivers/net/mlx5/mlx5_flow_verbs.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 81ec59d..409e1cd 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -121,13 +121,13 @@
>  	struct mlx5_flow_counter *cnt;
>  	int ret;
> 
> -	LIST_FOREACH(cnt, &priv->flow_counters, next) {
> -		if (!cnt->shared || cnt->shared != shared)
> -			continue;
> -		if (cnt->id != id)
> -			continue;
> -		cnt->ref_cnt++;
> -		return cnt;
> +	if (shared) {
> +		LIST_FOREACH(cnt, &priv->flow_counters, next) {
> +			if (cnt->shared && cnt->id == id) {
> +				cnt->ref_cnt++;
> +				return cnt;
> +			}
> +		}
>  	}
>  	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
>  	if (!cnt) {
> --
> 1.8.3.1

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic
  2018-12-29 20:12   ` [dpdk-stable] [dpdk-dev] " Slava Ovsiienko
@ 2018-12-31  7:23     ` Shahaf Shuler
  2019-01-02  6:58     ` Mordechay Haimovsky
  1 sibling, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2018-12-31  7:23 UTC (permalink / raw)
  To: Slava Ovsiienko, Mordechay Haimovsky, dev; +Cc: Mordechay Haimovsky, stable

Saturday, December 29, 2018 10:13 PM, Slava Ovsiienko:
> Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter allocation
> logic
> 
> Moti, don't you forget to update flow_verbs_counter_release() ?
> Only shared counters should be removed from the list.

+1, thanks slava.

Moti, I have no more comments on this series.
Please fix above and send the next series w/ my Ack. 

> 
> WBR,
> Slava
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Mordechay Haimovsky
> > Sent: Friday, December 28, 2018 0:20
> > To: dev@dpdk.org
> > Cc: Mordechay Haimovsky <motih@mellanox.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter
> > allocation logic
> >
> > This commit fixes the logic for searching and allocating a shared
> > counter in mlx5_flow_verbs.
> > Now only the shared counters in the counters list are checked for a
> > match and not all the counters as before.
> >
> > Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> > ---
> > v2:
> > * Modified commit header
> > ---
> >  drivers/net/mlx5/mlx5_flow_verbs.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> > b/drivers/net/mlx5/mlx5_flow_verbs.c
> > index 81ec59d..409e1cd 100644
> > --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> > +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> > @@ -121,13 +121,13 @@
> >  	struct mlx5_flow_counter *cnt;
> >  	int ret;
> >
> > -	LIST_FOREACH(cnt, &priv->flow_counters, next) {
> > -		if (!cnt->shared || cnt->shared != shared)
> > -			continue;
> > -		if (cnt->id != id)
> > -			continue;
> > -		cnt->ref_cnt++;
> > -		return cnt;
> > +	if (shared) {
> > +		LIST_FOREACH(cnt, &priv->flow_counters, next) {
> > +			if (cnt->shared && cnt->id == id) {
> > +				cnt->ref_cnt++;
> > +				return cnt;
> > +			}
> > +		}
> >  	}
> >  	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
> >  	if (!cnt) {
> > --
> > 1.8.3.1

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic
  2018-12-29 20:12   ` [dpdk-stable] [dpdk-dev] " Slava Ovsiienko
  2018-12-31  7:23     ` Shahaf Shuler
@ 2019-01-02  6:58     ` Mordechay Haimovsky
  1 sibling, 0 replies; 4+ messages in thread
From: Mordechay Haimovsky @ 2019-01-02  6:58 UTC (permalink / raw)
  To: Slava Ovsiienko, dev; +Cc: stable

Hi,
 Every counter that is created (shared or not) is added to the counters list 
Therefore every counter destined for  removal (i.e. ref_count == 0) should also be 
Removed from this list.

What am I missing ?

Moti

> -----Original Message-----
> From: Slava Ovsiienko
> Sent: Saturday, December 29, 2018 10:13 PM
> To: Mordechay Haimovsky <motih@mellanox.com>; dev@dpdk.org
> Cc: Mordechay Haimovsky <motih@mellanox.com>; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter
> allocation logic
> 
> Moti, don't you forget to update flow_verbs_counter_release() ?
> Only shared counters should be removed from the list.
> 
> WBR,
> Slava
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Mordechay Haimovsky
> > Sent: Friday, December 28, 2018 0:20
> > To: dev@dpdk.org
> > Cc: Mordechay Haimovsky <motih@mellanox.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v2 1/3] net/mlx5: fix shared counter
> > allocation logic
> >
> > This commit fixes the logic for searching and allocating a shared
> > counter in mlx5_flow_verbs.
> > Now only the shared counters in the counters list are checked for a
> > match and not all the counters as before.
> >
> > Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> > ---
> > v2:
> > * Modified commit header
> > ---
> >  drivers/net/mlx5/mlx5_flow_verbs.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> > b/drivers/net/mlx5/mlx5_flow_verbs.c
> > index 81ec59d..409e1cd 100644
> > --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> > +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> > @@ -121,13 +121,13 @@
> >  	struct mlx5_flow_counter *cnt;
> >  	int ret;
> >
> > -	LIST_FOREACH(cnt, &priv->flow_counters, next) {
> > -		if (!cnt->shared || cnt->shared != shared)
> > -			continue;
> > -		if (cnt->id != id)
> > -			continue;
> > -		cnt->ref_cnt++;
> > -		return cnt;
> > +	if (shared) {
> > +		LIST_FOREACH(cnt, &priv->flow_counters, next) {
> > +			if (cnt->shared && cnt->id == id) {
> > +				cnt->ref_cnt++;
> > +				return cnt;
> > +			}
> > +		}
> >  	}
> >  	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
> >  	if (!cnt) {
> > --
> > 1.8.3.1

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

end of thread, other threads:[~2019-01-02  6:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1545748697-3385-4-git-send-email-motih@mellanox.com>
2018-12-27 22:20 ` [dpdk-stable] [PATCH v2 1/3] net/mlx5: fix shared counter allocation logic Mordechay Haimovsky
2018-12-29 20:12   ` [dpdk-stable] [dpdk-dev] " Slava Ovsiienko
2018-12-31  7:23     ` Shahaf Shuler
2019-01-02  6:58     ` Mordechay Haimovsky

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