Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Parav Pandit <parav@nvidia.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <netdev@vger.kernel.org>
Cc: Parav Pandit <parav@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	"Leon Romanovsky" <leonro@nvidia.com>
Subject: [PATCH net-next 06/10] devlink: Add APIs to publish, unpublish individual parameter
Date: Tue, 10 Aug 2021 14:46:16 +0300	[thread overview]
Message-ID: <20210810114620.8397-7-parav@nvidia.com> (raw)
In-Reply-To: <20210810114620.8397-1-parav@nvidia.com>

Enable drivers to publish/unpublish individual parameter.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
---
 include/net/devlink.h |  4 ++++
 net/core/devlink.c    | 48 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index f6459ee77114..1151497c0ec5 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1651,6 +1651,10 @@ void devlink_param_unregister(struct devlink *devlink,
 			      const struct devlink_param *param);
 void devlink_params_publish(struct devlink *devlink);
 void devlink_params_unpublish(struct devlink *devlink);
+void devlink_param_publish(struct devlink *devlink,
+			   const struct devlink_param *param);
+void devlink_param_unpublish(struct devlink *devlink,
+			     const struct devlink_param *param);
 int devlink_port_params_register(struct devlink_port *devlink_port,
 				 const struct devlink_param *params,
 				 size_t params_count);
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 629291175af3..ee9787314cff 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -9982,6 +9982,54 @@ void devlink_params_unpublish(struct devlink *devlink)
 }
 EXPORT_SYMBOL_GPL(devlink_params_unpublish);
 
+/**
+ * devlink_param_publish - publish one configuration parameter
+ *
+ * @devlink: devlink
+ * @param: one configuration parameter
+ *
+ * Publish previously registered configuration parameter.
+ */
+void devlink_param_publish(struct devlink *devlink,
+			   const struct devlink_param *param)
+{
+	struct devlink_param_item *param_item;
+
+	list_for_each_entry(param_item, &devlink->param_list, list) {
+		if (param_item->param != param || param_item->published)
+			continue;
+		param_item->published = true;
+		devlink_param_notify(devlink, 0, param_item,
+				     DEVLINK_CMD_PARAM_NEW);
+		break;
+	}
+}
+EXPORT_SYMBOL_GPL(devlink_param_publish);
+
+/**
+ * devlink_param_unpublish - unpublish one configuration parameter
+ *
+ * @devlink: devlink
+ * @param: one configuration parameter
+ *
+ * Unpublish previously registered configuration parameter.
+ */
+void devlink_param_unpublish(struct devlink *devlink,
+			     const struct devlink_param *param)
+{
+	struct devlink_param_item *param_item;
+
+	list_for_each_entry(param_item, &devlink->param_list, list) {
+		if (param_item->param != param || !param_item->published)
+			continue;
+		param_item->published = false;
+		devlink_param_notify(devlink, 0, param_item,
+				     DEVLINK_CMD_PARAM_DEL);
+		break;
+	}
+}
+EXPORT_SYMBOL_GPL(devlink_param_unpublish);
+
 /**
  *	devlink_port_params_register - register port configuration parameters
  *
-- 
2.26.2


  parent reply	other threads:[~2021-08-10 11:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10 11:46 [PATCH net-next 00/10] devlink: Control auxiliary devices Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 01/10] devlink: Add new "enable_eth" generic device param Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 02/10] devlink: Add new "enable_rdma" " Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 03/10] devlink: Add new "enable_vnet" " Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 04/10] devlink: Create a helper function for one parameter registration Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 05/10] devlink: Add API to register and unregister single parameter Parav Pandit
2021-08-10 11:46 ` Parav Pandit [this message]
2021-08-10 11:46 ` [PATCH net-next 07/10] net/mlx5: Fix unpublish devlink parameters Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 08/10] net/mlx5: Support enable_eth devlink dev param Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 09/10] net/mlx5: Support enable_rdma " Parav Pandit
2021-08-10 11:46 ` [PATCH net-next 10/10] net/mlx5: Support enable_vnet " Parav Pandit
2021-08-10 11:59 ` [PATCH net-next 00/10] devlink: Control auxiliary devices Parav Pandit

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=20210810114620.8397-7-parav@nvidia.com \
    --to=parav@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH net-next 06/10] devlink: Add APIs to publish, unpublish individual parameter' \
    /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

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).