All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-next v1 0/4] rdma: IB device rename
@ 2018-10-31  7:17 Leon Romanovsky
  2018-10-31  7:17 ` [PATCH iproute2-next v1 1/4] rdma: Update kernel include file to support IB device renaming Leon Romanovsky
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Leon Romanovsky @ 2018-10-31  7:17 UTC (permalink / raw)
  To: David Ahern
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

From: Leon Romanovsky <leonro@mellanox.com>

Changelog:
v0->v1:
 * Added Steve's ROB on first three patches.
 * Updated manual
RFC->v0
 * Dropped RFC tag after kernel part was accepted
 * Updated commit message of first patch to include correct SHA1
-----------------------------------------------------------------------

Hi,

This is comprehensive part of kernel series posted earlier. The kernel
part is not accepted yet, so first patch will have different commit
message with different commit SHA1. This is why it is marked as RFC.

An example:

[leonro@server /]$ lspci |grep -i Ether
00:08.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:09.0 Ethernet controller: Mellanox Technologies MT27700 Family [ConnectX-4]
[leonro@server /]$ sudo rdma dev
1: mlx5_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455 sys_image_guid 5254:00c0:fe12:3455
[leonro@server /]$ sudo rdma dev set mlx5_0 name hfi1_0
[leonro@server /]$ sudo rdma dev
1: hfi1_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455 sys_image_guid 5254:00c0:fe12:3455

Thanks

Leon Romanovsky (4):
  rdma: Update kernel include file to support IB device renaming
  rdma: Introduce command execution helper with required device name
  rdma: Add an option to rename IB device interface
  rdma: Document IB device renaming option

 man/man8/rdma-dev.8                   | 13 +++++++++++++
 rdma/dev.c                            | 35 +++++++++++++++++++++++++++++++++++
 rdma/include/uapi/rdma/rdma_netlink.h |  3 ++-
 rdma/rdma.h                           |  1 +
 rdma/utils.c                          | 10 ++++++++++
 5 files changed, 61 insertions(+), 1 deletion(-)

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

* [PATCH iproute2-next v1 1/4] rdma: Update kernel include file to support IB device renaming
  2018-10-31  7:17 [PATCH iproute2-next v1 0/4] rdma: IB device rename Leon Romanovsky
@ 2018-10-31  7:17 ` Leon Romanovsky
  2018-11-02 16:43   ` David Ahern
  2018-10-31  7:17 ` [PATCH iproute2-next v1 2/4] rdma: Introduce command execution helper with required device name Leon Romanovsky
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Leon Romanovsky @ 2018-10-31  7:17 UTC (permalink / raw)
  To: David Ahern
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

From: Leon Romanovsky <leonro@mellanox.com>

Bring kernel header file changes upto commit 05d940d3a3ec
("RDMA/nldev: Allow IB device rename through RDMA netlink")

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
---
 rdma/include/uapi/rdma/rdma_netlink.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
