DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix indexed pool 32-bits build error
@ 2020-04-18  1:44 Suanming Mou
  2020-04-19 11:12 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Suanming Mou @ 2020-04-18  1:44 UTC (permalink / raw)
  To: matan, viacheslavo; +Cc: ferruh.yigit, rasland, dev

Currently, 32-bits compiler treats int64_t as long long int different
with 64-bits. The indexed pool dump function build will be failed in
32-bits mode.

As the maximum supported entries of the indexed pool is UINT32_MAX, use
the 64 bits to record the pool statistics is waste of memory. Align the
statistics value type to uint32_t.

Fixes: 1702f7848f6a ("net/mlx5: add indexed memory pool")

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
---
 drivers/net/mlx5/mlx5_utils.c |  4 ++--
 drivers/net/mlx5/mlx5_utils.h | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c
index 7683167..07a6283 100644
--- a/drivers/net/mlx5/mlx5_utils.c
+++ b/drivers/net/mlx5/mlx5_utils.c
@@ -472,8 +472,8 @@ struct mlx5_indexed_pool *
 	       pool->cfg.type, pool->cfg.size, pool->n_trunk_valid,
 	       pool->cfg.trunk_size, pool->n_trunk_valid);
 #ifdef POOL_DEBUG
-	printf("Pool %s entry %ld, trunk alloc %ld, empty: %ld, "
-	       "available %ld free %ld\n",
+	printf("Pool %s entry %u, trunk alloc %u, empty: %u, "
+	       "available %u free %u\n",
 	       pool->cfg.type, pool->n_entry, pool->trunk_new,
 	       pool->trunk_empty, pool->trunk_avail, pool->trunk_free);
 #endif
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index 1051b12..d81ace3 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -127,11 +127,11 @@ struct mlx5_indexed_pool {
 	struct mlx5_indexed_trunk **trunks;
 	uint32_t free_list; /* Index to first free trunk. */
 #ifdef POOL_DEBUG
-	int64_t n_entry;
-	int64_t trunk_new;
-	int64_t trunk_avail;
-	int64_t trunk_empty;
-	int64_t trunk_free;
+	uint32_t n_entry;
+	uint32_t trunk_new;
+	uint32_t trunk_avail;
+	uint32_t trunk_empty;
+	uint32_t trunk_free;
 #endif
 	uint32_t grow_tbl[]; /* Save the index offset for the grow trunks. */
 };
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix indexed pool 32-bits build error
  2020-04-18  1:44 [dpdk-dev] [PATCH] net/mlx5: fix indexed pool 32-bits build error Suanming Mou
@ 2020-04-19 11:12 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2020-04-19 11:12 UTC (permalink / raw)
  To: Suanming Mou, Matan Azrad, Slava Ovsiienko; +Cc: ferruh.yigit, dev

Hi,

> -----Original Message-----
> From: Suanming Mou <suanmingm@mellanox.com>
> Sent: Saturday, April 18, 2020 4:45 AM
> To: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Cc: ferruh.yigit@intel.com; Raslan Darawsheh <rasland@mellanox.com>;
> dev@dpdk.org
> Subject: [PATCH] net/mlx5: fix indexed pool 32-bits build error
> 
> Currently, 32-bits compiler treats int64_t as long long int different
> with 64-bits. The indexed pool dump function build will be failed in
> 32-bits mode.
> 
> As the maximum supported entries of the indexed pool is UINT32_MAX, use
> the 64 bits to record the pool statistics is waste of memory. Align the
> statistics value type to uint32_t.
> 
> Fixes: 1702f7848f6a ("net/mlx5: add indexed memory pool")
> 
> Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_utils.c |  4 ++--
>  drivers/net/mlx5/mlx5_utils.h | 10 +++++-----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c
> index 7683167..07a6283 100644
> --- a/drivers/net/mlx5/mlx5_utils.c
> +++ b/drivers/net/mlx5/mlx5_utils.c
> @@ -472,8 +472,8 @@ struct mlx5_indexed_pool *
>  	       pool->cfg.type, pool->cfg.size, pool->n_trunk_valid,
>  	       pool->cfg.trunk_size, pool->n_trunk_valid);
>  #ifdef POOL_DEBUG
> -	printf("Pool %s entry %ld, trunk alloc %ld, empty: %ld, "
> -	       "available %ld free %ld\n",
> +	printf("Pool %s entry %u, trunk alloc %u, empty: %u, "
> +	       "available %u free %u\n",
>  	       pool->cfg.type, pool->n_entry, pool->trunk_new,
>  	       pool->trunk_empty, pool->trunk_avail, pool->trunk_free);
>  #endif
> diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
> index 1051b12..d81ace3 100644
> --- a/drivers/net/mlx5/mlx5_utils.h
> +++ b/drivers/net/mlx5/mlx5_utils.h
> @@ -127,11 +127,11 @@ struct mlx5_indexed_pool {
>  	struct mlx5_indexed_trunk **trunks;
>  	uint32_t free_list; /* Index to first free trunk. */
>  #ifdef POOL_DEBUG
> -	int64_t n_entry;
> -	int64_t trunk_new;
> -	int64_t trunk_avail;
> -	int64_t trunk_empty;
> -	int64_t trunk_free;
> +	uint32_t n_entry;
> +	uint32_t trunk_new;
> +	uint32_t trunk_avail;
> +	uint32_t trunk_empty;
> +	uint32_t trunk_free;
>  #endif
>  	uint32_t grow_tbl[]; /* Save the index offset for the grow trunks. */
>  };
> --
> 1.8.3.1


Patch squashed into relevant commit in next-net-mlx,
Applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2020-04-19 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18  1:44 [dpdk-dev] [PATCH] net/mlx5: fix indexed pool 32-bits build error Suanming Mou
2020-04-19 11:12 ` 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).