netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
To: davem@davemloft.net
Cc: michael.chan@broadcom.com, jiri@mellanox.com,
	jakub.kicinski@netronome.com, mkubecek@suse.cz,
	netdev@vger.kernel.org
Subject: [PATCH net-next v6 RFC 4/8] devlink: Add support for driverinit get value for devlink_port
Date: Fri, 21 Dec 2018 10:12:09 +0530	[thread overview]
Message-ID: <1545367333-8855-5-git-send-email-vasundhara-v.volam@broadcom.com> (raw)
In-Reply-To: <1545367333-8855-1-git-send-email-vasundhara-v.volam@broadcom.com>

Add support for "driverinit" configuration mode value for devlink_port
configuration parameters. Add devlink_port_param_driverinit_value_get()
function to help the driver get the value from devlink_port.

Also, move the common code to __devlink_param_driverinit_value_get()
to be used by both device and port params.

Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
---
 include/net/devlink.h |  8 ++++++
 net/core/devlink.c    | 67 ++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 58 insertions(+), 17 deletions(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index 98b8a66..09f3f43 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -838,6 +838,14 @@ static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
 {
 }
 
+static inline int
+devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
+					u32 param_id,
+					union devlink_param_value *init_val)
+{
+	return -EOPNOTSUPP;
+}
+
 static inline struct devlink_region *
 devlink_region_create(struct devlink *devlink,
 		      const char *region_name,
diff --git a/net/core/devlink.c b/net/core/devlink.c
index be083a9..53755ff 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4677,26 +4677,13 @@ void devlink_params_unregister(struct devlink *devlink,
 }
 EXPORT_SYMBOL_GPL(devlink_params_unregister);
 
-/**
- *	devlink_param_driverinit_value_get - get configuration parameter
- *					     value for driver initializing
- *
- *	@devlink: devlink
- *	@param_id: parameter ID
- *	@init_val: value of parameter in driverinit configuration mode
- *
- *	This function should be used by the driver to get driverinit
- *	configuration for initialization after reload command.
- */
-int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
-				       union devlink_param_value *init_val)
+static int
+__devlink_param_driverinit_value_get(struct list_head *param_list, u32 param_id,
+				     union devlink_param_value *init_val)
 {
 	struct devlink_param_item *param_item;
 
-	if (!devlink->ops || !devlink->ops->reload)
-		return -EOPNOTSUPP;
-
-	param_item = devlink_param_find_by_id(&devlink->param_list, param_id);
+	param_item = devlink_param_find_by_id(param_list, param_id);
 	if (!param_item)
 		return -EINVAL;
 
@@ -4712,6 +4699,27 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
 
 	return 0;
 }
+
+/**
+ *	devlink_param_driverinit_value_get - get configuration parameter
+ *					     value for driver initializing
+ *
+ *	@devlink: devlink
+ *	@param_id: parameter ID
+ *	@init_val: value of parameter in driverinit configuration mode
+ *
+ *	This function should be used by the driver to get driverinit
+ *	configuration for initialization after reload command.
+ */
+int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
+				       union devlink_param_value *init_val)
+{
+	if (!devlink->ops || !devlink->ops->reload)
+		return -EOPNOTSUPP;
+
+	return __devlink_param_driverinit_value_get(&devlink->param_list,
+						    param_id, init_val);
+}
 EXPORT_SYMBOL_GPL(devlink_param_driverinit_value_get);
 
 /**
@@ -4829,6 +4837,31 @@ void devlink_port_params_unregister(struct devlink_port *devlink_port,
 EXPORT_SYMBOL_GPL(devlink_port_params_unregister);
 
 /**
+ *	devlink_port_param_driverinit_value_get - get configuration parameter
+ *						value for driver initializing
+ *
+ *	@devlink_port: devlink_port
+ *	@param_id: parameter ID
+ *	@init_val: value of parameter in driverinit configuration mode
+ *
+ *	This function should be used by the driver to get driverinit
+ *	configuration for initialization after reload command.
+ */
+int devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
+					    u32 param_id,
+					    union devlink_param_value *init_val)
+{
+	struct devlink *devlink = devlink_port->devlink;
+
+	if (!devlink->ops || !devlink->ops->reload)
+		return -EOPNOTSUPP;
+
+	return __devlink_param_driverinit_value_get(&devlink_port->param_list,
+						    param_id, init_val);
+}
+EXPORT_SYMBOL_GPL(devlink_port_param_driverinit_value_get);
+
+/**
  *	devlink_region_create - create a new address region
  *
  *	@devlink: devlink
-- 
1.8.3.1

  parent reply	other threads:[~2018-12-21  4:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21  4:42 [PATCH net-next v6 RFC 0/8] devlink: Add configuration parameters support for devlink_port Vasundhara Volam
2018-12-21  4:42 ` [PATCH net-next v6 RFC 1/8] devlink: Add devlink_param for port register and unregister Vasundhara Volam
2018-12-21  4:42 ` [PATCH net-next v6 RFC 2/8] devlink: Add port param get command Vasundhara Volam
2018-12-21  4:42 ` [PATCH net-next v6 RFC 3/8] devlink: Add port param set command Vasundhara Volam
2018-12-21  4:42 ` Vasundhara Volam [this message]
2018-12-21  4:42 ` [PATCH net-next v6 RFC 5/8] devlink: Add support for driverinit set value for devlink_port Vasundhara Volam
2018-12-21  4:42 ` [PATCH net-next v6 RFC 6/8] devlink: Add devlink notifications support for port params Vasundhara Volam
2018-12-21  4:42 ` [PATCH net-next v6 RFC 7/8] devlink: Add a generic wake_on_lan port parameter Vasundhara Volam
2018-12-21  4:42 ` [PATCH net-next v6 RFC 8/8] bnxt_en: Add bnxt_en initial port params table and register it Vasundhara Volam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1545367333-8855-5-git-send-email-vasundhara-v.volam@broadcom.com \
    --to=vasundhara-v.volam@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@mellanox.com \
    --cc=michael.chan@broadcom.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).