linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Delete publish of single parameter API
@ 2021-09-14 12:58 Leon Romanovsky
  2021-09-14 12:58 ` [PATCH net-next 1/2] net/mlx5: Publish and unpublish all devlink parameters at once Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Leon Romanovsky @ 2021-09-14 12:58 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Leon Romanovsky, Aya Levin, Jiri Pirko, linux-kernel, linux-rdma,
	netdev, Saeed Mahameed, Tariq Toukan

From: Leon Romanovsky <leonro@nvidia.com>

Hi,

This short series removes the single parameter publish/unpublish API
that does nothing expect mimics already existing
devlink_paramss_*publish calls.

In near future, we will be able to delete devlink_paramss_*publish too.

Thanks

Leon Romanovsky (2):
  net/mlx5: Publish and unpublish all devlink parameters at once
  devlink: Delete not-used single parameter notification APIs

 .../net/ethernet/mellanox/mlx5/core/devlink.c | 10 +---
 include/net/devlink.h                         |  4 --
 net/core/devlink.c                            | 48 -------------------
 3 files changed, 2 insertions(+), 60 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] net/mlx5: Publish and unpublish all devlink parameters at once
  2021-09-14 12:58 [PATCH net-next 0/2] Delete publish of single parameter API Leon Romanovsky
@ 2021-09-14 12:58 ` Leon Romanovsky
  2021-09-14 12:58 ` [PATCH net-next 2/2] devlink: Delete not-used single parameter notification APIs Leon Romanovsky
  2021-09-15 15:20 ` [PATCH net-next 0/2] Delete publish of single parameter API patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2021-09-14 12:58 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Leon Romanovsky, Aya Levin, Jiri Pirko, linux-kernel, linux-rdma,
	netdev, Saeed Mahameed, Tariq Toukan

From: Leon Romanovsky <leonro@nvidia.com>

The devlink parameters were published in two steps despite being static
and known in advance.

First step was to use devlink_params_publish() which iterated over all
known up to that point parameters and sent notification messages.
In second step, the call was devlink_param_publish() that looped over
same parameters list and sent notification for new parameters.

In order to simplify the API, move devlink_params_publish() to be called
when all parameters were already added and save the need to iterate over
parameters list again.

As a side effect, this change fixes the error unwind flow in which
parameters were not marked as unpublished.

Fixes: 82e6c96f04e1 ("net/mlx5: Register to devlink ingress VLAN filter trap")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index e84287ffc7ce..dde8c03c5cfe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -625,7 +625,6 @@ static int mlx5_devlink_eth_param_register(struct devlink *devlink)
 	devlink_param_driverinit_value_set(devlink,
 					   DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,
 					   value);
-	devlink_param_publish(devlink, &enable_eth_param);
 	return 0;
 }
 
@@ -636,7 +635,6 @@ static void mlx5_devlink_eth_param_unregister(struct devlink *devlink)
 	if (!mlx5_eth_supported(dev))
 		return;
 
-	devlink_param_unpublish(devlink, &enable_eth_param);
 	devlink_param_unregister(devlink, &enable_eth_param);
 }
 
@@ -673,7 +671,6 @@ static int mlx5_devlink_rdma_param_register(struct devlink *devlink)
 	devlink_param_driverinit_value_set(devlink,
 					   DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA,
 					   value);
-	devlink_param_publish(devlink, &enable_rdma_param);
 	return 0;
 }
 
@@ -684,7 +681,6 @@ static void mlx5_devlink_rdma_param_unregister(struct devlink *devlink)
 	if (!IS_ENABLED(CONFIG_MLX5_INFINIBAND) || MLX5_ESWITCH_MANAGER(dev))
 		return;
 
-	devlink_param_unpublish(devlink, &enable_rdma_param);
 	devlink_param_unregister(devlink, &enable_rdma_param);
 }
 
@@ -709,7 +705,6 @@ static int mlx5_devlink_vnet_param_register(struct devlink *devlink)
 	devlink_param_driverinit_value_set(devlink,
 					   DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET,
 					   value);
-	devlink_param_publish(devlink, &enable_rdma_param);
 	return 0;
 }
 
@@ -720,7 +715,6 @@ static void mlx5_devlink_vnet_param_unregister(struct devlink *devlink)
 	if (!mlx5_vnet_supported(dev))
 		return;
 
-	devlink_param_unpublish(devlink, &enable_vnet_param);
 	devlink_param_unregister(devlink, &enable_vnet_param);
 }
 
@@ -811,7 +805,6 @@ int mlx5_devlink_register(struct devlink *devlink)
 	if (err)
 		goto params_reg_err;
 	mlx5_devlink_set_params_init_values(devlink);
-	devlink_params_publish(devlink);
 
 	err = mlx5_devlink_auxdev_params_register(devlink);
 	if (err)
@@ -821,6 +814,7 @@ int mlx5_devlink_register(struct devlink *devlink)
 	if (err)
 		goto traps_reg_err;
 
+	devlink_params_publish(devlink);
 	return 0;
 
 traps_reg_err:
@@ -835,9 +829,9 @@ int mlx5_devlink_register(struct devlink *devlink)
 
 void mlx5_devlink_unregister(struct devlink *devlink)
 {
+	devlink_params_unpublish(devlink);
 	mlx5_devlink_traps_unregister(devlink);
 	mlx5_devlink_auxdev_params_unregister(devlink);
-	devlink_params_unpublish(devlink);
 	devlink_params_unregister(devlink, mlx5_devlink_params,
 				  ARRAY_SIZE(mlx5_devlink_params));
 	devlink_unregister(devlink);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] devlink: Delete not-used single parameter notification APIs
  2021-09-14 12:58 [PATCH net-next 0/2] Delete publish of single parameter API Leon Romanovsky
  2021-09-14 12:58 ` [PATCH net-next 1/2] net/mlx5: Publish and unpublish all devlink parameters at once Leon Romanovsky
@ 2021-09-14 12:58 ` Leon Romanovsky
  2021-09-15  3:01   ` Jakub Kicinski
  2021-09-15 15:20 ` [PATCH net-next 0/2] Delete publish of single parameter API patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2021-09-14 12:58 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Leon Romanovsky, Aya Levin, Jiri Pirko, linux-kernel, linux-rdma,
	netdev, Saeed Mahameed, Tariq Toukan

From: Leon Romanovsky <leonro@nvidia.com>

There is no need in specific devlink_param_*publish(), because same
output can be achieved by using devlink_params_*publish() in correct
places.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 include/net/devlink.h |  4 ----
 net/core/devlink.c    | 48 -------------------------------------------
 2 files changed, 52 deletions(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index 154cf0dbca37..cd89b2dc2354 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1653,10 +1653,6 @@ 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 a856ae401ea5..f30121f07467 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -10121,54 +10121,6 @@ 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.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 2/2] devlink: Delete not-used single parameter notification APIs
  2021-09-14 12:58 ` [PATCH net-next 2/2] devlink: Delete not-used single parameter notification APIs Leon Romanovsky
@ 2021-09-15  3:01   ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-09-15  3:01 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: David S . Miller, Leon Romanovsky, Aya Levin, Jiri Pirko,
	linux-kernel, linux-rdma, netdev, Saeed Mahameed, Tariq Toukan

On Tue, 14 Sep 2021 15:58:29 +0300 Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> There is no need in specific devlink_param_*publish(), because same
> output can be achieved by using devlink_params_*publish() in correct
> places.
> 
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] Delete publish of single parameter API
  2021-09-14 12:58 [PATCH net-next 0/2] Delete publish of single parameter API Leon Romanovsky
  2021-09-14 12:58 ` [PATCH net-next 1/2] net/mlx5: Publish and unpublish all devlink parameters at once Leon Romanovsky
  2021-09-14 12:58 ` [PATCH net-next 2/2] devlink: Delete not-used single parameter notification APIs Leon Romanovsky
@ 2021-09-15 15:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-15 15:20 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: davem, kuba, leonro, ayal, jiri, linux-kernel, linux-rdma,
	netdev, saeedm, tariqt

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Tue, 14 Sep 2021 15:58:27 +0300 you wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> Hi,
> 
> This short series removes the single parameter publish/unpublish API
> that does nothing expect mimics already existing
> devlink_paramss_*publish calls.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net/mlx5: Publish and unpublish all devlink parameters at once
    https://git.kernel.org/netdev/net-next/c/e9310aed8e6a
  - [net-next,2/2] devlink: Delete not-used single parameter notification APIs
    https://git.kernel.org/netdev/net-next/c/c2d2f9885066

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-15 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 12:58 [PATCH net-next 0/2] Delete publish of single parameter API Leon Romanovsky
2021-09-14 12:58 ` [PATCH net-next 1/2] net/mlx5: Publish and unpublish all devlink parameters at once Leon Romanovsky
2021-09-14 12:58 ` [PATCH net-next 2/2] devlink: Delete not-used single parameter notification APIs Leon Romanovsky
2021-09-15  3:01   ` Jakub Kicinski
2021-09-15 15:20 ` [PATCH net-next 0/2] Delete publish of single parameter API patchwork-bot+netdevbpf

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