netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rdma: Fix res_print_uint()
@ 2022-03-02  3:06 Shangyan Zhou
  2022-03-03 18:44 ` Leon Romanovsky
  2022-03-04  3:00 ` [PATCH v2] " Shangyan Zhou
  0 siblings, 2 replies; 11+ messages in thread
From: Shangyan Zhou @ 2022-03-02  3:06 UTC (permalink / raw)
  To: netdev; +Cc: Shangyan Zhou

Print unsigned int should use "%u" instead of "%d"

Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
---
 rdma/res.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rdma/res.c b/rdma/res.c
index 21fef9bd..832b795d 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -214,7 +214,7 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
 	if (!nlattr)
 		return;
 	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
-	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
+	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %u ", val);
 }
 
 RES_FUNC(res_no_args,	RDMA_NLDEV_CMD_RES_GET,	NULL, true, 0);
-- 
2.20.1


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

* Re: [PATCH] rdma: Fix res_print_uint()
  2022-03-02  3:06 [PATCH] rdma: Fix res_print_uint() Shangyan Zhou
@ 2022-03-03 18:44 ` Leon Romanovsky
  2022-03-04  3:17   ` Shangyan Zhou
  2022-03-04  3:00 ` [PATCH v2] " Shangyan Zhou
  1 sibling, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-03 18:44 UTC (permalink / raw)
  To: Shangyan Zhou; +Cc: netdev

On Wed, Mar 02, 2022 at 11:06:41AM +0800, Shangyan Zhou wrote:
> Print unsigned int should use "%u" instead of "%d"
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
> ---
>  rdma/res.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rdma/res.c b/rdma/res.c
> index 21fef9bd..832b795d 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -214,7 +214,7 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
>  	if (!nlattr)
>  		return;
>  	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
> -	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
> +	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %u ", val);

val is uint64_t, so the more correct change will need to use print_u64(...)
and "%"PRIu64 instead of %u/%d, but I don't know if _color_ variant exists
for *_u64.

Thanks

>  }
>  
>  RES_FUNC(res_no_args,	RDMA_NLDEV_CMD_RES_GET,	NULL, true, 0);
> -- 
> 2.20.1
> 

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

* [PATCH v2] rdma: Fix res_print_uint()
  2022-03-02  3:06 [PATCH] rdma: Fix res_print_uint() Shangyan Zhou
  2022-03-03 18:44 ` Leon Romanovsky
@ 2022-03-04  3:00 ` Shangyan Zhou
  2022-03-04  7:02   ` Leon Romanovsky
  2022-03-04 12:46   ` [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64() Shangyan Zhou
  1 sibling, 2 replies; 11+ messages in thread
From: Shangyan Zhou @ 2022-03-04  3:00 UTC (permalink / raw)
  To: netdev; +Cc: leon, Shangyan Zhou

Print unsigned int64 should use print_color_u64() and fmt string should be "%" PRIu64.

Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
---
 rdma/res.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rdma/res.c b/rdma/res.c
index 21fef9bd..1af61aa6 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -214,7 +214,7 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
 	if (!nlattr)
 		return;
 	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
-	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
+	print_color_u64(PRINT_FP, COLOR_NONE, NULL, " %" PRIu64 " ", val);
 }
 
 RES_FUNC(res_no_args,	RDMA_NLDEV_CMD_RES_GET,	NULL, true, 0);
-- 
2.20.1


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

* RE: [PATCH] rdma: Fix res_print_uint()
  2022-03-03 18:44 ` Leon Romanovsky
@ 2022-03-04  3:17   ` Shangyan Zhou
  0 siblings, 0 replies; 11+ messages in thread
From: Shangyan Zhou @ 2022-03-04  3:17 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: netdev@vger.kernel.org

I'm also confused by the uint64 and %d at first. Since I encounter this problem on a 32-bit hw_counter, I thought it may assumed the input val is 32-bit.

I checked that the _color_ variant for u64 does exist, and changed my commit.

I'm a newbie to submit patch by email, I replied this email and found it created a new patch. I don't know if it is the right way. if I'm wrong, please let me know. 

Thanks!

-----Original Message-----
From: Leon Romanovsky <leon@kernel.org> 
Sent: Friday, March 4, 2022 2:44 AM
To: Shangyan Zhou <sy.zhou@hotmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] rdma: Fix res_print_uint()

On Wed, Mar 02, 2022 at 11:06:41AM +0800, Shangyan Zhou wrote:
> Print unsigned int should use "%u" instead of "%d"
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
> ---
>  rdma/res.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rdma/res.c b/rdma/res.c
> index 21fef9bd..832b795d 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -214,7 +214,7 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
>  	if (!nlattr)
>  		return;
>  	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
> -	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
> +	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %u ", val);

val is uint64_t, so the more correct change will need to use print_u64(...) and "%"PRIu64 instead of %u/%d, but I don't know if _color_ variant exists for *_u64.

Thanks

>  }
>  
>  RES_FUNC(res_no_args,	RDMA_NLDEV_CMD_RES_GET,	NULL, true, 0);
> --
> 2.20.1
> 

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

* Re: [PATCH v2] rdma: Fix res_print_uint()
  2022-03-04  3:00 ` [PATCH v2] " Shangyan Zhou
