[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR12MB43306F8A03809C2FE2CC3BBFDC239@DM6PR12MB4330.namprd12.prod.outlook.com>
Date: Thu, 27 May 2021 07:38:40 +0000
From: Parav Pandit <parav@...dia.com>
To: Saeed Mahameed <saeed@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Tariq Toukan <tariqt@...dia.com>, Eli Cohen <elic@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>
Subject: RE: [net-next 16/17] net/mlx5: Ensure SF BAR size is at least
PAGE_SIZE
> From: Saeed Mahameed <saeed@...nel.org>
> Sent: Thursday, May 27, 2021 10:06 AM
>
> 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));
This is incorrect. You cannot do max(). BAR size of a SF is absolute number.
You will expose BAR of other SF when PAGE_SHIFT is > other value.
Please drop this patch from the series.
> 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