[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210527043609.654854-17-saeed@kernel.org>
Date: Wed, 26 May 2021 21:36:08 -0700
From: Saeed Mahameed <saeed@...nel.org>
To: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, Tariq Toukan <tariqt@...dia.com>,
Eli Cohen <elic@...dia.com>, Saeed Mahameed <saeedm@...dia.com>
Subject: [net-next 16/17] net/mlx5: Ensure SF BAR size is at least PAGE_SIZE
From: Eli Cohen <elic@...dia.com>
Make sure the allocated SF BAR size is at least PAGE_SIZE so that when
mapping it userspace, the mapped page will not cover other SFs.
Signed-off-by: Eli Cohen <elic@...dia.com>
Signed-off-by: Saeed Mahameed <saeedm@...dia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c
index 6a0c6f965ad1..9f9728324731 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c
@@ -227,7 +227,8 @@ void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
max_sfs = MLX5_CAP_GEN(dev, max_num_sf);
else
max_sfs = 1 << MLX5_CAP_GEN(dev, log_max_sf);
- table->sf_bar_length = 1 << (MLX5_CAP_GEN(dev, log_min_sf_size) + 12);
+ table->sf_bar_length = 1 << (max_t(u8, MLX5_CAP_GEN(dev, log_min_sf_size) + 12,
+ PAGE_SHIFT));
table->base_address = pci_resource_start(dev->pdev, 2);
table->max_sfs = max_sfs;
xa_init(&table->devices);
--
2.31.1
Powered by blists - more mailing lists