Commit a7e7b40c authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5e: Use the correct lag ports number when creating TISes

The cited commit moved the code of mlx5e_create_tises() and changed the
loop to create TISes over MLX5_MAX_PORTS constant value, instead of
getting the correct lag ports supported by the device, which can cause
FW errors on devices with less than MLX5_MAX_PORTS ports.

Change that back to mlx5e_get_num_lag_ports(mdev).

Also IPoIB interfaces create there own TISes, they don't use the eth
TISes, pass a flag to indicate that.

Fixes: b25bd37c ("net/mlx5: Move TISes from priv to mdev HW resources")
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent bee9705c
...@@ -1124,7 +1124,7 @@ static inline bool mlx5_tx_swp_supported(struct mlx5_core_dev *mdev) ...@@ -1124,7 +1124,7 @@ static inline bool mlx5_tx_swp_supported(struct mlx5_core_dev *mdev)
extern const struct ethtool_ops mlx5e_ethtool_ops; extern const struct ethtool_ops mlx5e_ethtool_ops;
int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, u32 *mkey); int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, u32 *mkey);
int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev); int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev, bool create_tises);
void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev); void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev);
int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb, int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb,
bool enable_mc_lb); bool enable_mc_lb);
......
...@@ -95,7 +95,7 @@ static void mlx5e_destroy_tises(struct mlx5_core_dev *mdev, u32 tisn[MLX5_MAX_PO ...@@ -95,7 +95,7 @@ static void mlx5e_destroy_tises(struct mlx5_core_dev *mdev, u32 tisn[MLX5_MAX_PO
{ {
int tc, i; int tc, i;
for (i = 0; i < MLX5_MAX_PORTS; i++) for (i = 0; i < mlx5e_get_num_lag_ports(mdev); i++)
for (tc = 0; tc < MLX5_MAX_NUM_TC; tc++) for (tc = 0; tc < MLX5_MAX_NUM_TC; tc++)
mlx5e_destroy_tis(mdev, tisn[i][tc]); mlx5e_destroy_tis(mdev, tisn[i][tc]);
} }
...@@ -110,7 +110,7 @@ static int mlx5e_create_tises(struct mlx5_core_dev *mdev, u32 tisn[MLX5_MAX_PORT ...@@ -110,7 +110,7 @@ static int mlx5e_create_tises(struct mlx5_core_dev *mdev, u32 tisn[MLX5_MAX_PORT
int tc, i; int tc, i;
int err; int err;
for (i = 0; i < MLX5_MAX_PORTS; i++) { for (i = 0; i < mlx5e_get_num_lag_ports(mdev); i++) {
for (tc = 0; tc < MLX5_MAX_NUM_TC; tc++) { for (tc = 0; tc < MLX5_MAX_NUM_TC; tc++) {
u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {}; u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {};
void *tisc; void *tisc;
...@@ -140,7 +140,7 @@ static int mlx5e_create_tises(struct mlx5_core_dev *mdev, u32 tisn[MLX5_MAX_PORT ...@@ -140,7 +140,7 @@ static int mlx5e_create_tises(struct mlx5_core_dev *mdev, u32 tisn[MLX5_MAX_PORT
return err; return err;
} }
int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev) int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev, bool create_tises)
{ {
struct mlx5e_hw_objs *res = &mdev->mlx5e_res.hw_objs; struct mlx5e_hw_objs *res = &mdev->mlx5e_res.hw_objs;
int err; int err;
...@@ -169,11 +169,15 @@ int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev) ...@@ -169,11 +169,15 @@ int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev)
goto err_destroy_mkey; goto err_destroy_mkey;
} }
err = mlx5e_create_tises(mdev, res->tisn); if (create_tises) {
if (err) { err = mlx5e_create_tises(mdev, res->tisn);
mlx5_core_err(mdev, "alloc tises failed, %d\n", err); if (err) {
goto err_destroy_bfreg; mlx5_core_err(mdev, "alloc tises failed, %d\n", err);
goto err_destroy_bfreg;
}
res->tisn_valid = true;
} }
INIT_LIST_HEAD(&res->td.tirs_list); INIT_LIST_HEAD(&res->td.tirs_list);
mutex_init(&res->td.list_lock); mutex_init(&res->td.list_lock);
...@@ -203,7 +207,8 @@ void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev) ...@@ -203,7 +207,8 @@ void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev)
mlx5_crypto_dek_cleanup(mdev->mlx5e_res.dek_priv); mlx5_crypto_dek_cleanup(mdev->mlx5e_res.dek_priv);
mdev->mlx5e_res.dek_priv = NULL; mdev->mlx5e_res.dek_priv = NULL;
mlx5e_destroy_tises(mdev, res->tisn); if (res->tisn_valid)
mlx5e_destroy_tises(mdev, res->tisn);
mlx5_free_bfreg(mdev, &res->bfreg); mlx5_free_bfreg(mdev, &res->bfreg);
mlx5_core_destroy_mkey(mdev, res->mkey); mlx5_core_destroy_mkey(mdev, res->mkey);
mlx5_core_dealloc_transport_domain(mdev, res->td.tdn); mlx5_core_dealloc_transport_domain(mdev, res->td.tdn);
......
...@@ -5992,7 +5992,7 @@ static int mlx5e_resume(struct auxiliary_device *adev) ...@@ -5992,7 +5992,7 @@ static int mlx5e_resume(struct auxiliary_device *adev)
if (netif_device_present(netdev)) if (netif_device_present(netdev))
return 0; return 0;
err = mlx5e_create_mdev_resources(mdev); err = mlx5e_create_mdev_resources(mdev, true);
if (err) if (err)
return err; return err;
......
...@@ -783,7 +783,7 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u32 port_num, ...@@ -783,7 +783,7 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u32 port_num,
} }
/* This should only be called once per mdev */ /* This should only be called once per mdev */
err = mlx5e_create_mdev_resources(mdev); err = mlx5e_create_mdev_resources(mdev, false);
if (err) if (err)
goto destroy_ht; goto destroy_ht;
} }
......
...@@ -681,6 +681,7 @@ struct mlx5e_resources { ...@@ -681,6 +681,7 @@ struct mlx5e_resources {
struct mlx5_sq_bfreg bfreg; struct mlx5_sq_bfreg bfreg;
#define MLX5_MAX_NUM_TC 8 #define MLX5_MAX_NUM_TC 8
u32 tisn[MLX5_MAX_PORTS][MLX5_MAX_NUM_TC]; u32 tisn[MLX5_MAX_PORTS][MLX5_MAX_NUM_TC];
bool tisn_valid;
} hw_objs; } hw_objs;
struct net_device *uplink_netdev; struct net_device *uplink_netdev;
struct mutex uplink_netdev_lock; struct mutex uplink_netdev_lock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment