]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net/mlx5: Allocate individual capability
authorParav Pandit <parav@nvidia.com>
Tue, 13 Jul 2021 11:17:03 +0000 (14:17 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 11 Aug 2021 18:14:33 +0000 (11:14 -0700)
commit48f02eef7f764f33e520ed8009d293396ca690cd
tree37772f902bfbdaa35f6efd22d0be88c924bcaa3a
parent5958a6fad623ad3b67a9e4d8dbd5f1874cc7039e
net/mlx5: Allocate individual capability

Currently mlx5_core_dev contains array of capabilities. It contains 19
valid capabilities of the device, 2 reserved entries and 12 holes.
Due to this for 14 unused entries, mlx5_core_dev allocates 14 * 8K = 112K
bytes of memory which is never used. Due to this mlx5_core_dev structure
size is 270Kbytes odd. This allocation further aligns to next power of 2
to 512Kbytes.

By skipping non-existent entries,
(a) 112Kbyte is saved,
(b) mlx5_core_dev reduces to 8KB with alignment
(c) 350KB saved in alignment

In future individual capability allocation can be used to skip its
allocation when such capability is disabled at the device level. This
patch prepares mlx5_core_dev to hold capability using a pointer instead
of inline array.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
include/linux/mlx5/device.h
include/linux/mlx5/driver.h