@ 2022-03-04  7:02   ` Leon Romanovsky
  2022-03-04 12:47     ` Shangyan Zhou
  2022-03-04 12:46   ` [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64() Shangyan Zhou
  1 sibling, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-04  7:02 UTC (permalink / raw)
  To: Shangyan Zhou; +Cc: netdev

On Fri, Mar 04, 2022 at 11:00:28AM +0800, Shangyan Zhou wrote:
> Print unsigned int64 should use print_color_u64() and fmt string should be "%" PRIu64.
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
> ---
>  rdma/res.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rdma/res.c b/rdma/res.c
> index 21fef9bd..1af61aa6 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -214,7 +214,7 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
>  	if (!nlattr)
>  		return;
>  	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
> -	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
> +	print_color_u64(PRINT_FP, COLOR_NONE, NULL, " %" PRIu64 " ", val);
>  }

Except the res_print_uint() that should be changed too, the patch LGTM.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64()
  2022-03-04  3:00 ` [PATCH v2] " Shangyan Zhou
  2022-03-04  7:02   ` Leon Romanovsky
@ 2022-03-04 12:46   ` Shangyan Zhou
  2022-03-04 17:33     ` Leon Romanovsky
  2022-03-06  6:56     ` [PATCH v4] rdma: Fix the logic to print unsigned int Shangyan Zhou
  1 sibling, 2 replies; 11+ messages in thread
From: Shangyan Zhou @ 2022-03-04 12:46 UTC (permalink / raw)
  To: leon; +Cc: netdev, Shangyan Zhou

Use the corresponding function and fmt string to print unsigned int32
and int64.

Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
---
 rdma/res-cq.c |  2 +-
 rdma/res-mr.c |  2 +-
 rdma/res-pd.c |  2 +-
 rdma/res.c    | 15 ++++++++++++---
 rdma/res.h    |  4 +++-
 rdma/stat.c   |  4 ++--
 6 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/rdma/res-cq.c b/rdma/res-cq.c
index 9e7c4f51..475179c8 100644
--- a/rdma/res-cq.c
+++ b/rdma/res-cq.c
@@ -112,7 +112,7 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
 	print_dev(rd, idx, name);
 	res_print_uint(rd, "cqn", cqn, nla_line[RDMA_NLDEV_ATTR_RES_CQN]);
 	res_print_uint(rd, "cqe", cqe, nla_line[RDMA_NLDEV_ATTR_RES_CQE]);
