Skip to contentSkip to conversation

net: devlink: expose the info about version representing a component

PATCH In review Jiri Pirko 2 participants 7 messages Nov 4, 2022 – Nov 8, 2022

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author maintainer
#0 lore raw

PATCH 1/1 net: devlink: expose the info about version representing a component

From: Jiri Pirko <[email protected]>

If certain version exposed by a driver is marked to be representing a component, expose this info to the user.

Example:

$ devlink dev info
netdevsim/netdevsim10:
  driver netdevsim
  versions:
      running:
        fw.mgmt 10.20.30
      flash_components:
        fw.mgmt
---
 include/uapi/linux/devlink.h | 2 ++
 net/core/devlink.c           | 5 +++++
 2 files changed, 7 insertions(+)
include/uapi/linux/devlink.h +2 -0
index 2f24b53a87a5..7f2874189188 100644
@@ -607,6 +607,8 @@ enum devlink_attr {
 
 	DEVLINK_ATTR_SELFTESTS,			/* nested */
 
+	DEVLINK_ATTR_INFO_VERSION_IS_COMPONENT,	/* u8 0 or 1 */
+
 	/* add new attributes above here, update the policy in devlink.c */
 
 	__DEVLINK_ATTR_MAX,
net/core/devlink.c +5 -0
index 2dcf2bcc3527..31bca879f9cf 100644
@@ -6621,6 +6621,11 @@ static int devlink_info_version_put(struct devlink_info_req *req, int attr,
 	if (err)
 		goto nla_put_failure;
 
+	err = nla_put_u8(req->msg, DEVLINK_ATTR_INFO_VERSION_IS_COMPONENT,
+			 version_type == DEVLINK_INFO_VERSION_TYPE_COMPONENT);
+	if (err)
+		goto nla_put_failure;
+
 	nla_nest_end(req->msg, nest);
 
 	return 0;
Signature · 1 line
2.37.3
maintainer
#1 lore raw
Quoted 4 lines · On Fri, 4 Nov 2022 16:24:25 +0100 Jiri Pirko wrote:

If certain version exposed by a driver is marked to be representing a component, expose this info to the user.

Example:

Quoted 8 lines
$ devlink dev info
netdevsim/netdevsim10:
  driver netdevsim
  versions:
      running:
        fw.mgmt 10.20.30
      flash_components:
        fw.mgmt

Didn't I complain that this makes no practical sense because user needs to know what file to flash, to which component? Or was that a different flag that I was complaining about?

include/uapi/linux/devlink.h enum devlink_attr { · line 610

Quoted 9 lines
include/uapi/linux/devlink.h +1 -0
index 2f24b53a87a5..7f2874189188 100644
@@ -607,6 +607,8 @@ enum devlink_attr {
 
 	DEVLINK_ATTR_SELFTESTS,			/* nested */
 
+	DEVLINK_ATTR_INFO_VERSION_IS_COMPONENT,	/* u8 0 or 1 */

In the interest of fairness I should complain about the use of u8/u16

devlink is genetlink so user will know kernel supports the attribute (by looking at family->maxattr). So this can be a flag.

author maintainer
#2 lore raw
Quoted 14 lines · Sat, Nov 05, 2022 at 03:25:10AM CET, [email protected] wrote:
Quoted 4 lines · On Fri, 4 Nov 2022 16:24:25 +0100 Jiri Pirko wrote:

If certain version exposed by a driver is marked to be representing a component, expose this info to the user.

Example:

Quoted 8 lines
$ devlink dev info
netdevsim/netdevsim10:
  driver netdevsim
  versions:
      running:
        fw.mgmt 10.20.30
      flash_components:
        fw.mgmt
Quoted 3 lines

Didn't I complain that this makes no practical sense because user needs to know what file to flash, to which component? Or was that a different flag that I was complaining about?

Different. That was about exposing a default component.

Quoted 7 lines
Quoted 7 lines
include/uapi/linux/devlink.h +0 -0
index 2f24b53a87a5..7f2874189188 100644
@@ -607,6 +607,8 @@ enum devlink_attr {
 
Quoted 8 lines

include/uapi/linux/devlink.h enum devlink_attr { · line 610

Quoted 3 lines
include/uapi/linux/devlink.h +1 -0
 	DEVLINK_ATTR_SELFTESTS,			/* nested */
 
+	DEVLINK_ATTR_INFO_VERSION_IS_COMPONENT,	/* u8 0 or 1 */

In the interest of fairness I should complain about the use of u8/u16

devlink is genetlink so user will know kernel supports the attribute (by looking at family->maxattr). So this can be a flag.

Okay, makes sense.

maintainer
#3 lore raw
Quoted 5 lines · On Sat, 5 Nov 2022 10:26:33 +0100 Jiri Pirko wrote:
Quoted 3 lines

Didn't I complain that this makes no practical sense because user needs to know what file to flash, to which component? Or was that a different flag that I was complaining about?

Different. That was about exposing a default component.

Oh, my bad. But I think the same justification applies here. Overloading the API with information with no clear use seems counter-productive to me.

author maintainer
#4 lore raw
Quoted 10 lines · Mon, Nov 07, 2022 at 05:52:18PM CET, [email protected] wrote:
Quoted 5 lines · On Sat, 5 Nov 2022 10:26:33 +0100 Jiri Pirko wrote:
Quoted 3 lines

Didn't I complain that this makes no practical sense because user needs to know what file to flash, to which component? Or was that a different flag that I was complaining about?

Different. That was about exposing a default component.

Oh, my bad. But I think the same justification applies here. Overloading the API with information with no clear use seems counter-productive to me.

Well, it gives the user hint about what he can pass as a "component name" on the cmdline. Otherwise, the user has no clue.

maintainer
#5 lore raw
Quoted 6 lines · On Mon, 7 Nov 2022 18:03:06 +0100 Jiri Pirko wrote:
Quoted 3 lines

Oh, my bad. But I think the same justification applies here. Overloading the API with information with no clear use seems counter-productive to me.

Well, it gives the user hint about what he can pass as a "component name" on the cmdline. Otherwise, the user has no clue.

The command line contains:
- device
- component (optional)
- fw file to flash

What scenario are you thinking of where the user has the file they want to flash, intent to flash a particular component only but does not know whether that component can be flashed?

author maintainer
#6 lore raw
Quoted 8 lines · Mon, Nov 07, 2022 at 07:02:06PM CET, [email protected] wrote:
Quoted 6 lines · On Mon, 7 Nov 2022 18:03:06 +0100 Jiri Pirko wrote:
Quoted 3 lines

Oh, my bad. But I think the same justification applies here. Overloading the API with information with no clear use seems counter-productive to me.

Well, it gives the user hint about what he can pass as a "component name" on the cmdline. Otherwise, the user has no clue.

Quoted 8 lines

The command line contains:
- device
- component (optional)
- fw file to flash

What scenario are you thinking of where the user has the file they want to flash, intent to flash a particular component only but does not know whether that component can be flashed?

No scenario. Lets drop this.