mlx5-fixes-2022-08-22
-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEGhZs6bAKwk/OTgTpSD+KveBX+j4FAmMD35cACgkQSD+KveBX +j5HZAf/fUg1QXlnIscB2/YaKUYyiagFNCotQz/8TIIkdwddTde4RkXQ192xYzKp EeL1dV1ZNthgeq20OX5mXzquW/w1fa7zTK6eweby1Pq2VdyVuqKKuUbJXXO5Ci1m rg3xxUeL8L+Rk9mGJo4HZynddH7tbHbuBq4dVgZAvDqq9jJOo6pHQPjQT1aUuc/N KT/Ezd9fWaLlTs0VuONMjlj2OjukfXUMjgCkoq6BZxlVLTGMfRlWVdEFfCoxTtkk eUvgiy2P9ApCBR8OtrjPfQ/L0bABiZvvDS4mMez9u6zutxBCKCtq4047I3dLfFyS Er61j/QCPfbkmOWB/5+6Bysa47MI/Q== =Z4kM -----END PGP SIGNATURE----- Merge tag 'mlx5-fixes-2022-08-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux Saeed Mahameed says: ==================== mlx5 fixes 2022-08-22 This series provides bug fixes to mlx5 driver. * tag 'mlx5-fixes-2022-08-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net/mlx5: Unlock on error in mlx5_sriov_enable() net/mlx5e: Fix use after free in mlx5e_fs_init() net/mlx5e: kTLS, Use _safe() iterator in mlx5e_tls_priv_tx_list_cleanup() net/mlx5: unlock on error path in esw_vfs_changed_event_handler() net/mlx5e: Fix wrong tc flag used when set hw-tc-offload off net/mlx5e: TC, Add missing policer validation net/mlx5e: Fix wrong application of the LRO state net/mlx5: Avoid false positive lockdep warning by adding lock_class_key net/mlx5: Fix cmd error logging for manage pages cmd net/mlx5: Disable irq when locking lag_lock net/mlx5: Eswitch, Fix forwarding decision to uplink net/mlx5: LAG, fix logic over MLX5_LAG_FLAG_NDEVS_READY net/mlx5e: Properly disable vlan strip on non-UL reps ==================== Link: https://lore.kernel.org/r/20220822195917.216025-1-saeed@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
550e9a4d85
@ -79,6 +79,10 @@ tc_act_police_offload(struct mlx5e_priv *priv,
|
||||
struct mlx5e_flow_meter_handle *meter;
|
||||
int err = 0;
|
||||
|
||||
err = mlx5e_policer_validate(&fl_act->action, act, fl_act->extack);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = fill_meter_params_from_act(act, ¶ms);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -246,7 +246,7 @@ static void mlx5e_tls_priv_tx_cleanup(struct mlx5e_ktls_offload_context_tx *priv
|
||||
static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev,
|
||||
struct list_head *list, int size)
|
||||
{
|
||||
struct mlx5e_ktls_offload_context_tx *obj;
|
||||
struct mlx5e_ktls_offload_context_tx *obj, *n;
|
||||
struct mlx5e_async_ctx *bulk_async;
|
||||
int i;
|
||||
|
||||
@ -255,7 +255,7 @@ static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev,
|
||||
return;
|
||||
|
||||
i = 0;
|
||||
list_for_each_entry(obj, list, list_node) {
|
||||
list_for_each_entry_safe(obj, n, list, list_node) {
|
||||
mlx5e_tls_priv_tx_cleanup(obj, &bulk_async[i]);
|
||||
i++;
|
||||
}
|
||||
|
@ -1395,10 +1395,11 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,
|
||||
}
|
||||
|
||||
return fs;
|
||||
err_free_fs:
|
||||
kvfree(fs);
|
||||
|
||||
err_free_vlan:
|
||||
mlx5e_fs_vlan_free(fs);
|
||||
err_free_fs:
|
||||
kvfree(fs);
|
||||
err:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3682,7 +3682,9 @@ static int set_feature_hw_tc(struct net_device *netdev, bool enable)
|
||||
int err = 0;
|
||||
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
if (!enable && mlx5e_tc_num_filters(priv, MLX5_TC_FLAG(NIC_OFFLOAD))) {
|
||||
int tc_flag = mlx5e_is_uplink_rep(priv) ? MLX5_TC_FLAG(ESW_OFFLOAD) :
|
||||
MLX5_TC_FLAG(NIC_OFFLOAD);
|
||||
if (!enable && mlx5e_tc_num_filters(priv, tc_flag)) {
|
||||
netdev_err(netdev,
|
||||
"Active offloaded tc filters, can't turn hw_tc_offload off\n");
|
||||
return -EINVAL;
|
||||
@ -4769,14 +4771,6 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16
|
||||
/* RQ */
|
||||
mlx5e_build_rq_params(mdev, params);
|
||||
|
||||
/* HW LRO */
|
||||
if (MLX5_CAP_ETH(mdev, lro_cap) &&
|
||||
params->rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) {
|
||||
/* No XSK params: checking the availability of striding RQ in general. */
|
||||
if (!mlx5e_rx_mpwqe_is_linear_skb(mdev, params, NULL))
|
||||
params->packet_merge.type = slow_pci_heuristic(mdev) ?
|
||||
MLX5E_PACKET_MERGE_NONE : MLX5E_PACKET_MERGE_LRO;
|
||||
}
|
||||
params->packet_merge.timeout = mlx5e_choose_lro_timeout(mdev, MLX5E_DEFAULT_LRO_TIMEOUT);
|
||||
|
||||
/* CQ moderation params */
|
||||
|
@ -662,6 +662,8 @@ static void mlx5e_build_rep_params(struct net_device *netdev)
|
||||
|
||||
params->mqprio.num_tc = 1;
|
||||
params->tunneled_offload_en = false;
|
||||
if (rep->vport != MLX5_VPORT_UPLINK)
|
||||
params->vlan_strip_disable = true;
|
||||
|
||||
mlx5_query_min_inline(mdev, ¶ms->tx_min_inline_mode);
|
||||
}
|
||||
|
@ -427,7 +427,8 @@ esw_setup_vport_dest(struct mlx5_flow_destination *dest, struct mlx5_flow_act *f
|
||||
dest[dest_idx].vport.vhca_id =
|
||||
MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id);
|
||||
dest[dest_idx].vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
|
||||
if (mlx5_lag_mpesw_is_activated(esw->dev))
|
||||
if (dest[dest_idx].vport.num == MLX5_VPORT_UPLINK &&
|
||||
mlx5_lag_mpesw_is_activated(esw->dev))
|
||||
dest[dest_idx].type = MLX5_FLOW_DESTINATION_TYPE_UPLINK;
|
||||
}
|
||||
if (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP) {
|
||||
@ -3115,8 +3116,10 @@ esw_vfs_changed_event_handler(struct mlx5_eswitch *esw, const u32 *out)
|
||||
|
||||
err = mlx5_eswitch_load_vf_vports(esw, new_num_vfs,
|
||||
MLX5_VPORT_UC_ADDR_CHANGE);
|
||||
if (err)
|
||||
if (err) {
|
||||
devl_unlock(devlink);
|
||||
return;
|
||||
}
|
||||
}
|
||||
esw->esw_funcs.num_vfs = new_num_vfs;
|
||||
devl_unlock(devlink);
|
||||
|
@ -1067,30 +1067,32 @@ static void mlx5_ldev_add_netdev(struct mlx5_lag *ldev,
|
||||
struct net_device *netdev)
|
||||
{
|
||||
unsigned int fn = mlx5_get_dev_index(dev);
|
||||
unsigned long flags;
|
||||
|
||||
if (fn >= ldev->ports)
|
||||
return;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev->pf[fn].netdev = netdev;
|
||||
ldev->tracker.netdev_state[fn].link_up = 0;
|
||||
ldev->tracker.netdev_state[fn].tx_enabled = 0;
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
}
|
||||
|
||||
static void mlx5_ldev_remove_netdev(struct mlx5_lag *ldev,
|
||||
struct net_device *netdev)
|
||||
{
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
for (i = 0; i < ldev->ports; i++) {
|
||||
if (ldev->pf[i].netdev == netdev) {
|
||||
ldev->pf[i].netdev = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
}
|
||||
|
||||
static void mlx5_ldev_add_mdev(struct mlx5_lag *ldev,
|
||||
@ -1234,7 +1236,7 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev,
|
||||
mlx5_ldev_add_netdev(ldev, dev, netdev);
|
||||
|
||||
for (i = 0; i < ldev->ports; i++)
|
||||
if (!ldev->pf[i].dev)
|
||||
if (!ldev->pf[i].netdev)
|
||||
break;
|
||||
|
||||
if (i >= ldev->ports)
|
||||
@ -1246,12 +1248,13 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev,
|
||||
bool mlx5_lag_is_roce(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
bool res;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
res = ldev && __mlx5_lag_is_roce(ldev);
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1260,12 +1263,13 @@ EXPORT_SYMBOL(mlx5_lag_is_roce);
|
||||
bool mlx5_lag_is_active(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
bool res;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
res = ldev && __mlx5_lag_is_active(ldev);
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1274,13 +1278,14 @@ EXPORT_SYMBOL(mlx5_lag_is_active);
|
||||
bool mlx5_lag_is_master(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
bool res;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
res = ldev && __mlx5_lag_is_active(ldev) &&
|
||||
dev == ldev->pf[MLX5_LAG_P1].dev;
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1289,12 +1294,13 @@ EXPORT_SYMBOL(mlx5_lag_is_master);
|
||||
bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
bool res;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
res = ldev && __mlx5_lag_is_sriov(ldev);
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1303,13 +1309,14 @@ EXPORT_SYMBOL(mlx5_lag_is_sriov);
|
||||
bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
bool res;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
res = ldev && __mlx5_lag_is_sriov(ldev) &&
|
||||
test_bit(MLX5_LAG_MODE_FLAG_SHARED_FDB, &ldev->mode_flags);
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1352,9 +1359,10 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct net_device *ndev = NULL;
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
|
||||
if (!(ldev && __mlx5_lag_is_roce(ldev)))
|
||||
@ -1373,7 +1381,7 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev)
|
||||
dev_hold(ndev);
|
||||
|
||||
unlock:
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
|
||||
return ndev;
|
||||
}
|
||||
@ -1383,10 +1391,11 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev,
|
||||
struct net_device *slave)
|
||||
{
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
u8 port = 0;
|
||||
int i;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
if (!(ldev && __mlx5_lag_is_roce(ldev)))
|
||||
goto unlock;
|
||||
@ -1401,7 +1410,7 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev,
|
||||
port = ldev->v2p_map[port * ldev->buckets];
|
||||
|
||||
unlock:
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
return port;
|
||||
}
|
||||
EXPORT_SYMBOL(mlx5_lag_get_slave_port);
|
||||
@ -1422,8 +1431,9 @@ struct mlx5_core_dev *mlx5_lag_get_peer_mdev(struct mlx5_core_dev *dev)
|
||||
{
|
||||
struct mlx5_core_dev *peer_dev = NULL;
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
if (!ldev)
|
||||
goto unlock;
|
||||
@ -1433,7 +1443,7 @@ struct mlx5_core_dev *mlx5_lag_get_peer_mdev(struct mlx5_core_dev *dev)
|
||||
ldev->pf[MLX5_LAG_P1].dev;
|
||||
|
||||
unlock:
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
return peer_dev;
|
||||
}
|
||||
EXPORT_SYMBOL(mlx5_lag_get_peer_mdev);
|
||||
@ -1446,6 +1456,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
|
||||
int outlen = MLX5_ST_SZ_BYTES(query_cong_statistics_out);
|
||||
struct mlx5_core_dev **mdev;
|
||||
struct mlx5_lag *ldev;
|
||||
unsigned long flags;
|
||||
int num_ports;
|
||||
int ret, i, j;
|
||||
void *out;
|
||||
@ -1462,7 +1473,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
|
||||
|
||||
memset(values, 0, sizeof(*values) * num_counters);
|
||||
|
||||
spin_lock(&lag_lock);
|
||||
spin_lock_irqsave(&lag_lock, flags);
|
||||
ldev = mlx5_lag_dev(dev);
|
||||
if (ldev && __mlx5_lag_is_active(ldev)) {
|
||||
num_ports = ldev->ports;
|
||||
@ -1472,7 +1483,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
|
||||
num_ports = 1;
|
||||
mdev[MLX5_LAG_P1] = dev;
|
||||
}
|
||||
spin_unlock(&lag_lock);
|
||||
spin_unlock_irqrestore(&lag_lock, flags);
|
||||
|
||||
for (i = 0; i < num_ports; ++i) {
|
||||
u32 in[MLX5_ST_SZ_DW(query_cong_statistics_in)] = {};
|
||||
|
@ -1530,7 +1530,9 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
|
||||
memcpy(&dev->profile, &profile[profile_idx], sizeof(dev->profile));
|
||||
INIT_LIST_HEAD(&priv->ctx_list);
|
||||
spin_lock_init(&priv->ctx_lock);
|
||||
lockdep_register_key(&dev->lock_key);
|
||||
mutex_init(&dev->intf_state_mutex);
|
||||
lockdep_set_class(&dev->intf_state_mutex, &dev->lock_key);
|
||||
|
||||
mutex_init(&priv->bfregs.reg_head.lock);
|
||||
mutex_init(&priv->bfregs.wc_head.lock);
|
||||
@ -1597,6 +1599,7 @@ err_timeout_init:
|
||||
mutex_destroy(&priv->bfregs.wc_head.lock);
|
||||
mutex_destroy(&priv->bfregs.reg_head.lock);
|
||||
mutex_destroy(&dev->intf_state_mutex);
|
||||
lockdep_unregister_key(&dev->lock_key);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1618,6 +1621,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev)
|
||||
mutex_destroy(&priv->bfregs.wc_head.lock);
|
||||
mutex_destroy(&priv->bfregs.reg_head.lock);
|
||||
mutex_destroy(&dev->intf_state_mutex);
|
||||
lockdep_unregister_key(&dev->lock_key);
|
||||
}
|
||||
|
||||
static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
@ -376,8 +376,8 @@ retry:
|
||||
goto out_dropped;
|
||||
}
|
||||
}
|
||||
err = mlx5_cmd_check(dev, err, in, out);
|
||||
if (err) {
|
||||
err = mlx5_cmd_check(dev, err, in, out);
|
||||
mlx5_core_warn(dev, "func_id 0x%x, npages %d, err %d\n",
|
||||
func_id, npages, err);
|
||||
goto out_dropped;
|
||||
@ -524,10 +524,13 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
|
||||
dev->priv.reclaim_pages_discard += npages;
|
||||
}
|
||||
/* if triggered by FW event and failed by FW then ignore */
|
||||
if (event && err == -EREMOTEIO)
|
||||
if (event && err == -EREMOTEIO) {
|
||||
err = 0;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
err = mlx5_cmd_check(dev, err, in, out);
|
||||
if (err) {
|
||||
err = mlx5_cmd_check(dev, err, in, out);
|
||||
mlx5_core_err(dev, "failed reclaiming pages: err %d\n", err);
|
||||
goto out_free;
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ static int mlx5_sriov_enable(struct pci_dev *pdev, int num_vfs)
|
||||
|
||||
devl_lock(devlink);
|
||||
err = mlx5_device_enable_sriov(dev, num_vfs);
|
||||
devl_unlock(devlink);
|
||||
if (err) {
|
||||
mlx5_core_warn(dev, "mlx5_device_enable_sriov failed : %d\n", err);
|
||||
return err;
|
||||
}
|
||||
devl_unlock(devlink);
|
||||
|
||||
err = pci_enable_sriov(pdev, num_vfs);
|
||||
if (err) {
|
||||
|
@ -779,6 +779,7 @@ struct mlx5_core_dev {
|
||||
enum mlx5_device_state state;
|
||||
/* sync interface state */
|
||||
struct mutex intf_state_mutex;
|
||||
struct lock_class_key lock_key;
|
||||
unsigned long intf_state;
|
||||
struct mlx5_priv priv;
|
||||
struct mlx5_profile profile;
|
||||
|
Loading…
Reference in New Issue
Block a user