diff mbox series

[v2,RESEND] net/mlx5: unique names for per device caches

Message ID 20241023134146.28448-1-sebott@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series [v2,RESEND] net/mlx5: unique names for per device caches | expand

Commit Message

Sebastian Ott Oct. 23, 2024, 1:41 p.m. UTC
Add the device name to the per device kmem_cache names to
ensure their uniqueness. This fixes warnings like this:
"kmem_cache of name 'mlx5_fs_fgs' already exists".

Reviwed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Breno Leitao Oct. 23, 2024, 1:42 p.m. UTC | #1
On Wed, Oct 23, 2024 at 03:41:46PM +0200, Sebastian Ott wrote:
> Add the device name to the per device kmem_cache names to
> ensure their uniqueness. This fixes warnings like this:
> "kmem_cache of name 'mlx5_fs_fgs' already exists".
> 
> Reviwed-by: Breno Leitao <leitao@debian.org>
in fact, it should be:

Reviewed-by: Breno Leitao <leitao@debian.org>
Tariq Toukan Oct. 24, 2024, 4:47 p.m. UTC | #2
On 23/10/2024 16:41, Sebastian Ott wrote:
> Add the device name to the per device kmem_cache names to
> ensure their uniqueness. This fixes warnings like this:
> "kmem_cache of name 'mlx5_fs_fgs' already exists".
> 
> Reviwed-by: Breno Leitao <leitao@debian.org>
> Signed-off-by: Sebastian Ott <sebott@redhat.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> index 8505d5e241e1..c2db0a1c132b 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
> @@ -3689,6 +3689,7 @@ void mlx5_fs_core_free(struct mlx5_core_dev *dev)
>   int mlx5_fs_core_alloc(struct mlx5_core_dev *dev)
>   {
>   	struct mlx5_flow_steering *steering;
> +	char name[80];
>   	int err = 0;
>   
>   	err = mlx5_init_fc_stats(dev);
> @@ -3713,10 +3714,12 @@ int mlx5_fs_core_alloc(struct mlx5_core_dev *dev)
>   	else
>   		steering->mode = MLX5_FLOW_STEERING_MODE_DMFS;
>   
> -	steering->fgs_cache = kmem_cache_create("mlx5_fs_fgs",
> +	snprintf(name, sizeof(name), "%s-mlx5_fs_fgs", dev_name(dev->device));
> +	steering->fgs_cache = kmem_cache_create(name,
>   						sizeof(struct mlx5_flow_group), 0,
>   						0, NULL);
> -	steering->ftes_cache = kmem_cache_create("mlx5_fs_ftes", sizeof(struct fs_fte), 0,
> +	snprintf(name, sizeof(name), "%s-mlx5_fs_ftes", dev_name(dev->device));
> +	steering->ftes_cache = kmem_cache_create(name, sizeof(struct fs_fte), 0,
>   						 0, NULL);
>   	if (!steering->ftes_cache || !steering->fgs_cache) {
>   		err = -ENOMEM;

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

Thanks.
patchwork-bot+netdevbpf@kernel.org Oct. 29, 2024, 12:50 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 23 Oct 2024 15:41:46 +0200 you wrote:
> Add the device name to the per device kmem_cache names to
> ensure their uniqueness. This fixes warnings like this:
> "kmem_cache of name 'mlx5_fs_fgs' already exists".
> 
> Reviwed-by: Breno Leitao <leitao@debian.org>
> Signed-off-by: Sebastian Ott <sebott@redhat.com>
> 
> [...]

Here is the summary with links:
  - [v2,RESEND] net/mlx5: unique names for per device caches
    https://git.kernel.org/netdev/net-next/c/25872a079bbb

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 8505d5e241e1..c2db0a1c132b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -3689,6 +3689,7 @@  void mlx5_fs_core_free(struct mlx5_core_dev *dev)
 int mlx5_fs_core_alloc(struct mlx5_core_dev *dev)
 {
 	struct mlx5_flow_steering *steering;
+	char name[80];
 	int err = 0;
 
 	err = mlx5_init_fc_stats(dev);
@@ -3713,10 +3714,12 @@  int mlx5_fs_core_alloc(struct mlx5_core_dev *dev)
 	else
 		steering->mode = MLX5_FLOW_STEERING_MODE_DMFS;
 
-	steering->fgs_cache = kmem_cache_create("mlx5_fs_fgs",
+	snprintf(name, sizeof(name), "%s-mlx5_fs_fgs", dev_name(dev->device));
+	steering->fgs_cache = kmem_cache_create(name,
 						sizeof(struct mlx5_flow_group), 0,
 						0, NULL);
-	steering->ftes_cache = kmem_cache_create("mlx5_fs_ftes", sizeof(struct fs_fte), 0,
+	snprintf(name, sizeof(name), "%s-mlx5_fs_ftes", dev_name(dev->device));
+	steering->ftes_cache = kmem_cache_create(name, sizeof(struct fs_fte), 0,
 						 0, NULL);
 	if (!steering->ftes_cache || !steering->fgs_cache) {
 		err = -ENOMEM;