net: devlink: expose the info about version representing a component
Subsystems (3)
Jiri Pirko
maintainerPATCH 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
@@ -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
@@ -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
Jakub Kicinski
maintainerQuoted 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.mgmtDidn'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@@ -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.
Jiri Pirko
maintainerQuoted 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@@ -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
-0DEVLINK_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.
Jakub Kicinski
maintainerQuoted 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.
Jiri Pirko
maintainerQuoted 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.
Jakub Kicinski
maintainerQuoted 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?
Jiri Pirko
maintainerQuoted 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 flashWhat 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.