netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] devlink show controller and external info
@ 2020-09-18  8:02 Parav Pandit
  2020-09-18  8:02 ` [PATCH net-next 1/3] devlink: Update kernel headers Parav Pandit
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18  8:02 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit

For certain devlink port flavours controller number and optionally external attributes are reported by the kernel.

(a) controller number indicates that a given port belong to which local or external controller.
(b) external port attribute indicates that if a given port is for external or local controller.

This short series shows this attributes to user.

Patch summary:
Patch-1 updates the kernel header
Patch-2 shows external attribute
Patch-3 show controller number

Parav Pandit (3):
  devlink: Update kernel headers
  devlink: Show external port attribute
  devlink: Show controller number of a devlink port

 devlink/devlink.c            | 9 +++++++++
 include/uapi/linux/devlink.h | 4 ++++
 2 files changed, 13 insertions(+)

-- 
2.26.2


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

* [PATCH net-next 1/3] devlink: Update kernel headers
  2020-09-18  8:02 [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
@ 2020-09-18  8:02 ` Parav Pandit
  2020-09-18  8:02 ` [PATCH net-next 2/3] devlink: Show external port attribute Parav Pandit
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18  8:02 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit

Update kernel headers to commit:
   e2ce94dc1d89 ("devlink: introduce the health reporter test command")

Signed-off-by: Parav Pandit <parav@nvidia.com>
---
 include/uapi/linux/devlink.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index b7f23faa..3d64b48e 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -122,6 +122,8 @@ enum devlink_command {
 	DEVLINK_CMD_TRAP_POLICER_NEW,
 	DEVLINK_CMD_TRAP_POLICER_DEL,
 
+	DEVLINK_CMD_HEALTH_REPORTER_TEST,
+
 	/* add new commands above here */
 	__DEVLINK_CMD_MAX,
 	DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
@@ -458,6 +460,8 @@ enum devlink_attr {
 	DEVLINK_ATTR_PORT_LANES,			/* u32 */
 	DEVLINK_ATTR_PORT_SPLITTABLE,			/* u8 */
 
+	DEVLINK_ATTR_PORT_EXTERNAL,		/* u8 */
+	DEVLINK_ATTR_PORT_CONTROLLER_NUMBER,	/* u32 */
 	/* add new attributes above here, update the policy in devlink.c */
 
 	__DEVLINK_ATTR_MAX,
-- 
2.26.2


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

* [PATCH net-next 2/3] devlink: Show external port attribute
  2020-09-18  8:02 [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
  2020-09-18  8:02 ` [PATCH net-next 1/3] devlink: Update kernel headers Parav Pandit
@ 2020-09-18  8:02 ` Parav Pandit
  2020-09-18  8:03 ` [PATCH net-next 3/3] devlink: Show controller number of a devlink port Parav Pandit
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18  8:02 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit, Jiri Pirko

If a port is for an external controller, port's external attribute is
set. Show such external attribute.

An example of an external controller port for PCI VF:

$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev ens2f0c1pf0vf1 flavour pcivf pfnum 0 vfnum 1 external true splittable false
  function:
    hw_addr 00:00:00:00:00:00

$ devlink port show pci/0000:06:00.0/2 -jp
{
    "port": {
        "pci/0000:06:00.0/2": {
            "type": "eth",
            "netdev": "ens2f0c1pf0vf1",
            "flavour": "pcivf",
            "pfnum": 0,
            "vfnum": 1,
            "external": true,
            "splittable": false,
            "function": {
                "hw_addr": "00:00:00:00:00:00"
            }
        }
    }
}

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
 devlink/devlink.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 007677a5..9f99c031 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3351,6 +3351,12 @@ static void pr_out_port_pfvf_num(struct dl *dl, struct nlattr **tb)
 		fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER]);
 		print_uint(PRINT_ANY, "vfnum", " vfnum %u", fn_num);
 	}
+	if (tb[DEVLINK_ATTR_PORT_EXTERNAL]) {
+		uint8_t external;
+
+		external = mnl_attr_get_u8(tb[DEVLINK_ATTR_PORT_EXTERNAL]);
+		print_bool(PRINT_ANY, "external", " external %s", external);
+	}
 }
 
 static void pr_out_port_function(struct dl *dl, struct nlattr **tb_port)
-- 
2.26.2


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

