devlink show controller and external info
Subsystems (3)
cover devlink show controller and external info
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(+)
Signature · 1 line
2.26.2
PATCH 1/3 devlink: Update kernel headers
Update kernel headers to commit:
e2ce94dc1d89 ("devlink: introduce the health reporter test command")
--- include/uapi/linux/devlink.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/linux/devlink.h +4 -0
@@ -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,
Signature · 1 line
2.26.2
PATCH 2/3 devlink: Show external port attribute
In reply to Parav PanditIf 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"
}
}
}
}--- devlink/devlink.c | 6 ++++++ 1 file changed, 6 insertions(+)
devlink/devlink.c +6 -0
@@ -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)
Signature · 1 line
2.26.2
PATCH 3/3 devlink: Show controller number of a devlink port
In reply to Parav PanditShow 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"
}
}
}
}--- devlink/devlink.c | 3 +++ 1 file changed, 3 insertions(+)
devlink/devlink.c +3 -0
@@ -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);
Signature · 1 line
2.26.2
Quoted 19 lines
From: Parav Pandit <[email protected]>
Sent: Friday, September 18, 2020 1:33 PMFor 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
Quoted 5 lines
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.
Quoted 6 lines
devlink/devlink.c | 9 +++++++++ include/uapi/linux/devlink.h | 4 ++++ 2 files changed, 13 insertions(+)--
2.26.2
cover devlink show controller and external info
In reply to Parav PanditFor 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(+)
Signature · 1 line
2.26.2
PATCH RESEND 1/3 devlink: Update kernel headers
Update kernel headers to commit:
e2ce94dc1d89 ("devlink: introduce the health reporter test command")
--- include/uapi/linux/devlink.h | 4 ++++ 1 file changed, 4 insertions(+)
include/uapi/linux/devlink.h +4 -0
@@ -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,
Signature · 1 line
2.26.2
PATCH RESEND 2/3 devlink: Show external port attribute
In reply to Parav PanditIf 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"
}
}
}
}--- devlink/devlink.c | 6 ++++++ 1 file changed, 6 insertions(+)
devlink/devlink.c +6 -0
@@ -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)
Signature · 1 line
2.26.2
PATCH RESEND 3/3 devlink: Show controller number of a devlink port
In reply to Parav PanditShow 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"
}
}
}
}--- devlink/devlink.c | 3 +++ 1 file changed, 3 insertions(+)
devlink/devlink.c +3 -0
@@ -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);
Signature · 1 line
2.26.2
David Ahern
AppliedQuoted 12 lines · 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
Quoted 9 lines
Parav Pandit (3):
devlink: Update kernel headers
devlink: Show external port attribute
devlink: Show controller number of a devlink portdevlink/devlink.c | 9 +++++++++ include/uapi/linux/devlink.h | 4 ++++ 2 files changed, 13 insertions(+)
applied to iproute2-next