netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 iproute2-next 0/2] rdma: Support dumping SRQ resource in raw format
@ 2023-10-10  7:55 Junxian Huang
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 1/2] rdma: Update uapi headers Junxian Huang
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Junxian Huang @ 2023-10-10  7:55 UTC (permalink / raw)
  To: jgg, leon, dsahern, stephen
  Cc: netdev, linux-rdma, linuxarm, linux-kernel, huangjunxian6

This patchset adds support to dump SRQ resource in raw format with
rdmatool. The corresponding kernel commit is aebf8145e11a
("RDMA/core: Add support to dump SRQ resource in RAW format")

v2 adds the missing change in res_srq_idx_parse_cb().

Junxian Huang (1):
  rdma: Update uapi headers

wenglianfa (1):
  rdma: Add support to dump SRQ resource in raw format

 rdma/include/uapi/rdma/rdma_netlink.h |  2 ++
 rdma/res-srq.c                        | 20 ++++++++++++++++++--
 rdma/res.h                            |  2 ++
 3 files changed, 22 insertions(+), 2 deletions(-)

--
2.30.0


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

* [PATCH v2 iproute2-next 1/2] rdma: Update uapi headers
  2023-10-10  7:55 [PATCH v2 iproute2-next 0/2] rdma: Support dumping SRQ resource in raw format Junxian Huang
@ 2023-10-10  7:55 ` Junxian Huang
  2023-10-15  8:14   ` Leon Romanovsky
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format Junxian Huang
  2023-10-16 16:20 ` [PATCH v2 iproute2-next 0/2] rdma: Support dumping " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 8+ messages in thread
From: Junxian Huang @ 2023-10-10  7:55 UTC (permalink / raw)
  To: jgg, leon, dsahern, stephen
  Cc: netdev, linux-rdma, linuxarm, linux-kernel, huangjunxian6

Update rdma_netlink.h file upto kernel commit aebf8145e11a
("RDMA/core: Add support to dump SRQ resource in RAW format")

Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
---
 rdma/include/uapi/rdma/rdma_netlink.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
index 92c528a0..84f775be 100644
--- a/rdma/include/uapi/rdma/rdma_netlink.h
+++ b/rdma/include/uapi/rdma/rdma_netlink.h
@@ -299,6 +299,8 @@ enum rdma_nldev_command {
 
 	RDMA_NLDEV_CMD_STAT_GET_STATUS,
 
+	RDMA_NLDEV_CMD_RES_SRQ_GET_RAW,
+
 	RDMA_NLDEV_NUM_OPS
 };
 
-- 
2.30.0


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

* [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format
  2023-10-10  7:55 [PATCH v2 iproute2-next 0/2] rdma: Support dumping SRQ resource in raw format Junxian Huang
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 1/2] rdma: Update uapi headers Junxian Huang
@ 2023-10-10  7:55 ` Junxian Huang
  2023-10-15  8:15   ` Leon Romanovsky
  2023-10-16  3:54   ` David Ahern
  2023-10-16 16:20 ` [PATCH v2 iproute2-next 0/2] rdma: Support dumping " patchwork-bot+netdevbpf
  2 siblings, 2 replies; 8+ messages in thread
From: Junxian Huang @ 2023-10-10  7:55 UTC (permalink / raw)
  To: jgg, leon, dsahern, stephen
  Cc: netdev, linux-rdma, linuxarm, linux-kernel, huangjunxian6

From: wenglianfa <wenglianfa@huawei.com>

Add support to dump SRQ resource in raw format.

This patch relies on the corresponding kernel commit aebf8145e11a
("RDMA/core: Add support to dump SRQ resource in RAW format")

Example:
$ rdma res show srq -r
dev hns3 149000...

$ rdma res show srq -j -r
[{"ifindex":0,"ifname":"hns3","data":[149,0,0,...]}]

Signed-off-by: wenglianfa <wenglianfa@huawei.com>
---
 rdma/res-srq.c | 20 ++++++++++++++++++--
 rdma/res.h     |  2 ++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/rdma/res-srq.c b/rdma/res-srq.c
index 186ae281..cf9209d7 100644
--- a/rdma/res-srq.c
+++ b/rdma/res-srq.c
@@ -162,6 +162,20 @@ out:
 	return -EINVAL;
 }
 
+static int res_srq_line_raw(struct rd *rd, const char *name, int idx,
+			    struct nlattr **nla_line)
+{
+	if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
+		return MNL_CB_ERROR;
+
+	open_json_object(NULL);
+	print_dev(rd, idx, name);
+	print_raw_data(rd, nla_line);
+	newline(rd);
+
+	return MNL_CB_OK;
+}
+
 static int res_srq_line(struct rd *rd, const char *name, int idx,
 			struct nlattr **nla_line)
 {
@@ -248,7 +262,8 @@ int res_srq_idx_parse_cb(const struct nlmsghdr *nlh, void *data)
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
 	idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
 
-	return res_srq_line(rd, name, idx, tb);
+	return (rd->show_raw) ? res_srq_line_raw(rd, name, idx, tb) :
+		res_srq_line(rd, name, idx, tb);
 }
 
 int res_srq_parse_cb(const struct nlmsghdr *nlh, void *data)
@@ -276,7 +291,8 @@ int res_srq_parse_cb(const struct nlmsghdr *nlh, void *data)
 		if (ret != MNL_CB_OK)
 			break;
 
-		ret = res_srq_line(rd, name, idx, nla_line);
+		ret = (rd->show_raw) ? res_srq_line_raw(rd, name, idx, nla_line) :
+		       res_srq_line(rd, name, idx, nla_line);
 		if (ret != MNL_CB_OK)
 			break;
 	}
diff --git a/rdma/res.h b/rdma/res.h
index 70e51acd..e880c28b 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -39,6 +39,8 @@ static inline uint32_t res_get_command(uint32_t command, struct rd *rd)
 		return RDMA_NLDEV_CMD_RES_CQ_GET_RAW;
 	case RDMA_NLDEV_CMD_RES_MR_GET:
 		return RDMA_NLDEV_CMD_RES_MR_GET_RAW;
+	case RDMA_NLDEV_CMD_RES_SRQ_GET:
+		return RDMA_NLDEV_CMD_RES_SRQ_GET_RAW;
 	default:
 		return command;
 	}
-- 
2.30.0


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

* Re: [PATCH v2 iproute2-next 1/2] rdma: Update uapi headers
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 1/2] rdma: Update uapi headers Junxian Huang
@ 2023-10-15  8:14   ` Leon Romanovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2023-10-15  8:14 UTC (permalink / raw)
  To: Junxian Huang
  Cc: jgg, dsahern, stephen, netdev, linux-rdma, linuxarm, linux-kernel

