DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix shared counter search with nested index
@ 2020-05-15  8:36 Suanming Mou
  2020-05-17  5:51 ` Matan Azrad
  2020-05-17  9:59 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Suanming Mou @ 2020-05-15  8:36 UTC (permalink / raw)
  To: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko; +Cc: dev, rasland

Currently, the shared counter search uses the wrong nested index which
is used by the pool index. The incorrect nested index using causes the
search go to incorrect counter pool is not existed.

Add the counter index to fix the incorrect nested use case.

Fixes: 4001d7ad26d4 ("net/mlx5: change Direct Verbs counter to indexed")

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 71da5fb..deb4469 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4467,15 +4467,15 @@ struct field_modify_info modify_tcp[] = {
 flow_dv_counter_shared_search(struct mlx5_pools_container *cont, uint32_t id,
 			      struct mlx5_flow_counter_pool **ppool)
 {
-	static struct mlx5_flow_counter_ext *cnt;
+	struct mlx5_flow_counter_ext *cnt;
 	struct mlx5_flow_counter_pool *pool;
-	uint32_t i;
+	uint32_t i, j;
 	uint32_t n_valid = rte_atomic16_read(&cont->n_valid);
 
 	for (i = 0; i < n_valid; i++) {
 		pool = cont->pools[i];
-		for (i = 0; i < MLX5_COUNTERS_PER_POOL; ++i) {
-			cnt = MLX5_GET_POOL_CNT_EXT(pool, i);
+		for (j = 0; j < MLX5_COUNTERS_PER_POOL; ++j) {
+			cnt = MLX5_GET_POOL_CNT_EXT(pool, j);
 			if (cnt->ref_cnt && cnt->shared && cnt->id == id) {
 				if (ppool)
 					*ppool = cont->pools[i];
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix shared counter search with nested index
  2020-05-15  8:36 [dpdk-dev] [PATCH] net/mlx5: fix shared counter search with nested index Suanming Mou
@ 2020-05-17  5:51 ` Matan Azrad
  2020-05-17  9:59 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Matan Azrad @ 2020-05-17  5:51 UTC (permalink / raw)
  To: Suanming Mou, Shahaf Shuler, Slava Ovsiienko; +Cc: dev, Raslan Darawsheh



From: Suanming Mou:
> Currently, the shared counter search uses the wrong nested index which is
> used by the pool index. The incorrect nested index using causes the search
> go to incorrect counter pool is not existed.
> 
> Add the counter index to fix the incorrect nested use case.
> 
> Fixes: 4001d7ad26d4 ("net/mlx5: change Direct Verbs counter to indexed")
> 
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>


Suggested title:
net/mlx5: fix shared counter lookup

Other than that:
Acked-by: Matan Azrad <matan@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index 71da5fb..deb4469 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -4467,15 +4467,15 @@ struct field_modify_info modify_tcp[] = {
> flow_dv_counter_shared_search(struct mlx5_pools_container *cont,
> uint32_t id,
>  			      struct mlx5_flow_counter_pool **ppool)  {
> -	static struct mlx5_flow_counter_ext *cnt;
> +	struct mlx5_flow_counter_ext *cnt;
>  	struct mlx5_flow_counter_pool *pool;
> -	uint32_t i;
> +	uint32_t i, j;
>  	uint32_t n_valid = rte_atomic16_read(&cont->n_valid);
> 
>  	for (i = 0; i < n_valid; i++) {
>  		pool = cont->pools[i];
> -		for (i = 0; i < MLX5_COUNTERS_PER_POOL; ++i) {
> -			cnt = MLX5_GET_POOL_CNT_EXT(pool, i);
> +		for (j = 0; j < MLX5_COUNTERS_PER_POOL; ++j) {
> +			cnt = MLX5_GET_POOL_CNT_EXT(pool, j);
>  			if (cnt->ref_cnt && cnt->shared && cnt->id == id) {
>  				if (ppool)
>  					*ppool = cont->pools[i];
> --
> 1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix shared counter search with nested index
  2020-05-15  8:36 [dpdk-dev] [PATCH] net/mlx5: fix shared counter search with nested index Suanming Mou
  2020-05-17  5:51 ` Matan Azrad
@ 2020-05-17  9:59 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-05-17  9:59 UTC (permalink / raw)
  To: Suanming Mou, Matan Azrad, Shahaf Shuler, Slava Ovsiienko; +Cc: dev

Hi,

> -----Original Message-----
> From: Suanming Mou <suanmingm@mellanox.com>
> Sent: Friday, May 15, 2020 11:36 AM
> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@mellanox.com>
> Subject: [PATCH] net/mlx5: fix shared counter search with nested index
> 
> Currently, the shared counter search uses the wrong nested index which
> is used by the pool index. The incorrect nested index using causes the
> search go to incorrect counter pool is not existed.
> 
> Add the counter index to fix the incorrect nested use case.
> 
> Fixes: 4001d7ad26d4 ("net/mlx5: change Direct Verbs counter to indexed")
> 
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 71da5fb..deb4469 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -4467,15 +4467,15 @@ struct field_modify_info modify_tcp[] = {
>  flow_dv_counter_shared_search(struct mlx5_pools_container *cont,
> uint32_t id,
>  			      struct mlx5_flow_counter_pool **ppool)
>  {
> -	static struct mlx5_flow_counter_ext *cnt;
> +	struct mlx5_flow_counter_ext *cnt;
>  	struct mlx5_flow_counter_pool *pool;
> -	uint32_t i;
> +	uint32_t i, j;
>  	uint32_t n_valid = rte_atomic16_read(&cont->n_valid);
> 
>  	for (i = 0; i < n_valid; i++) {
>  		pool = cont->pools[i];
> -		for (i = 0; i < MLX5_COUNTERS_PER_POOL; ++i) {
> -			cnt = MLX5_GET_POOL_CNT_EXT(pool, i);
> +		for (j = 0; j < MLX5_COUNTERS_PER_POOL; ++j) {
> +			cnt = MLX5_GET_POOL_CNT_EXT(pool, j);
>  			if (cnt->ref_cnt && cnt->shared && cnt->id == id) {
>  				if (ppool)
>  					*ppool = cont->pools[i];
> --
> 1.8.3.1

Title changed to:
net/mlx5: fix shared counter lookup

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2020-05-17  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15  8:36 [dpdk-dev] [PATCH] net/mlx5: fix shared counter search with nested index Suanming Mou
2020-05-17  5:51 ` Matan Azrad
2020-05-17  9:59 ` Raslan Darawsheh

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