* [PATCH net-next 3/3] devlink: Show controller number of a devlink port
  2020-09-18  8:02 [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
  2020-09-18  8:02 ` [PATCH net-next 1/3] devlink: Update kernel headers Parav Pandit
  2020-09-18  8:02 ` [PATCH net-next 2/3] devlink: Show external port attribute Parav Pandit
@ 2020-09-18  8:03 ` Parav Pandit
  2020-09-18 10:08 ` [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
  2020-09-18 10:16 ` [PATCH iproute2-next RESEND " Parav Pandit
  4 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18  8:03 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit, Jiri Pirko

Show the controller number of the devlink port whenever kernel reports
it.

Example of a PCI VF port for an external controller number 1:

$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev ens2f0c1pf0vf1 flavour pcivf controller 1 pfnum 0 vfnum 1 external true splittable false
  function:
    hw_addr 00:00:00:00:00:00

$ devlink port show pci/0000:06:00.0/2 -jp
{
    "port": {
        "pci/0000:06:00.0/2": {
            "type": "eth",
            "netdev": "ens2f0c1pf0vf1",
            "flavour": "pcivf",
            "controller": 1,
            "pfnum": 0,
            "vfnum": 1,
            "external": true,
            "splittable": false,
            "function": {
                "hw_addr": "00:00:00:00:00:00"
            }
        }
    }
}

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
 devlink/devlink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 9f99c031..0374175e 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3343,6 +3343,9 @@ static void pr_out_port_pfvf_num(struct dl *dl, struct nlattr **tb)
 {
 	uint16_t fn_num;
 
+	if (tb[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER])
+		print_uint(PRINT_ANY, "controller", " controller %u",
+			   mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER]));
 	if (tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]) {
 		fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]);
 		print_uint(PRINT_ANY, "pfnum", " pfnum %u", fn_num);
-- 
2.26.2


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

* RE: [PATCH net-next 0/3] devlink show controller and external info
  2020-09-18  8:02 [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
                   ` (2 preceding siblings ...)
  2020-09-18  8:03 ` [PATCH net-next 3/3] devlink: Show controller number of a devlink port Parav Pandit
@ 2020-09-18 10:08 ` Parav Pandit
  2020-09-18 10:16 ` [PATCH iproute2-next RESEND " Parav Pandit
  4 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18 10:08 UTC (permalink / raw)
  To: netdev@vger.kernel.org, stephen@networkplumber.org,
	dsahern@kernel.org


> From: Parav Pandit <parav@nvidia.com>
> Sent: Friday, September 18, 2020 1:33 PM
> 
> For certain devlink port flavours controller number and optionally external
> attributes are reported by the kernel.
> 
> (a) controller number indicates that a given port belong to which local or
> external controller.
> (b) external port attribute indicates that if a given port is for external or local
> controller.
> 
> This short series shows this attributes to user.
> 
> Patch summary:
> Patch-1 updates the kernel header
> Patch-2 shows external attribute
> Patch-3 show controller number
> 
> Parav Pandit (3):
>   devlink: Update kernel headers
>   devlink: Show external port attribute
>   devlink: Show controller number of a devlink port
> 
My bad. Forgot to tag  this a iproute2 patches. Resending it.


>  devlink/devlink.c            | 9 +++++++++
>  include/uapi/linux/devlink.h | 4 ++++
>  2 files changed, 13 insertions(+)
> 
> --
> 2.26.2


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

* [PATCH iproute2-next RESEND 0/3] devlink show controller and external info
  2020-09-18  8:02 [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
                   ` (3 preceding siblings ...)
  2020-09-18 10:08 ` [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
@ 2020-09-18 10:16 ` Parav Pandit
  2020-09-18 10:16   ` [PATCH iproute2-next RESEND 1/3] devlink: Update kernel headers Parav Pandit
                     ` (3 more replies)
  4 siblings, 4 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18 10:16 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit

For certain devlink port flavours controller number and optionally external attributes are reported by the kernel.

(a) controller number indicates that a given port belong to which local or external controller.
(b) external port attribute indicates that if a given port is for external or local controller.

This short series shows this attributes to user.

Patch summary:
Patch-1 updates the kernel header
Patch-2 shows external attribute
Patch-3 show controller number

Parav Pandit (3):
  devlink: Update kernel headers
  devlink: Show external port attribute
  devlink: Show controller number of a devlink port

 devlink/devlink.c            | 9 +++++++++
 include/uapi/linux/devlink.h | 4 ++++
 2 files changed, 13 insertions(+)

-- 
2.26.2


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

* [PATCH iproute2-next RESEND 1/3] devlink: Update kernel headers
  2020-09-18 10:16 ` [PATCH iproute2-next RESEND " Parav Pandit
@ 2020-09-18 10:16   ` Parav Pandit
  2020-09-18 10:16   ` [PATCH iproute2-next RESEND 2/3] devlink: Show external port attribute Parav Pandit
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18 10:16 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit

Update kernel headers to commit:
   e2ce94dc1d89 ("devlink: introduce the health reporter test command")

Signed-off-by: Parav Pandit <parav@nvidia.com>
---
 include/uapi/linux/devlink.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index b7f23faa..3d64b48e 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -122,6 +122,8 @@ enum devlink_command {
 	DEVLINK_CMD_TRAP_POLICER_NEW,
 	DEVLINK_CMD_TRAP_POLICER_DEL,
 
+	DEVLINK_CMD_HEALTH_REPORTER_TEST,
+
 	/* add new commands above here */
 	__DEVLINK_CMD_MAX,
 	DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
@@ -458,6 +460,8 @@ enum devlink_attr {
 	DEVLINK_ATTR_PORT_LANES,			/* u32 */
 	DEVLINK_ATTR_PORT_SPLITTABLE,			/* u8 */
 
+	DEVLINK_ATTR_PORT_EXTERNAL,		/* u8 */
+	DEVLINK_ATTR_PORT_CONTROLLER_NUMBER,	/* u32 */
 	/* add new attributes above here, update the policy in devlink.c */
 
 	__DEVLINK_ATTR_MAX,
-- 
2.26.2


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

* [PATCH iproute2-next RESEND 2/3] devlink: Show external port attribute
  2020-09-18 10:16 ` [PATCH iproute2-next RESEND " Parav Pandit
  2020-09-18 10:16   ` [PATCH iproute2-next RESEND 1/3] devlink: Update kernel headers Parav Pandit
@ 2020-09-18 10:16   ` Parav Pandit
  2020-09-18 10:16   ` [PATCH iproute2-next RESEND 3/3] devlink: Show controller number of a devlink port Parav Pandit
  2020-09-23  2:21   ` [PATCH iproute2-next RESEND 0/3] devlink show controller and external info David Ahern
  3 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18 10:16 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit, Jiri Pirko

If a port is for an external controller, port's external attribute is
set. Show such external attribute.

An example of an external controller port for PCI VF:

$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev ens2f0c1pf0vf1 flavour pcivf pfnum 0 vfnum 1 external true splittable false
  function:
    hw_addr 00:00:00:00:00:00

$ devlink port show pci/0000:06:00.0/2 -jp
{
    "port": {
        "pci/0000:06:00.0/2": {
            "type": "eth",
            "netdev": "ens2f0c1pf0vf1",
            "flavour": "pcivf",
            "pfnum": 0,
            "vfnum": 1,
            "external": true,
            "splittable": false,
            "function": {
                "hw_addr": "00:00:00:00:00:00"
            }
        }
    }
}

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
 devlink/devlink.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 007677a5..9f99c031 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3351,6 +3351,12 @@ static void pr_out_port_pfvf_num(struct dl *dl, struct nlattr **tb)
 		fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER]);
 		print_uint(PRINT_ANY, "vfnum", " vfnum %u", fn_num);
 	}