On Tue, Oct 10, 2023 at 03:55:25PM +0800, Junxian Huang wrote:
> Update rdma_netlink.h file upto kernel commit aebf8145e11a
> ("RDMA/core: Add support to dump SRQ resource in RAW format")
> 
> Signed-off-by: wenglianfa <wenglianfa@huawei.com>
> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
> ---
>  rdma/include/uapi/rdma/rdma_netlink.h | 2 ++
>  1 file changed, 2 insertions(+)
> 

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

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

* Re: [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format Junxian Huang
@ 2023-10-15  8:15   ` Leon Romanovsky
  2023-10-16  3:54   ` David Ahern
  1 sibling, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2023-10-15  8:15 UTC (permalink / raw)
  To: Junxian Huang
  Cc: jgg, dsahern, stephen, netdev, linux-rdma, linuxarm, linux-kernel

On Tue, Oct 10, 2023 at 03:55:26PM +0800, Junxian Huang wrote:
> From: wenglianfa <wenglianfa@huawei.com>
> 
> Add support to dump SRQ resource in raw format.
> 
> This patch relies on the corresponding kernel commit aebf8145e11a
> ("RDMA/core: Add support to dump SRQ resource in RAW format")
> 
> Example:
> $ rdma res show srq -r
> dev hns3 149000...
> 
> $ rdma res show srq -j -r
> [{"ifindex":0,"ifname":"hns3","data":[149,0,0,...]}]
> 
> Signed-off-by: wenglianfa <wenglianfa@huawei.com>
> ---
>  rdma/res-srq.c | 20 ++++++++++++++++++--
>  rdma/res.h     |  2 ++
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 

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

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

* Re: [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format Junxian Huang
  2023-10-15  8:15   ` Leon Romanovsky
@ 2023-10-16  3:54   ` David Ahern
  2023-10-16  6:31     ` Leon Romanovsky
  1 sibling, 1 reply; 8+ messages in thread
From: David Ahern @ 2023-10-16  3:54 UTC (permalink / raw)
  To: Junxian Huang, jgg, leon, stephen
  Cc: netdev, linux-rdma, linuxarm, linux-kernel

On 10/10/23 1:55 AM, Junxian Huang wrote:
> @@ -162,6 +162,20 @@ out:
>  	return -EINVAL;
>  }
>  
> +static int res_srq_line_raw(struct rd *rd, const char *name, int idx,
> +			    struct nlattr **nla_line)
> +{
> +	if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
> +		return MNL_CB_ERROR;
> +
> +	open_json_object(NULL);

open_json_object with no corresponding close.

> +	print_dev(rd, idx, name);
> +	print_raw_data(rd, nla_line);
> +	newline(rd);
> +
> +	return MNL_CB_OK;
> +}
> +
>  static int res_srq_line(struct rd *rd, const char *name, int idx,
>  			struct nlattr **nla_line)
>  {



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

* Re: [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format
  2023-10-16  3:54   ` David Ahern
@ 2023-10-16  6:31     ` Leon Romanovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2023-10-16  6:31 UTC (permalink / raw)
  To: David Ahern
  Cc: Junxian Huang, jgg, stephen, netdev, linux-rdma, linuxarm,
	linux-kernel

On Sun, Oct 15, 2023 at 09:54:14PM -0600, David Ahern wrote:
> On 10/10/23 1:55 AM, Junxian Huang wrote:
> > @@ -162,6 +162,20 @@ out:
> >  	return -EINVAL;
> >  }
> >  
> > +static int res_srq_line_raw(struct rd *rd, const char *name, int idx,
> > +			    struct nlattr **nla_line)
> > +{
> > +	if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
> > +		return MNL_CB_ERROR;
> > +
> > +	open_json_object(NULL);
> 
> open_json_object with no corresponding close.
> 
> > +	print_dev(rd, idx, name);
> > +	print_raw_data(rd, nla_line);
> > +	newline(rd);

It is here ^^^^.

  773 void newline(struct rd *rd)
  774 {
  775         close_json_object();
  776         print_color_string(PRINT_FP, COLOR_NONE, NULL, "\n", NULL);
  777 }
  778


> > +
> > +	return MNL_CB_OK;
> > +}
> > +
> >  static int res_srq_line(struct rd *rd, const char *name, int idx,
> >  			struct nlattr **nla_line)
> >  {
> 
> 

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

* Re: [PATCH v2 iproute2-next 0/2] rdma: Support dumping SRQ resource in raw format
  2023-10-10  7:55 [PATCH v2 iproute2-next 0/2] rdma: Support dumping SRQ resource in raw format Junxian Huang
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 1/2] rdma: Update uapi headers Junxian Huang
  2023-10-10  7:55 ` [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format Junxian Huang
@ 2023-10-16 16:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-16 16:20 UTC (permalink / raw)
  To: Junxian Huang
  Cc: jgg, leon, dsahern, stephen, netdev, linux-rdma, linuxarm,
	linux-kernel

Hello:

This series was applied to iproute2/iproute2-next.git (main)
by David Ahern <dsahern@kernel.org>:

On Tue, 10 Oct 2023 15:55:24 +0800 you wrote:
> This patchset adds support to dump SRQ resource in raw format with
> rdmatool. The corresponding kernel commit is aebf8145e11a
> ("RDMA/core: Add support to dump SRQ resource in RAW format")
> 
> v2 adds the missing change in res_srq_idx_parse_cb().
> 
> Junxian Huang (1):
>   rdma: Update uapi headers
> 
> [...]

Here is the summary with links:
  - [v2,iproute2-next,1/2] rdma: Update uapi headers
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=cd4315de422e
  - [v2,iproute2-next,2/2] rdma: Add support to dump SRQ resource in raw format
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=07bfa4482d49

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-10-16 16:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10  7:55 [PATCH v2 iproute2-next 0/2] rdma: Support dumping SRQ resource in raw format Junxian Huang
2023-10-10  7:55 ` [PATCH v2 iproute2-next 1/2] rdma: Update uapi headers Junxian Huang
2023-10-15  8:14   ` Leon Romanovsky
2023-10-10  7:55 ` [PATCH v2 iproute2-next 2/2] rdma: Add support to dump SRQ resource in raw format Junxian Huang
2023-10-15  8:15   ` Leon Romanovsky
2023-10-16  3:54   ` David Ahern
2023-10-16  6:31     ` Leon Romanovsky
2023-10-16 16:20 ` [PATCH v2 iproute2-next 0/2] rdma: Support dumping " patchwork-bot+netdevbpf

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