diff mbox series

[net-next,v2,1/4] net: devlink: extend info_get() version put to indicate a flash component

Message ID 20220822170247.974743-2-jiri@resnulli.us (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: devlink: sync flash and dev info commands | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 53208 this patch: 53208
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 26 this patch: 26
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 60200 this patch: 60200
netdev/checkpatch warning WARNING: line length of 85 exceeds 80 columns WARNING: line length of 86 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 14 this patch: 14
netdev/source_inline success Was 0 now: 0

Commit Message

Jiri Pirko Aug. 22, 2022, 5:02 p.m. UTC
From: Jiri Pirko <jiri@nvidia.com>

Whenever the driver is called by his info_get() op, it may put multiple
version names and values to the netlink message. Extend by additional
helper devlink_info_version_running_put_ext() that allows to specify a
version type that indicates when particular version name represents
a flash component.

This is going to be used in follow-up patch calling info_get() during
flash update command checking if version with this the version type
exists.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
v1->v2:
- split from v1 patch "net: devlink: extend info_get() version put to
  indicate a flash component", no code changes
---
 include/net/devlink.h | 12 ++++++++++++
 net/core/devlink.c    | 23 +++++++++++++++++++----
 2 files changed, 31 insertions(+), 4 deletions(-)

Comments

Jakub Kicinski Aug. 23, 2022, 3 a.m. UTC | #1
On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:
> +int devlink_info_version_running_put_ext(struct devlink_info_req *req,
> +					 const char *version_name,
> +					 const char *version_value,
> +					 enum devlink_info_version_type version_type);

Why are we hooking into running, wouldn't stored make more sense?
Jiri Pirko Aug. 23, 2022, 6:35 a.m. UTC | #2
Tue, Aug 23, 2022 at 05:00:26AM CEST, kuba@kernel.org wrote:
>On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:
>> +int devlink_info_version_running_put_ext(struct devlink_info_req *req,
>> +					 const char *version_name,
>> +					 const char *version_value,
>> +					 enum devlink_info_version_type version_type);
>
>Why are we hooking into running, wouldn't stored make more sense?

I think eventually this should be in both. Netdevsim and mlxsw (which I
did this originally for) does not have "stored".
Jakub Kicinski Aug. 23, 2022, 7:32 p.m. UTC | #3
On Tue, 23 Aug 2022 08:35:04 +0200 Jiri Pirko wrote:
> Tue, Aug 23, 2022 at 05:00:26AM CEST, kuba@kernel.org wrote:
> >On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:  
> >> +int devlink_info_version_running_put_ext(struct devlink_info_req *req,
> >> +					 const char *version_name,
> >> +					 const char *version_value,
> >> +					 enum devlink_info_version_type version_type);  
> >
> >Why are we hooking into running, wouldn't stored make more sense?  
> 
> I think eventually this should be in both. Netdevsim and mlxsw (which I
> did this originally for) does not have "stored".

Well, netdevsim is just API dust, and mlxsw is incorrect :/
Jiri Pirko Aug. 24, 2022, 8:50 a.m. UTC | #4
Tue, Aug 23, 2022 at 09:32:08PM CEST, kuba@kernel.org wrote:
>On Tue, 23 Aug 2022 08:35:04 +0200 Jiri Pirko wrote:
>> Tue, Aug 23, 2022 at 05:00:26AM CEST, kuba@kernel.org wrote:
>> >On Mon, 22 Aug 2022 19:02:44 +0200 Jiri Pirko wrote:  
>> >> +int devlink_info_version_running_put_ext(struct devlink_info_req *req,
>> >> +					 const char *version_name,
>> >> +					 const char *version_value,
>> >> +					 enum devlink_info_version_type version_type);  
>> >
>> >Why are we hooking into running, wouldn't stored make more sense?  
>> 
>> I think eventually this should be in both. Netdevsim and mlxsw (which I
>> did this originally for) does not have "stored".
>
>Well, netdevsim is just API dust, and mlxsw is incorrect :/

Okay, will add "stored".
diff mbox series

Patch

diff --git a/include/net/devlink.h b/include/net/devlink.h
index 119ed1ffb988..5f47d5cefaa6 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1714,6 +1714,14 @@  int devlink_info_driver_name_put(struct devlink_info_req *req,
 				 const char *name);
 int devlink_info_board_serial_number_put(struct devlink_info_req *req,
 					 const char *bsn);
+
+enum devlink_info_version_type {
+	DEVLINK_INFO_VERSION_TYPE_NONE,
+	DEVLINK_INFO_VERSION_TYPE_COMPONENT, /* May be used as flash update
+					      * component by name.
+					      */
+};
+
 int devlink_info_version_fixed_put(struct devlink_info_req *req,
 				   const char *version_name,
 				   const char *version_value);
@@ -1723,6 +1731,10 @@  int devlink_info_version_stored_put(struct devlink_info_req *req,
 int devlink_info_version_running_put(struct devlink_info_req *req,
 				     const char *version_name,
 				     const char *version_value);
+int devlink_info_version_running_put_ext(struct devlink_info_req *req,
+					 const char *version_name,
+					 const char *version_value,
+					 enum devlink_info_version_type version_type);
 
 int devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg);
 int devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg);
diff --git a/net/core/devlink.c b/net/core/devlink.c
index b50bcc18b8d9..2682e968539e 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -6579,7 +6579,8 @@  EXPORT_SYMBOL_GPL(devlink_info_board_serial_number_put);
 
 static int devlink_info_version_put(struct devlink_info_req *req, int attr,
 				    const char *version_name,
-				    const char *version_value)
+				    const char *version_value,
+				    enum devlink_info_version_type version_type)
 {
 	struct nlattr *nest;
 	int err;
@@ -6612,7 +6613,8 @@  int devlink_info_version_fixed_put(struct devlink_info_req *req,
 				   const char *version_value)
 {
 	return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_FIXED,
-					version_name, version_value);
+					version_name, version_value,
+					DEVLINK_INFO_VERSION_TYPE_NONE);
 }
 EXPORT_SYMBOL_GPL(devlink_info_version_fixed_put);
 
@@ -6621,7 +6623,8 @@  int devlink_info_version_stored_put(struct devlink_info_req *req,
 				    const char *version_value)
 {
 	return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_STORED,
-					version_name, version_value);
+					version_name, version_value,
+					DEVLINK_INFO_VERSION_TYPE_NONE);
 }
 EXPORT_SYMBOL_GPL(devlink_info_version_stored_put);
 
@@ -6630,10 +6633,22 @@  int devlink_info_version_running_put(struct devlink_info_req *req,
 				     const char *version_value)
 {
 	return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_RUNNING,
-					version_name, version_value);
+					version_name, version_value,
+					DEVLINK_INFO_VERSION_TYPE_NONE);
 }
 EXPORT_SYMBOL_GPL(devlink_info_version_running_put);
 
+int devlink_info_version_running_put_ext(struct devlink_info_req *req,
+					 const char *version_name,
+					 const char *version_value,
+					 enum devlink_info_version_type version_type)
+{
+	return devlink_info_version_put(req, DEVLINK_ATTR_INFO_VERSION_RUNNING,
+					version_name, version_value,
+					version_type);
+}
+EXPORT_SYMBOL_GPL(devlink_info_version_running_put_ext);
+
 static int
 devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink,
 		     enum devlink_command cmd, u32 portid,