+	if (tb[DEVLINK_ATTR_PORT_EXTERNAL]) {
+		uint8_t external;
+
+		external = mnl_attr_get_u8(tb[DEVLINK_ATTR_PORT_EXTERNAL]);
+		print_bool(PRINT_ANY, "external", " external %s", external);
+	}
 }
 
 static void pr_out_port_function(struct dl *dl, struct nlattr **tb_port)
-- 
2.26.2


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

* [PATCH iproute2-next RESEND 3/3] devlink: Show controller number of a devlink port
  2020-09-18 10:16 ` [PATCH iproute2-next RESEND " Parav Pandit
  2020-09-18 10:16   ` [PATCH iproute2-next RESEND 1/3] devlink: Update kernel headers Parav Pandit
  2020-09-18 10:16   ` [PATCH iproute2-next RESEND 2/3] devlink: Show external port attribute Parav Pandit
@ 2020-09-18 10:16   ` Parav Pandit
  2020-09-23  2:21   ` [PATCH iproute2-next RESEND 0/3] devlink show controller and external info David Ahern
  3 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-09-18 10:16 UTC (permalink / raw)
  To: netdev, stephen, dsahern; +Cc: Parav Pandit, Jiri Pirko

Show the controller number of the devlink port whenever kernel reports
it.

Example of a PCI VF port for an external controller number 1:

$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev ens2f0c1pf0vf1 flavour pcivf controller 1 pfnum 0 vfnum 1 external true splittable false
  function:
    hw_addr 00:00:00:00:00:00

$ devlink port show pci/0000:06:00.0/2 -jp
{
    "port": {
        "pci/0000:06:00.0/2": {
            "type": "eth",
            "netdev": "ens2f0c1pf0vf1",
            "flavour": "pcivf",
            "controller": 1,
            "pfnum": 0,
            "vfnum": 1,
            "external": true,
            "splittable": false,
            "function": {
                "hw_addr": "00:00:00:00:00:00"
            }
        }
    }
}

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
 devlink/devlink.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 9f99c031..0374175e 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3343,6 +3343,9 @@ static void pr_out_port_pfvf_num(struct dl *dl, struct nlattr **tb)
 {
 	uint16_t fn_num;
 
+	if (tb[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER])
+		print_uint(PRINT_ANY, "controller", " controller %u",
+			   mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER]));
 	if (tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]) {
 		fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]);
 		print_uint(PRINT_ANY, "pfnum", " pfnum %u", fn_num);
-- 
2.26.2


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

* Re: [PATCH iproute2-next RESEND 0/3] devlink show controller and external info
  2020-09-18 10:16 ` [PATCH iproute2-next RESEND " Parav Pandit
                     ` (2 preceding siblings ...)
  2020-09-18 10:16   ` [PATCH iproute2-next RESEND 3/3] devlink: Show controller number of a devlink port Parav Pandit
@ 2020-09-23  2:21   ` David Ahern
  3 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2020-09-23  2:21 UTC (permalink / raw)
  To: Parav Pandit, netdev, stephen, dsahern

On 9/18/20 4:16 AM, Parav Pandit wrote:
> For certain devlink port flavours controller number and optionally external attributes are reported by the kernel.
> 
> (a) controller number indicates that a given port belong to which local or external controller.
> (b) external port attribute indicates that if a given port is for external or local controller.
> 
> This short series shows this attributes to user.
> 
> Patch summary:
> Patch-1 updates the kernel header
> Patch-2 shows external attribute
> Patch-3 show controller number
> 
> Parav Pandit (3):
>   devlink: Update kernel headers
>   devlink: Show external port attribute
>   devlink: Show controller number of a devlink port
> 
>  devlink/devlink.c            | 9 +++++++++
>  include/uapi/linux/devlink.h | 4 ++++
>  2 files changed, 13 insertions(+)
> 

applied to iproute2-next


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

end of thread, other threads:[~2020-09-23  2:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-18  8:02 [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
2020-09-18  8:02 ` [PATCH net-next 1/3] devlink: Update kernel headers Parav Pandit
2020-09-18  8:02 ` [PATCH net-next 2/3] devlink: Show external port attribute Parav Pandit
2020-09-18  8:03 ` [PATCH net-next 3/3] devlink: Show controller number of a devlink port Parav Pandit
2020-09-18 10:08 ` [PATCH net-next 0/3] devlink show controller and external info Parav Pandit
2020-09-18 10:16 ` [PATCH iproute2-next RESEND " Parav Pandit
2020-09-18 10:16   ` [PATCH iproute2-next RESEND 1/3] devlink: Update kernel headers Parav Pandit
2020-09-18 10:16   ` [PATCH iproute2-next RESEND 2/3] devlink: Show external port attribute Parav Pandit
2020-09-18 10:16   ` [PATCH iproute2-next RESEND 3/3] devlink: Show controller number of a devlink port Parav Pandit
2020-09-23  2:21   ` [PATCH iproute2-next RESEND 0/3] devlink show controller and external info David Ahern

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