index 6513fb89..e2228c09 100644
--- a/rdma/include/uapi/rdma/rdma_netlink.h
+++ b/rdma/include/uapi/rdma/rdma_netlink.h
@@ -227,8 +227,9 @@ enum rdma_nldev_command {
 	RDMA_NLDEV_CMD_UNSPEC,
 
 	RDMA_NLDEV_CMD_GET, /* can dump */
+	RDMA_NLDEV_CMD_SET,
 
-	/* 2 - 4 are free to use */
+	/* 3 - 4 are free to use */
 
 	RDMA_NLDEV_CMD_PORT_GET = 5, /* can dump */
 
-- 
2.14.4

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

* [PATCH iproute2-next v1 2/4] rdma: Introduce command execution helper with required device name
  2018-10-31  7:17 [PATCH iproute2-next v1 0/4] rdma: IB device rename Leon Romanovsky
  2018-10-31  7:17 ` [PATCH iproute2-next v1 1/4] rdma: Update kernel include file to support IB device renaming Leon Romanovsky
@ 2018-10-31  7:17 ` Leon Romanovsky
  2018-11-02 16:43   ` David Ahern
  2018-10-31  7:17 ` [PATCH iproute2-next v1 3/4] rdma: Add an option to rename IB device interface Leon Romanovsky
  2018-10-31  7:17 ` [PATCH iproute2-next v1 4/4] rdma: Document IB device renaming option Leon Romanovsky
  3 siblings, 1 reply; 10+ messages in thread
From: Leon Romanovsky @ 2018-10-31  7:17 UTC (permalink / raw)
  To: David Ahern
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

From: Leon Romanovsky <leonro@mellanox.com>

In contradiction to various show commands, the set command explicitly
requires to use device name as an argument. Provide new command
execution helper which enforces it.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
---
 rdma/rdma.h  |  1 +
 rdma/utils.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/rdma/rdma.h b/rdma/rdma.h
index c3b7530b..547bb574 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -90,6 +90,7 @@ int cmd_link(struct rd *rd);
 int cmd_res(struct rd *rd);
 int rd_exec_cmd(struct rd *rd, const struct rd_cmd *c, const char *str);
 int rd_exec_dev(struct rd *rd, int (*cb)(struct rd *rd));
+int rd_exec_require_dev(struct rd *rd, int (*cb)(struct rd *rd));
 int rd_exec_link(struct rd *rd, int (*cb)(struct rd *rd), bool strict_port);
 void rd_free(struct rd *rd);
 int rd_set_arg_to_devname(struct rd *rd);
diff --git a/rdma/utils.c b/rdma/utils.c
index 4840bf22..61f4aeb1 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -577,6 +577,16 @@ out:
 	return ret;
 }
 
+int rd_exec_require_dev(struct rd *rd, int (*cb)(struct rd *rd))
+{
+	if (rd_no_arg(rd)) {
+		pr_err("Please provide device name.\n");
+		return -EINVAL;
+	}
+
+	return rd_exec_dev(rd, cb);
+}
+
 int rd_exec_cmd(struct rd *rd, const struct rd_cmd *cmds, const char *str)
 {
 	const struct rd_cmd *c;
-- 
2.14.4

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

* [PATCH iproute2-next v1 3/4] rdma: Add an option to rename IB device interface
  2018-10-31  7:17 [PATCH iproute2-next v1 0/4] rdma: IB device rename Leon Romanovsky
  2018-10-31  7:17 ` [PATCH iproute2-next v1 1/4] rdma: Update kernel include file to support IB device renaming Leon Romanovsky
  2018-10-31  7:17 ` [PATCH iproute2-next v1 2/4] rdma: Introduce command execution helper with required device name Leon Romanovsky
@ 2018-10-31  7:17 ` Leon Romanovsky
  2018-11-02 16:43   ` David Ahern
  2018-10-31  7:17 ` [PATCH iproute2-next v1 4/4] rdma: Document IB device renaming option Leon Romanovsky
  3 siblings, 1 reply; 10+ messages in thread
From: Leon Romanovsky @ 2018-10-31  7:17 UTC (permalink / raw)
  To: David Ahern
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

From: Leon Romanovsky <leonro@mellanox.com>

Enrich rdmatool with an option to rename IB devices,
the command interface follows Iproute2 convention:
"rdma dev set [OLD-DEVNAME] name NEW-DEVNAME"

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
---
 rdma/dev.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/rdma/dev.c b/rdma/dev.c
index e2eafe47..760b7fb3 100644
--- a/rdma/dev.c
+++ b/rdma/dev.c
@@ -14,6 +14,7 @@
 static int dev_help(struct rd *rd)
 {
 	pr_out("Usage: %s dev show [DEV]\n", rd->filename);
+	pr_out("       %s dev set [DEV] name DEVNAME\n", rd->filename);
 	return 0;
 }
 
@@ -240,17 +241,51 @@ static int dev_one_show(struct rd *rd)
 	return rd_exec_cmd(rd, cmds, "parameter");
 }
 
