From: Sudarsana Reddy Kalluru <skalluru@marvell.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <mkalderon@marvell.com>, <aelior@marvell.com>
Subject: [PATCH net-next v2 1/4] devlink: Add APIs to publish/unpublish the port parameters.
Date: Thu, 4 Jul 2019 06:20:08 -0700 [thread overview]
Message-ID: <20190704132011.13600-2-skalluru@marvell.com> (raw)
In-Reply-To: <20190704132011.13600-1-skalluru@marvell.com>
Kernel has no interface to publish the devlink port parameters. This is
required for exporting the port params to the user space, so that user
can read or update the port params.
This patch adds devlink interfaces (for drivers) to publish/unpublish the
devlink port parameters.
Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
---
include/net/devlink.h | 2 ++
net/core/devlink.c | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 6625ea0..47a1e8f 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -653,6 +653,8 @@ int devlink_port_params_register(struct devlink_port *devlink_port,
void devlink_port_params_unregister(struct devlink_port *devlink_port,
const struct devlink_param *params,
size_t params_count);
+void devlink_port_params_publish(struct devlink_port *devlink_port);
+void devlink_port_params_unpublish(struct devlink_port *ddevlink_port);
int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
union devlink_param_value *init_val);
int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 89c5337..0cd7994 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -6380,6 +6380,48 @@ void devlink_port_params_unregister(struct devlink_port *devlink_port,
}
EXPORT_SYMBOL_GPL(devlink_port_params_unregister);
+/**
+ * devlink_port_params_publish - publish port configuration parameters
+ *
+ * @devlink_port: devlink port
+ *
+ * Publish previously registered port configuration parameters.
+ */
+void devlink_port_params_publish(struct devlink_port *devlink_port)
+{
+ struct devlink_param_item *param_item;
+
+ list_for_each_entry(param_item, &devlink_port->param_list, list) {
+ if (param_item->published)
+ continue;
+ param_item->published = true;
+ devlink_param_notify(devlink_port->devlink, devlink_port->index,
+ param_item, DEVLINK_CMD_PORT_PARAM_NEW);
+ }
+}
+EXPORT_SYMBOL_GPL(devlink_port_params_publish);
+
+/**
+ * devlink_port_params_unpublish - unpublish port configuration parameters
+ *
+ * @devlink_port: devlink port
+ *
+ * Unpublish previously registered port configuration parameters.
+ */
+void devlink_port_params_unpublish(struct devlink_port *devlink_port)
+{
+ struct devlink_param_item *param_item;
+
+ list_for_each_entry(param_item, &devlink_port->param_list, list) {
+ if (!param_item->published)
+ continue;
+ param_item->published = false;
+ devlink_param_notify(devlink_port->devlink, devlink_port->index,
+ param_item, DEVLINK_CMD_PORT_PARAM_DEL);
+ }
+}
+EXPORT_SYMBOL_GPL(devlink_port_params_unpublish);
+
static int
__devlink_param_driverinit_value_get(struct list_head *param_list, u32 param_id,
union devlink_param_value *init_val)
--
1.8.3.1
next prev parent reply other threads:[~2019-07-04 13:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 13:20 [PATCH net-next v2 0/4] qed*/devlink: Devlink support for config attributes Sudarsana Reddy Kalluru
2019-07-04 13:20 ` Sudarsana Reddy Kalluru [this message]
2019-07-04 13:20 ` [PATCH net-next v2 2/4] qed: Add APIs for device attributes configuration Sudarsana Reddy Kalluru
2019-07-04 13:20 ` [PATCH net-next v2 3/4] qed*: Add new file for devlink implementation Sudarsana Reddy Kalluru
2019-07-04 13:20 ` [PATCH net-next v2 4/4] qed*: Add devlink support for configuration attributes Sudarsana Reddy Kalluru
2019-07-04 22:07 ` Jakub Kicinski
2019-07-05 8:22 ` [EXT] " Sudarsana Reddy Kalluru
2019-07-05 19:39 ` Jakub Kicinski
2019-07-08 2:31 ` Sudarsana Reddy Kalluru
2019-07-08 21:47 ` Jakub Kicinski
2019-07-09 2:08 ` Sudarsana Reddy Kalluru
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=20190704132011.13600-2-skalluru@marvell.com \
--to=skalluru@marvell.com \
--cc=aelior@marvell.com \
--cc=davem@davemloft.net \
--cc=mkalderon@marvell.com \
--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