-	res_print_uint(rd, "users", users,
+	res_print_u64(rd, "users", users,
 		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
 	print_poll_ctx(rd, poll_ctx, nla_line[RDMA_NLDEV_ATTR_RES_POLL_CTX]);
 	print_cq_dim_setting(rd, nla_line[RDMA_NLDEV_ATTR_DEV_DIM]);
diff --git a/rdma/res-mr.c b/rdma/res-mr.c
index 1bf73f3a..a5b1ec5d 100644
--- a/rdma/res-mr.c
+++ b/rdma/res-mr.c
@@ -77,7 +77,7 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
 	print_key(rd, "rkey", rkey, nla_line[RDMA_NLDEV_ATTR_RES_RKEY]);
 	print_key(rd, "lkey", lkey, nla_line[RDMA_NLDEV_ATTR_RES_LKEY]);
 	print_key(rd, "iova", iova, nla_line[RDMA_NLDEV_ATTR_RES_IOVA]);
-	res_print_uint(rd, "mrlen", mrlen, nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
+	res_print_u64(rd, "mrlen", mrlen, nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
 	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
 	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
diff --git a/rdma/res-pd.c b/rdma/res-pd.c
index df538010..6fec787c 100644
--- a/rdma/res-pd.c
+++ b/rdma/res-pd.c
@@ -65,7 +65,7 @@ static int res_pd_line(struct rd *rd, const char *name, int idx,
 	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
 	print_key(rd, "local_dma_lkey", local_dma_lkey,
 		  nla_line[RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY]);
-	res_print_uint(rd, "users", users,
+	res_print_u64(rd, "users", users,
 		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
 	print_key(rd, "unsafe_global_rkey", unsafe_global_rkey,
 		  nla_line[RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]);
diff --git a/rdma/res.c b/rdma/res.c
index 21fef9bd..62599095 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -51,7 +51,7 @@ static int res_print_summary(struct rd *rd, struct nlattr **tb)
 
 		name = mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]);
 		curr = mnl_attr_get_u64(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
-		res_print_uint(
+		res_print_u64(
 			rd, name, curr,
 			nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
 	}
@@ -208,13 +208,22 @@ void print_key(struct rd *rd, const char *name, uint64_t val,
 	print_color_hex(PRINT_ANY, COLOR_NONE, name, " 0x%" PRIx64 " ", val);
 }
 
-void res_print_uint(struct rd *rd, const char *name, uint64_t val,
+void res_print_uint(struct rd *rd, const char *name, uint32_t val,
 		    struct nlattr *nlattr)
 {
 	if (!nlattr)
 		return;
 	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
-	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
+	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %" PRIu32 " ", val);
+}
+
+void res_print_u64(struct rd *rd, const char *name, uint64_t val,
+		    struct nlattr *nlattr)
+{
+	if (!nlattr)
+		return;
+	print_color_u64(PRINT_ANY, COLOR_NONE, name, name, val);
+	print_color_u64(PRINT_FP, COLOR_NONE, NULL, " %" PRIu64 " ", val);
 }
 
 RES_FUNC(res_no_args,	RDMA_NLDEV_CMD_RES_GET,	NULL, true, 0);
diff --git a/rdma/res.h b/rdma/res.h
index 58fa6ad1..90c02513 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -188,7 +188,9 @@ void print_link(struct rd *rd, uint32_t idx, const char *name, uint32_t port,
 		struct nlattr **nla_line);
 void print_key(struct rd *rd, const char *name, uint64_t val,
 	       struct nlattr *nlattr);
-void res_print_uint(struct rd *rd, const char *name, uint64_t val,
+void res_print_uint(struct rd *rd, const char *name, uint32_t val,
+		    struct nlattr *nlattr);
+void res_print_u64(struct rd *rd, const char *name, uint64_t val,
 		    struct nlattr *nlattr);
 void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line);
 const char *qp_types_to_str(uint8_t idx);
diff --git a/rdma/stat.c b/rdma/stat.c
index adfcd34a..c7da2922 100644
--- a/rdma/stat.c
+++ b/rdma/stat.c
@@ -210,7 +210,7 @@ int res_get_hwcounters(struct rd *rd, struct nlattr *hwc_table, bool print)
 		v = mnl_attr_get_u64(hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE]);
 		if (rd->pretty_output && !rd->json_output)
 			newline_indent(rd);
-		res_print_uint(rd, nm, v, hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]);
+		res_print_u64(rd, nm, v, hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]);
 	}
 
 	return MNL_CB_OK;
@@ -283,7 +283,7 @@ static int res_counter_line(struct rd *rd, const char *name, int index,
 	print_color_uint(PRINT_ANY, COLOR_NONE, "cntn", "cntn %u ", cntn);
 	if (nla_line[RDMA_NLDEV_ATTR_RES_TYPE])
 		print_qp_type(rd, qp_type);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u64(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 	res_get_hwcounters(rd, hwc_table, true);
 	isfirst = true;
-- 
2.30.2


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

* RE: [PATCH v2] rdma: Fix res_print_uint()
  2022-03-04  7:02   ` Leon Romanovsky
@ 2022-03-04 12:47     ` Shangyan Zhou
  0 siblings, 0 replies; 11+ messages in thread
From: Shangyan Zhou @ 2022-03-04 12:47 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: netdev@vger.kernel.org

Did you mean the function name?

I see some of the input values are uint32_t and other is uint64_t, so I added a res_print_u64() and submitted a new patch.

Thanks.

-----Original Message-----
From: Leon Romanovsky <leon@kernel.org> 
Sent: Friday, March 4, 2022 3:03 PM
To: Shangyan Zhou <sy.zhou@hotmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2] rdma: Fix res_print_uint()

On Fri, Mar 04, 2022 at 11:00:28AM +0800, Shangyan Zhou wrote:
> Print unsigned int64 should use print_color_u64() and fmt string should be "%" PRIu64.
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
> ---
>  rdma/res.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rdma/res.c b/rdma/res.c
> index 21fef9bd..1af61aa6 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -214,7 +214,7 @@ void res_print_uint(struct rd *rd, const char *name, uint64_t val,
>  	if (!nlattr)
>  		return;
>  	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
> -	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
> +	print_color_u64(PRINT_FP, COLOR_NONE, NULL, " %" PRIu64 " ", val);
>  }

Except the res_print_uint() that should be changed too, the patch LGTM.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64()
  2022-03-04 12:46   ` [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64() Shangyan Zhou
@ 2022-03-04 17:33     ` Leon Romanovsky
  2022-03-06  7:00       ` Shangyan Zhou
  2022-03-06  6:56     ` [PATCH v4] rdma: Fix the logic to print unsigned int Shangyan Zhou
  1 sibling, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-04 17:33 UTC (permalink / raw)
  To: Shangyan Zhou; +Cc: netdev

On Fri, Mar 04, 2022 at 08:46:37PM +0800, Shangyan Zhou wrote:
> Use the corresponding function and fmt string to print unsigned int32
> and int64.
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
> ---
>  rdma/res-cq.c |  2 +-
>  rdma/res-mr.c |  2 +-
>  rdma/res-pd.c |  2 +-
>  rdma/res.c    | 15 ++++++++++++---
>  rdma/res.h    |  4 +++-
>  rdma/stat.c   |  4 ++--
>  6 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/rdma/res-cq.c b/rdma/res-cq.c
> index 9e7c4f51..475179c8 100644
> --- a/rdma/res-cq.c
> +++ b/rdma/res-cq.c
> @@ -112,7 +112,7 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
>  	print_dev(rd, idx, name);
>  	res_print_uint(rd, "cqn", cqn, nla_line[RDMA_NLDEV_ATTR_RES_CQN]);
>  	res_print_uint(rd, "cqe", cqe, nla_line[RDMA_NLDEV_ATTR_RES_CQE]);
> -	res_print_uint(rd, "users", users,
> +	res_print_u64(rd, "users", users,
>  		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
>  	print_poll_ctx(rd, poll_ctx, nla_line[RDMA_NLDEV_ATTR_RES_POLL_CTX]);
>  	print_cq_dim_setting(rd, nla_line[RDMA_NLDEV_ATTR_DEV_DIM]);
> diff --git a/rdma/res-mr.c b/rdma/res-mr.c
> index 1bf73f3a..a5b1ec5d 100644
> --- a/rdma/res-mr.c
> +++ b/rdma/res-mr.c
> @@ -77,7 +77,7 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
>  	print_key(rd, "rkey", rkey, nla_line[RDMA_NLDEV_ATTR_RES_RKEY]);
>  	print_key(rd, "lkey", lkey, nla_line[RDMA_NLDEV_ATTR_RES_LKEY]);
>  	print_key(rd, "iova", iova, nla_line[RDMA_NLDEV_ATTR_RES_IOVA]);
> -	res_print_uint(rd, "mrlen", mrlen, nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
> +	res_print_u64(rd, "mrlen", mrlen, nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
>  	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
>  	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
>  	print_comm(rd, comm, nla_line);
> diff --git a/rdma/res-pd.c b/rdma/res-pd.c
> index df538010..6fec787c 100644
> --- a/rdma/res-pd.c
> +++ b/rdma/res-pd.c
> @@ -65,7 +65,7 @@ static int res_pd_line(struct rd *rd, const char *name, int idx,
>  	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
>  	print_key(rd, "local_dma_lkey", local_dma_lkey,
>  		  nla_line[RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY]);
> -	res_print_uint(rd, "users", users,
> +	res_print_u64(rd, "users", users,
>  		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
>  	print_key(rd, "unsafe_global_rkey", unsafe_global_rkey,
>  		  nla_line[RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]);
> diff --git a/rdma/res.c b/rdma/res.c
> index 21fef9bd..62599095 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -51,7 +51,7 @@ static int res_print_summary(struct rd *rd, struct nlattr **tb)
>  
>  		name = mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]);
>  		curr = mnl_attr_get_u64(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
> -		res_print_uint(
> +		res_print_u64(
>  			rd, name, curr,
>  			nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
>  	}
> @@ -208,13 +208,22 @@ void print_key(struct rd *rd, const char *name, uint64_t val,
>  	print_color_hex(PRINT_ANY, COLOR_NONE, name, " 0x%" PRIx64 " ", val);
>  }
>  
> -void res_print_uint(struct rd *rd, const char *name, uint64_t val,
> +void res_print_uint(struct rd *rd, const char *name, uint32_t val,
>  		    struct nlattr *nlattr)

It is res_print_u32() now and not res_print_uint().
But it is nitpicking.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* [PATCH v4] rdma: Fix the logic to print unsigned int.
  2022-03-04 12:46   ` [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64() Shangyan Zhou
  2022-03-04 17:33     ` Leon Romanovsky
@ 2022-03-06  6:56     ` Shangyan Zhou
  2022-03-07 12:49       ` Leon Romanovsky
  1 sibling, 1 reply; 11+ messages in thread
From: Shangyan Zhou @ 2022-03-06  6:56 UTC (permalink / raw)
  To: leon; +Cc: netdev, Shangyan Zhou

Use the corresponding function and fmt string to print unsigned int32
and int64.

Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
---
 rdma/res-cmid.c |  6 +++---
 rdma/res-cq.c   | 10 +++++-----
 rdma/res-ctx.c  |  4 ++--
 rdma/res-mr.c   |  8 ++++----
 rdma/res-pd.c   |  8 ++++----
 rdma/res-qp.c   |  8 ++++----
 rdma/res-srq.c  |  8 ++++----
 rdma/res.c      | 15 ++++++++++++---
 rdma/res.h      |  4 +++-
 rdma/stat-mr.c  |  2 +-
 rdma/stat.c     |  4 ++--
 11 files changed, 44 insertions(+), 33 deletions(-)

diff --git a/rdma/res-cmid.c b/rdma/res-cmid.c
index bfaa47b5..fd57dbb7 100644
--- a/rdma/res-cmid.c
+++ b/rdma/res-cmid.c
@@ -181,14 +181,14 @@ static int res_cm_id_line(struct rd *rd, const char *name, int idx,
 
 	open_json_object(NULL);
 	print_link(rd, idx, name, port, nla_line);
-	res_print_uint(rd, "cm-idn", cm_idn,
+	res_print_u32(rd, "cm-idn", cm_idn,
 		       nla_line[RDMA_NLDEV_ATTR_RES_CM_IDN]);
-	res_print_uint(rd, "lqpn", lqpn, nla_line[RDMA_NLDEV_ATTR_RES_LQPN]);
+	res_print_u32(rd, "lqpn", lqpn, nla_line[RDMA_NLDEV_ATTR_RES_LQPN]);
 	if (nla_line[RDMA_NLDEV_ATTR_RES_TYPE])
 		print_qp_type(rd, type);
 	print_cm_id_state(rd, state);
 	print_ps(rd, ps);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u32(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 
 	if (nla_line[RDMA_NLDEV_ATTR_RES_SRC_ADDR])
diff --git a/rdma/res-cq.c b/rdma/res-cq.c
index 9e7c4f51..818e1d0c 100644
--- a/rdma/res-cq.c
+++ b/rdma/res-cq.c
@@ -110,14 +110,14 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
 
 	open_json_object(NULL);
 	print_dev(rd, idx, name);
-	res_print_uint(rd, "cqn", cqn, nla_line[RDMA_NLDEV_ATTR_RES_CQN]);
-	res_print_uint(rd, "cqe", cqe, nla_line[RDMA_NLDEV_ATTR_RES_CQE]);
-	res_print_uint(rd, "users", users,
+	res_print_u32(rd, "cqn", cqn, nla_line[RDMA_NLDEV_ATTR_RES_CQN]);
+	res_print_u32(rd, "cqe", cqe, nla_line[RDMA_NLDEV_ATTR_RES_CQE]);
+	res_print_u64(rd, "users", users,
 		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
 	print_poll_ctx(rd, poll_ctx, nla_line[RDMA_NLDEV_ATTR_RES_POLL_CTX]);
 	print_cq_dim_setting(rd, nla_line[RDMA_NLDEV_ATTR_DEV_DIM]);
-	res_print_uint(rd, "ctxn", ctxn, nla_line[RDMA_NLDEV_ATTR_RES_CTXN]);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u32(rd, "ctxn", ctxn, nla_line[RDMA_NLDEV_ATTR_RES_CTXN]);
+	res_print_u32(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 
 	print_driver_table(rd, nla_line[RDMA_NLDEV_ATTR_DRIVER]);
diff --git a/rdma/res-ctx.c b/rdma/res-ctx.c
index 30afe97a..ea5faf18 100644
--- a/rdma/res-ctx.c
+++ b/rdma/res-ctx.c
@@ -40,8 +40,8 @@ static int res_ctx_line(struct rd *rd, const char *name, int idx,
 
 	open_json_object(NULL);
 	print_dev(rd, idx, name);
-	res_print_uint(rd, "ctxn", ctxn, nla_line[RDMA_NLDEV_ATTR_RES_CTXN]);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u32(rd, "ctxn", ctxn, nla_line[RDMA_NLDEV_ATTR_RES_CTXN]);
+	res_print_u32(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 
 	print_driver_table(rd, nla_line[RDMA_NLDEV_ATTR_DRIVER]);
diff --git a/rdma/res-mr.c b/rdma/res-mr.c
index 1bf73f3a..25eaa056 100644
--- a/rdma/res-mr.c
+++ b/rdma/res-mr.c
@@ -73,13 +73,13 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
 			nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME]);
 	open_json_object(NULL);
 	print_dev(rd, idx, name);
-	res_print_uint(rd, "mrn", mrn, nla_line[RDMA_NLDEV_ATTR_RES_MRN]);
+	res_print_u32(rd, "mrn", mrn, nla_line[RDMA_NLDEV_ATTR_RES_MRN]);
 	print_key(rd, "rkey", rkey, nla_line[RDMA_NLDEV_ATTR_RES_RKEY]);
 	print_key(rd, "lkey", lkey, nla_line[RDMA_NLDEV_ATTR_RES_LKEY]);
 	print_key(rd, "iova", iova, nla_line[RDMA_NLDEV_ATTR_RES_IOVA]);
-	res_print_uint(rd, "mrlen", mrlen, nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
-	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u64(rd, "mrlen", mrlen, nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
+	res_print_u32(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
+	res_print_u32(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 
 	print_driver_table(rd, nla_line[RDMA_NLDEV_ATTR_DRIVER]);
diff --git a/rdma/res-pd.c b/rdma/res-pd.c
index df538010..2932eb98 100644
--- a/rdma/res-pd.c
+++ b/rdma/res-pd.c
@@ -62,15 +62,15 @@ static int res_pd_line(struct rd *rd, const char *name, int idx,
 
 	open_json_object(NULL);
 	print_dev(rd, idx, name);
-	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
+	res_print_u32(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
 	print_key(rd, "local_dma_lkey", local_dma_lkey,
 		  nla_line[RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY]);
-	res_print_uint(rd, "users", users,
+	res_print_u64(rd, "users", users,
 		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
 	print_key(rd, "unsafe_global_rkey", unsafe_global_rkey,
 		  nla_line[RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]);
-	res_print_uint(rd, "ctxn", ctxn, nla_line[RDMA_NLDEV_ATTR_RES_CTXN]);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u32(rd, "ctxn", ctxn, nla_line[RDMA_NLDEV_ATTR_RES_CTXN]);
+	res_print_u32(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 
 	print_driver_table(rd, nla_line[RDMA_NLDEV_ATTR_DRIVER]);
diff --git a/rdma/res-qp.c b/rdma/res-qp.c
index a38be399..9218804a 100644
--- a/rdma/res-qp.c
+++ b/rdma/res-qp.c
@@ -161,19 +161,19 @@ static int res_qp_line(struct rd *rd, const char *name, int idx,
 
 	open_json_object(NULL);
 	print_link(rd, idx, name, port, nla_line);
-	res_print_uint(rd, "lqpn", lqpn, nla_line[RDMA_NLDEV_ATTR_RES_LQPN]);
+	res_print_u32(rd, "lqpn", lqpn, nla_line[RDMA_NLDEV_ATTR_RES_LQPN]);
 	print_rqpn(rd, rqpn, nla_line);
 
 	print_type(rd, type);
 	print_state(rd, state);
 
 	print_rqpsn(rd, rq_psn, nla_line);
-	res_print_uint(rd, "sq-psn", sq_psn,
+	res_print_u32(rd, "sq-psn", sq_psn,
 		       nla_line[RDMA_NLDEV_ATTR_RES_SQ_PSN]);
 
 	print_pathmig(rd, path_mig_state, nla_line);
-	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u32(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
+	res_print_u32(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 
 	print_driver_table(rd, nla_line[RDMA_NLDEV_ATTR_DRIVER]);
diff --git a/rdma/res-srq.c b/rdma/res-srq.c
index 3038c352..c6df454a 100644
--- a/rdma/res-srq.c
+++ b/rdma/res-srq.c
@@ -216,12 +216,12 @@ static int res_srq_line(struct rd *rd, const char *name, int idx,
 
 	open_json_object(NULL);
 	print_dev(rd, idx, name);
-	res_print_uint(rd, "srqn", srqn, nla_line[RDMA_NLDEV_ATTR_RES_SRQN]);
+	res_print_u32(rd, "srqn", srqn, nla_line[RDMA_NLDEV_ATTR_RES_SRQN]);
 	print_type(rd, type);
 	print_qps(qp_str);
-	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
-	res_print_uint(rd, "cqn", cqn, nla_line[RDMA_NLDEV_ATTR_RES_CQN]);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u32(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
+	res_print_u32(rd, "cqn", cqn, nla_line[RDMA_NLDEV_ATTR_RES_CQN]);
+	res_print_u32(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 
 	print_driver_table(rd, nla_line[RDMA_NLDEV_ATTR_DRIVER]);
diff --git a/rdma/res.c b/rdma/res.c
index 21fef9bd..854f21c7 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -51,7 +51,7 @@ static int res_print_summary(struct rd *rd, struct nlattr **tb)
 
 		name = mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]);
 		curr = mnl_attr_get_u64(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
-		res_print_uint(
+		res_print_u64(
 			rd, name, curr,
 			nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
 	}
@@ -208,13 +208,22 @@ void print_key(struct rd *rd, const char *name, uint64_t val,
 	print_color_hex(PRINT_ANY, COLOR_NONE, name, " 0x%" PRIx64 " ", val);
 }
 
-void res_print_uint(struct rd *rd, const char *name, uint64_t val,
+void res_print_u32(struct rd *rd, const char *name, uint32_t val,
 		    struct nlattr *nlattr)
 {
 	if (!nlattr)
 		return;
 	print_color_uint(PRINT_ANY, COLOR_NONE, name, name, val);
-	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %d ", val);
+	print_color_uint(PRINT_FP, COLOR_NONE, NULL, " %" PRIu32 " ", val);
+}
+
+void res_print_u64(struct rd *rd, const char *name, uint64_t val,
+		    struct nlattr *nlattr)
+{
+	if (!nlattr)
+		return;
+	print_color_u64(PRINT_ANY, COLOR_NONE, name, name, val);
+	print_color_u64(PRINT_FP, COLOR_NONE, NULL, " %" PRIu64 " ", val);
 }
 
 RES_FUNC(res_no_args,	RDMA_NLDEV_CMD_RES_GET,	NULL, true, 0);
diff --git a/rdma/res.h b/rdma/res.h
index 58fa6ad1..70e51acd 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -188,7 +188,9 @@ void print_link(struct rd *rd, uint32_t idx, const char *name, uint32_t port,
 		struct nlattr **nla_line);
 void print_key(struct rd *rd, const char *name, uint64_t val,
 	       struct nlattr *nlattr);
-void res_print_uint(struct rd *rd, const char *name, uint64_t val,
+void res_print_u32(struct rd *rd, const char *name, uint32_t val,
+		    struct nlattr *nlattr);
+void res_print_u64(struct rd *rd, const char *name, uint64_t val,
 		    struct nlattr *nlattr);
 void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line);
 const char *qp_types_to_str(uint8_t idx);
diff --git a/rdma/stat-mr.c b/rdma/stat-mr.c
index f39526b4..2ba6cb07 100644
--- a/rdma/stat-mr.c
+++ b/rdma/stat-mr.c
@@ -22,7 +22,7 @@ static int stat_mr_line(struct rd *rd, const char *name, int idx,
 
 	open_json_object(NULL);
 	print_dev(rd, idx, name);
-	res_print_uint(rd, "mrn", mrn, nla_line[RDMA_NLDEV_ATTR_RES_MRN]);
+	res_print_u32(rd, "mrn", mrn, nla_line[RDMA_NLDEV_ATTR_RES_MRN]);
 
 	if (nla_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS]) {
 		ret = res_get_hwcounters(
diff --git a/rdma/stat.c b/rdma/stat.c
index adfcd34a..c7da2922 100644
--- a/rdma/stat.c
+++ b/rdma/stat.c
@@ -210,7 +210,7 @@ int res_get_hwcounters(struct rd *rd, struct nlattr *hwc_table, bool print)
 		v = mnl_attr_get_u64(hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE]);
 		if (rd->pretty_output && !rd->json_output)
 			newline_indent(rd);
-		res_print_uint(rd, nm, v, hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]);
+		res_print_u64(rd, nm, v, hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]);
 	}
 
 	return MNL_CB_OK;
@@ -283,7 +283,7 @@ static int res_counter_line(struct rd *rd, const char *name, int index,
 	print_color_uint(PRINT_ANY, COLOR_NONE, "cntn", "cntn %u ", cntn);
 	if (nla_line[RDMA_NLDEV_ATTR_RES_TYPE])
 		print_qp_type(rd, qp_type);
-	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
+	res_print_u64(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
 	print_comm(rd, comm, nla_line);
 	res_get_hwcounters(rd, hwc_table, true);
 	isfirst = true;
-- 
2.30.2


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

* RE: [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64()
  2022-03-04 17:33     ` Leon Romanovsky
@ 2022-03-06  7:00       ` Shangyan Zhou
  0 siblings, 0 replies; 11+ messages in thread
From: Shangyan Zhou @ 2022-03-06  7:00 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: netdev@vger.kernel.org

Got it. I renamed it and submitted a new version. 

Thanks.

-----Original Message-----
From: Leon Romanovsky <leon@kernel.org> 
Sent: Saturday, March 5, 2022 1:34 AM
To: Shangyan Zhou <sy.zhou@hotmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64()

On Fri, Mar 04, 2022 at 08:46:37PM +0800, Shangyan Zhou wrote:
> Use the corresponding function and fmt string to print unsigned int32 
> and int64.
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
> ---
>  rdma/res-cq.c |  2 +-
>  rdma/res-mr.c |  2 +-
>  rdma/res-pd.c |  2 +-
>  rdma/res.c    | 15 ++++++++++++---
>  rdma/res.h    |  4 +++-
>  rdma/stat.c   |  4 ++--
>  6 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/rdma/res-cq.c b/rdma/res-cq.c index 9e7c4f51..475179c8 
> 100644
> --- a/rdma/res-cq.c
> +++ b/rdma/res-cq.c
> @@ -112,7 +112,7 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
>  	print_dev(rd, idx, name);
>  	res_print_uint(rd, "cqn", cqn, nla_line[RDMA_NLDEV_ATTR_RES_CQN]);
>  	res_print_uint(rd, "cqe", cqe, nla_line[RDMA_NLDEV_ATTR_RES_CQE]);
> -	res_print_uint(rd, "users", users,
> +	res_print_u64(rd, "users", users,
>  		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
>  	print_poll_ctx(rd, poll_ctx, nla_line[RDMA_NLDEV_ATTR_RES_POLL_CTX]);
>  	print_cq_dim_setting(rd, nla_line[RDMA_NLDEV_ATTR_DEV_DIM]);
> diff --git a/rdma/res-mr.c b/rdma/res-mr.c index 1bf73f3a..a5b1ec5d 
> 100644
> --- a/rdma/res-mr.c
> +++ b/rdma/res-mr.c
> @@ -77,7 +77,7 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
>  	print_key(rd, "rkey", rkey, nla_line[RDMA_NLDEV_ATTR_RES_RKEY]);
>  	print_key(rd, "lkey", lkey, nla_line[RDMA_NLDEV_ATTR_RES_LKEY]);
>  	print_key(rd, "iova", iova, nla_line[RDMA_NLDEV_ATTR_RES_IOVA]);
> -	res_print_uint(rd, "mrlen", mrlen, nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
> +	res_print_u64(rd, "mrlen", mrlen, 
> +nla_line[RDMA_NLDEV_ATTR_RES_MRLEN]);
>  	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
>  	res_print_uint(rd, "pid", pid, nla_line[RDMA_NLDEV_ATTR_RES_PID]);
>  	print_comm(rd, comm, nla_line);
> diff --git a/rdma/res-pd.c b/rdma/res-pd.c index df538010..6fec787c 
> 100644
> --- a/rdma/res-pd.c
> +++ b/rdma/res-pd.c
> @@ -65,7 +65,7 @@ static int res_pd_line(struct rd *rd, const char *name, int idx,
>  	res_print_uint(rd, "pdn", pdn, nla_line[RDMA_NLDEV_ATTR_RES_PDN]);
>  	print_key(rd, "local_dma_lkey", local_dma_lkey,
>  		  nla_line[RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY]);
> -	res_print_uint(rd, "users", users,
> +	res_print_u64(rd, "users", users,
>  		       nla_line[RDMA_NLDEV_ATTR_RES_USECNT]);
>  	print_key(rd, "unsafe_global_rkey", unsafe_global_rkey,
>  		  nla_line[RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]);
> diff --git a/rdma/res.c b/rdma/res.c
> index 21fef9bd..62599095 100644
> --- a/rdma/res.c
> +++ b/rdma/res.c
> @@ -51,7 +51,7 @@ static int res_print_summary(struct rd *rd, struct 
> nlattr **tb)
>  
>  		name = mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]);
>  		curr = mnl_attr_get_u64(nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
> -		res_print_uint(
> +		res_print_u64(
>  			rd, name, curr,
>  			nla_line[RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR]);
>  	}
> @@ -208,13 +208,22 @@ void print_key(struct rd *rd, const char *name, uint64_t val,
>  	print_color_hex(PRINT_ANY, COLOR_NONE, name, " 0x%" PRIx64 " ", 
> val);  }
>  
> -void res_print_uint(struct rd *rd, const char *name, uint64_t val,
> +void res_print_uint(struct rd *rd, const char *name, uint32_t val,
>  		    struct nlattr *nlattr)

It is res_print_u32() now and not res_print_uint().
But it is nitpicking.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH v4] rdma: Fix the logic to print unsigned int.
  2022-03-06  6:56     ` [PATCH v4] rdma: Fix the logic to print unsigned int Shangyan Zhou
@ 2022-03-07 12:49       ` Leon Romanovsky
  0 siblings, 0 replies; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-07 12:49 UTC (permalink / raw)
  To: Shangyan Zhou; +Cc: netdev

On Sun, Mar 06, 2022 at 02:56:06PM +0800, Shangyan Zhou wrote:
> Use the corresponding function and fmt string to print unsigned int32
> and int64.
> 
> Signed-off-by: Shangyan Zhou <sy.zhou@hotmail.com>
> ---
>  rdma/res-cmid.c |  6 +++---
>  rdma/res-cq.c   | 10 +++++-----
>  rdma/res-ctx.c  |  4 ++--
>  rdma/res-mr.c   |  8 ++++----
>  rdma/res-pd.c   |  8 ++++----
>  rdma/res-qp.c   |  8 ++++----
>  rdma/res-srq.c  |  8 ++++----
>  rdma/res.c      | 15 ++++++++++++---
>  rdma/res.h      |  4 +++-
>  rdma/stat-mr.c  |  2 +-
>  rdma/stat.c     |  4 ++--
>  11 files changed, 44 insertions(+), 33 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

end of thread, other threads:[~2022-03-07 12:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-02  3:06 [PATCH] rdma: Fix res_print_uint() Shangyan Zhou
2022-03-03 18:44 ` Leon Romanovsky
2022-03-04  3:17   ` Shangyan Zhou
2022-03-04  3:00 ` [PATCH v2] " Shangyan Zhou
2022-03-04  7:02   ` Leon Romanovsky
2022-03-04 12:47     ` Shangyan Zhou
2022-03-04 12:46   ` [PATCH v3] rdma: Fix res_print_uint() and add res_print_u64() Shangyan Zhou
2022-03-04 17:33     ` Leon Romanovsky
2022-03-06  7:00       ` Shangyan Zhou
2022-03-06  6:56     ` [PATCH v4] rdma: Fix the logic to print unsigned int Shangyan Zhou
2022-03-07 12:49       ` Leon Romanovsky

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