+static int dev_set_name(struct rd *rd)
+{
+	uint32_t seq;
+
+	if (rd_no_arg(rd)) {
+		pr_err("Please provide device new name.\n");
+		return -EINVAL;
+	}
+
+	rd_prepare_msg(rd, RDMA_NLDEV_CMD_SET,
+		       &seq, (NLM_F_REQUEST | NLM_F_ACK));
+	mnl_attr_put_u32(rd->nlh, RDMA_NLDEV_ATTR_DEV_INDEX, rd->dev_idx);
+	mnl_attr_put_strz(rd->nlh, RDMA_NLDEV_ATTR_DEV_NAME, rd_argv(rd));
+
+	return rd_send_msg(rd);
+}
+
+static int dev_one_set(struct rd *rd)
+{
+	const struct rd_cmd cmds[] = {
+		{ NULL,		dev_help},
+		{ "name",	dev_set_name},
+		{ 0 }
+	};
+
+	return rd_exec_cmd(rd, cmds, "parameter");
+}
+
 static int dev_show(struct rd *rd)
 {
 	return rd_exec_dev(rd, dev_one_show);
 }
 
+static int dev_set(struct rd *rd)
+{
+	return rd_exec_require_dev(rd, dev_one_set);
+}
+
 int cmd_dev(struct rd *rd)
 {
 	const struct rd_cmd cmds[] = {
 		{ NULL,		dev_show },
 		{ "show",	dev_show },
 		{ "list",	dev_show },
+		{ "set",	dev_set },
 		{ "help",	dev_help },
 		{ 0 }
 	};
-- 
2.14.4

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

* [PATCH iproute2-next v1 4/4] rdma: Document IB device renaming option
  2018-10-31  7:17 [PATCH iproute2-next v1 0/4] rdma: IB device rename Leon Romanovsky
                   ` (2 preceding siblings ...)
  2018-10-31  7:17 ` [PATCH iproute2-next v1 3/4] rdma: Add an option to rename IB device interface Leon Romanovsky
@ 2018-10-31  7:17 ` Leon Romanovsky
  2018-11-02 16:47   ` David Ahern
  3 siblings, 1 reply; 10+ messages in thread
From: Leon Romanovsky @ 2018-10-31  7:17 UTC (permalink / raw)
  To: David Ahern
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

From: Leon Romanovsky <leonro@mellanox.com>

[leonro@server /]$ lspci |grep -i Ether
00:08.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:09.0 Ethernet controller: Mellanox Technologies MT27700 Family [ConnectX-4]
[leonro@server /]$ sudo rdma dev
1: mlx5_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455
sys_image_guid 5254:00c0:fe12:3455
[leonro@server /]$ sudo rdma dev set mlx5_0 name hfi1_0
[leonro@server /]$ sudo rdma dev
1: hfi1_0: node_type ca fw 3.8.9999 node_guid 5254:00c0:fe12:3455
sys_image_guid 5254:00c0:fe12:3455

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 man/man8/rdma-dev.8 | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/man/man8/rdma-dev.8 b/man/man8/rdma-dev.8
index 461681b6..b2f9964a 100644
--- a/man/man8/rdma-dev.8
+++ b/man/man8/rdma-dev.8
@@ -22,6 +22,12 @@ rdmak-dev \- RDMA device configuration
 .B rdma dev show
 .RI "[ " DEV " ]"
 
+.ti -8
+.B rdma dev set
+.RI "[ " DEV " ]"
+.BR name
+.BR NEWNAME
+
 .ti -8
 .B rdma dev help
 
@@ -33,6 +39,8 @@ rdmak-dev \- RDMA device configuration
 - specifies the RDMA device to show.
 If this argument is omitted all devices are listed.
 
+.SS rdma dev set - rename rdma device
+
 .SH "EXAMPLES"
 .PP
 rdma dev
@@ -45,6 +53,11 @@ rdma dev show mlx5_3
 Shows the state of specified RDMA device.
 .RE
 .PP
+rdma dev set mlx5_3 name rdma_0
+.RS 4
+Renames the mlx5_3 device to be named rdma_0.
+.RE
+.PP
 
 .SH SEE ALSO
 .BR rdma (8),
-- 
2.14.4

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

* Re: [PATCH iproute2-next v1 1/4] rdma: Update kernel include file to support IB device renaming
  2018-10-31  7:17 ` [PATCH iproute2-next v1 1/4] rdma: Update kernel include file to support IB device renaming Leon Romanovsky
@ 2018-11-02 16:43   ` David Ahern
  0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2018-11-02 16:43 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

On 10/31/18 1:17 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Bring kernel header file changes upto commit 05d940d3a3ec
> ("RDMA/nldev: Allow IB device rename through RDMA netlink")
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> ---
>  rdma/include/uapi/rdma/rdma_netlink.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

applied to iproute2-next. Thanks

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

* Re: [PATCH iproute2-next v1 2/4] rdma: Introduce command execution helper with required device name
  2018-10-31  7:17 ` [PATCH iproute2-next v1 2/4] rdma: Introduce command execution helper with required device name Leon Romanovsky
@ 2018-11-02 16:43   ` David Ahern
  0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2018-11-02 16:43 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

On 10/31/18 1:17 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> In contradiction to various show commands, the set command explicitly
> requires to use device name as an argument. Provide new command
> execution helper which enforces it.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> ---
>  rdma/rdma.h  |  1 +
>  rdma/utils.c | 10 ++++++++++
>  2 files changed, 11 insertions(+)
> 

applied to iproute2-next. Thanks

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

* Re: [PATCH iproute2-next v1 3/4] rdma: Add an option to rename IB device interface
  2018-10-31  7:17 ` [PATCH iproute2-next v1 3/4] rdma: Add an option to rename IB device interface Leon Romanovsky
@ 2018-11-02 16:43   ` David Ahern
  0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2018-11-02 16:43 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

On 10/31/18 1:17 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Enrich rdmatool with an option to rename IB devices,
> the command interface follows Iproute2 convention:
> "rdma dev set [OLD-DEVNAME] name NEW-DEVNAME"
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> ---
>  rdma/dev.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 

applied to iproute2-next. Thanks

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

* Re: [PATCH iproute2-next v1 4/4] rdma: Document IB device renaming option
  2018-10-31  7:17 ` [PATCH iproute2-next v1 4/4] rdma: Document IB device renaming option Leon Romanovsky
@ 2018-11-02 16:47   ` David Ahern
  2018-11-04 11:12     ` Leon Romanovsky
  0 siblings, 1 reply; 10+ messages in thread
From: David Ahern @ 2018-11-02 16:47 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Leon Romanovsky, netdev, RDMA mailing list, Stephen Hemminger,
	Steve Wise

On 10/31/18 1:17 AM, Leon Romanovsky wrote:
> diff --git a/man/man8/rdma-dev.8 b/man/man8/rdma-dev.8
> index 461681b6..b2f9964a 100644
> --- a/man/man8/rdma-dev.8
> +++ b/man/man8/rdma-dev.8
> @@ -22,6 +22,12 @@ rdmak-dev \- RDMA device configuration
>  .B rdma dev show
>  .RI "[ " DEV " ]"
>  
> +.ti -8
> +.B rdma dev set
> +.RI "[ " DEV " ]"
> +.BR name
> +.BR NEWNAME
> +
>  .ti -8
>  .B rdma dev help
>  
> @@ -33,6 +39,8 @@ rdmak-dev \- RDMA device configuration
>  - specifies the RDMA device to show.
>  If this argument is omitted all devices are listed.
>  
> +.SS rdma dev set - rename rdma device
> +

'nroff -u0 -Tlp -man man/man8/rdma-dev.8' shows that you lost the
spacing between that line and the Examples line.

   rdma dev set - rename rdma device
EXAMPLES
       rdma dev
           Shows the state of all RDMA devices on the system.

...


>  .SH "EXAMPLES"
>  .PP
>  rdma dev
> @@ -45,6 +53,11 @@ rdma dev show mlx5_3
>  Shows the state of specified RDMA device.
>  .RE
>  .PP
> +rdma dev set mlx5_3 name rdma_0
> +.RS 4
> +Renames the mlx5_3 device to be named rdma_0.

That does not read well. I suggest dropping the 'be named' to make it
"Renames the mlx5_3 device to rdma_0."

> +.RE
> +.PP
>  
>  .SH SEE ALSO
>  .BR rdma (8),
> 

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

* Re: [PATCH iproute2-next v1 4/4] rdma: Document IB device renaming option
  2018-11-02 16:47   ` David Ahern
@ 2018-11-04 11:12     ` Leon Romanovsky
  0 siblings, 0 replies; 10+ messages in thread
From: Leon Romanovsky @ 2018-11-04 11:12 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, RDMA mailing list, Stephen Hemminger, Steve Wise

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

On Fri, Nov 02, 2018 at 10:47:16AM -0600, David Ahern wrote:
> On 10/31/18 1:17 AM, Leon Romanovsky wrote:
> > diff --git a/man/man8/rdma-dev.8 b/man/man8/rdma-dev.8
> > index 461681b6..b2f9964a 100644
> > --- a/man/man8/rdma-dev.8
> > +++ b/man/man8/rdma-dev.8
> > @@ -22,6 +22,12 @@ rdmak-dev \- RDMA device configuration
> >  .B rdma dev show
> >  .RI "[ " DEV " ]"
> >
> > +.ti -8
> > +.B rdma dev set
> > +.RI "[ " DEV " ]"
> > +.BR name
> > +.BR NEWNAME
> > +
> >  .ti -8
> >  .B rdma dev help
> >
> > @@ -33,6 +39,8 @@ rdmak-dev \- RDMA device configuration
> >  - specifies the RDMA device to show.
> >  If this argument is omitted all devices are listed.
> >
> > +.SS rdma dev set - rename rdma device
> > +
>
> 'nroff -u0 -Tlp -man man/man8/rdma-dev.8' shows that you lost the
> spacing between that line and the Examples line.
>
>    rdma dev set - rename rdma device
> EXAMPLES
>        rdma dev
>            Shows the state of all RDMA devices on the system.

Thanks, sending v2 now.

>
> ...
>
>
> >  .SH "EXAMPLES"
> >  .PP
> >  rdma dev
> > @@ -45,6 +53,11 @@ rdma dev show mlx5_3
> >  Shows the state of specified RDMA device.
> >  .RE
> >  .PP
> > +rdma dev set mlx5_3 name rdma_0
> > +.RS 4
> > +Renames the mlx5_3 device to be named rdma_0.
>
> That does not read well. I suggest dropping the 'be named' to make it
> "Renames the mlx5_3 device to rdma_0."
>
> > +.RE
> > +.PP
> >
> >  .SH SEE ALSO
> >  .BR rdma (8),
> >

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31  7:17 [PATCH iproute2-next v1 0/4] rdma: IB device rename Leon Romanovsky
2018-10-31  7:17 ` [PATCH iproute2-next v1 1/4] rdma: Update kernel include file to support IB device renaming Leon Romanovsky
2018-11-02 16:43   ` David Ahern
2018-10-31  7:17 ` [PATCH iproute2-next v1 2/4] rdma: Introduce command execution helper with required device name Leon Romanovsky
2018-11-02 16:43   ` David Ahern
2018-10-31  7:17 ` [PATCH iproute2-next v1 3/4] rdma: Add an option to rename IB device interface Leon Romanovsky
2018-11-02 16:43   ` David Ahern
2018-10-31  7:17 ` [PATCH iproute2-next v1 4/4] rdma: Document IB device renaming option Leon Romanovsky
2018-11-02 16:47   ` David Ahern
2018-11-04 11:12     ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.