Commit 550e9a4d authored by Jakub Kicinski's avatar Jakub Kicinski

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.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 31180678 35419025
...@@ -79,6 +79,10 @@ tc_act_police_offload(struct mlx5e_priv *priv, ...@@ -79,6 +79,10 @@ tc_act_police_offload(struct mlx5e_priv *priv,
struct mlx5e_flow_meter_handle *meter; struct mlx5e_flow_meter_handle *meter;
int err = 0; 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, &params); err = fill_meter_params_from_act(act, &params);
if (err) if (err)
return err; return err;
......
...@@ -246,7 +246,7 @@ static void mlx5e_tls_priv_tx_cleanup(struct mlx5e_ktls_offload_context_tx *priv ...@@ -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, static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev,
struct list_head *list, int size) 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; struct mlx5e_async_ctx *bulk_async;
int i; int i;
...@@ -255,7 +255,7 @@ static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev, ...@@ -255,7 +255,7 @@ static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev,
return; return;
i = 0; 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]); mlx5e_tls_priv_tx_cleanup(obj, &bulk_async[i]);
i++; i++;
} }
......
...@@ -1395,10 +1395,11 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile, ...@@ -1395,10 +1395,11 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,
} }
return fs; return fs;
err_free_fs:
kvfree(fs);
err_free_vlan: err_free_vlan:
mlx5e_fs_vlan_free(fs); mlx5e_fs_vlan_free(fs);
err_free_fs:
kvfree(fs);
err: err:
return NULL; return NULL;
} }
......
...@@ -3682,7 +3682,9 @@ static int set_feature_hw_tc(struct net_device *netdev, bool enable) ...@@ -3682,7 +3682,9 @@ static int set_feature_hw_tc(struct net_device *netdev, bool enable)
int err = 0; int err = 0;
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT) #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, netdev_err(netdev,
"Active offloaded tc filters, can't turn hw_tc_offload off\n"); "Active offloaded tc filters, can't turn hw_tc_offload off\n");
return -EINVAL; return -EINVAL;
...@@ -4769,14 +4771,6 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 ...@@ -4769,14 +4771,6 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16
/* RQ */ /* RQ */
mlx5e_build_rq_params(mdev, params); 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); params->packet_merge.timeout = mlx5e_choose_lro_timeout(mdev, MLX5E_DEFAULT_LRO_TIMEOUT);
/* CQ moderation params */ /* CQ moderation params */
......
...@@ -662,6 +662,8 @@ static void mlx5e_build_rep_params(struct net_device *netdev) ...@@ -662,6 +662,8 @@ static void mlx5e_build_rep_params(struct net_device *netdev)
params->mqprio.num_tc = 1; params->mqprio.num_tc = 1;
params->tunneled_offload_en = false; params->tunneled_offload_en = false;
if (rep->vport != MLX5_VPORT_UPLINK)
params->vlan_strip_disable = true;
mlx5_query_min_inline(mdev, &params->tx_min_inline_mode); mlx5_query_min_inline(mdev, &params->tx_min_inline_mode);
} }
......
...@@ -427,7 +427,8 @@ esw_setup_vport_dest(struct mlx5_flow_destination *dest, struct mlx5_flow_act *f ...@@ -427,7 +427,8 @@ esw_setup_vport_dest(struct mlx5_flow_destination *dest, struct mlx5_flow_act *f
dest[dest_idx].vport.vhca_id = dest[dest_idx].vport.vhca_id =
MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id); MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id);
dest[dest_idx].vport.flags |= MLX5_FLOW_DEST_VPORT_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; dest[dest_idx].type = MLX5_FLOW_DESTINATION_TYPE_UPLINK;
} }
if (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP) { if (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP) {
...@@ -3115,9 +3116,11 @@ esw_vfs_changed_event_handler(struct mlx5_eswitch *esw, const u32 *out) ...@@ -3115,9 +3116,11 @@ esw_vfs_changed_event_handler(struct mlx5_eswitch *esw, const u32 *out)
err = mlx5_eswitch_load_vf_vports(esw, new_num_vfs, err = mlx5_eswitch_load_vf_vports(esw, new_num_vfs,
MLX5_VPORT_UC_ADDR_CHANGE); MLX5_VPORT_UC_ADDR_CHANGE);
if (err) if (err) {
devl_unlock(devlink);
return; return;
} }
}
esw->esw_funcs.num_vfs = new_num_vfs; esw->esw_funcs.num_vfs = new_num_vfs;
devl_unlock(devlink); devl_unlock(devlink);
} }
......
...@@ -1067,30 +1067,32 @@ static void mlx5_ldev_add_netdev(struct mlx5_lag *ldev, ...@@ -1067,30 +1067,32 @@ static void mlx5_ldev_add_netdev(struct mlx5_lag *ldev,
struct net_device *netdev) struct net_device *netdev)
{ {
unsigned int fn = mlx5_get_dev_index(dev); unsigned int fn = mlx5_get_dev_index(dev);
unsigned long flags;
if (fn >= ldev->ports) if (fn >= ldev->ports)
return; return;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev->pf[fn].netdev = netdev; ldev->pf[fn].netdev = netdev;
ldev->tracker.netdev_state[fn].link_up = 0; ldev->tracker.netdev_state[fn].link_up = 0;
ldev->tracker.netdev_state[fn].tx_enabled = 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, static void mlx5_ldev_remove_netdev(struct mlx5_lag *ldev,
struct net_device *netdev) struct net_device *netdev)
{ {
unsigned long flags;
int i; int i;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
for (i = 0; i < ldev->ports; i++) { for (i = 0; i < ldev->ports; i++) {
if (ldev->pf[i].netdev == netdev) { if (ldev->pf[i].netdev == netdev) {
ldev->pf[i].netdev = NULL; ldev->pf[i].netdev = NULL;
break; break;
} }
} }
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
} }
static void mlx5_ldev_add_mdev(struct mlx5_lag *ldev, static void mlx5_ldev_add_mdev(struct mlx5_lag *ldev,
...@@ -1234,7 +1236,7 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev, ...@@ -1234,7 +1236,7 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev,
mlx5_ldev_add_netdev(ldev, dev, netdev); mlx5_ldev_add_netdev(ldev, dev, netdev);
for (i = 0; i < ldev->ports; i++) for (i = 0; i < ldev->ports; i++)
if (!ldev->pf[i].dev) if (!ldev->pf[i].netdev)
break; break;
if (i >= ldev->ports) if (i >= ldev->ports)
...@@ -1246,12 +1248,13 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev, ...@@ -1246,12 +1248,13 @@ void mlx5_lag_add_netdev(struct mlx5_core_dev *dev,
bool mlx5_lag_is_roce(struct mlx5_core_dev *dev) bool mlx5_lag_is_roce(struct mlx5_core_dev *dev)
{ {
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
bool res; bool res;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
res = ldev && __mlx5_lag_is_roce(ldev); res = ldev && __mlx5_lag_is_roce(ldev);
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return res; return res;
} }
...@@ -1260,12 +1263,13 @@ EXPORT_SYMBOL(mlx5_lag_is_roce); ...@@ -1260,12 +1263,13 @@ EXPORT_SYMBOL(mlx5_lag_is_roce);
bool mlx5_lag_is_active(struct mlx5_core_dev *dev) bool mlx5_lag_is_active(struct mlx5_core_dev *dev)
{ {
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
bool res; bool res;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
res = ldev && __mlx5_lag_is_active(ldev); res = ldev && __mlx5_lag_is_active(ldev);
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return res; return res;
} }
...@@ -1274,13 +1278,14 @@ EXPORT_SYMBOL(mlx5_lag_is_active); ...@@ -1274,13 +1278,14 @@ EXPORT_SYMBOL(mlx5_lag_is_active);
bool mlx5_lag_is_master(struct mlx5_core_dev *dev) bool mlx5_lag_is_master(struct mlx5_core_dev *dev)
{ {
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
bool res; bool res;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
res = ldev && __mlx5_lag_is_active(ldev) && res = ldev && __mlx5_lag_is_active(ldev) &&
dev == ldev->pf[MLX5_LAG_P1].dev; dev == ldev->pf[MLX5_LAG_P1].dev;
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return res; return res;
} }
...@@ -1289,12 +1294,13 @@ EXPORT_SYMBOL(mlx5_lag_is_master); ...@@ -1289,12 +1294,13 @@ EXPORT_SYMBOL(mlx5_lag_is_master);
bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev) bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev)
{ {
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
bool res; bool res;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
res = ldev && __mlx5_lag_is_sriov(ldev); res = ldev && __mlx5_lag_is_sriov(ldev);
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return res; return res;
} }
...@@ -1303,13 +1309,14 @@ EXPORT_SYMBOL(mlx5_lag_is_sriov); ...@@ -1303,13 +1309,14 @@ EXPORT_SYMBOL(mlx5_lag_is_sriov);
bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev) bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev)
{ {
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
bool res; bool res;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
res = ldev && __mlx5_lag_is_sriov(ldev) && res = ldev && __mlx5_lag_is_sriov(ldev) &&
test_bit(MLX5_LAG_MODE_FLAG_SHARED_FDB, &ldev->mode_flags); test_bit(MLX5_LAG_MODE_FLAG_SHARED_FDB, &ldev->mode_flags);
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return res; return res;
} }
...@@ -1352,9 +1359,10 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev) ...@@ -1352,9 +1359,10 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev)
{ {
struct net_device *ndev = NULL; struct net_device *ndev = NULL;
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
int i; int i;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
if (!(ldev && __mlx5_lag_is_roce(ldev))) if (!(ldev && __mlx5_lag_is_roce(ldev)))
...@@ -1373,7 +1381,7 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev) ...@@ -1373,7 +1381,7 @@ struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev)
dev_hold(ndev); dev_hold(ndev);
unlock: unlock:
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return ndev; return ndev;
} }
...@@ -1383,10 +1391,11 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev, ...@@ -1383,10 +1391,11 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev,
struct net_device *slave) struct net_device *slave)
{ {
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
u8 port = 0; u8 port = 0;
int i; int i;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
if (!(ldev && __mlx5_lag_is_roce(ldev))) if (!(ldev && __mlx5_lag_is_roce(ldev)))
goto unlock; goto unlock;
...@@ -1401,7 +1410,7 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev, ...@@ -1401,7 +1410,7 @@ u8 mlx5_lag_get_slave_port(struct mlx5_core_dev *dev,
port = ldev->v2p_map[port * ldev->buckets]; port = ldev->v2p_map[port * ldev->buckets];
unlock: unlock:
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return port; return port;
} }
EXPORT_SYMBOL(mlx5_lag_get_slave_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) ...@@ -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_core_dev *peer_dev = NULL;
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
if (!ldev) if (!ldev)
goto unlock; goto unlock;
...@@ -1433,7 +1443,7 @@ struct mlx5_core_dev *mlx5_lag_get_peer_mdev(struct mlx5_core_dev *dev) ...@@ -1433,7 +1443,7 @@ struct mlx5_core_dev *mlx5_lag_get_peer_mdev(struct mlx5_core_dev *dev)
ldev->pf[MLX5_LAG_P1].dev; ldev->pf[MLX5_LAG_P1].dev;
unlock: unlock:
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
return peer_dev; return peer_dev;
} }
EXPORT_SYMBOL(mlx5_lag_get_peer_mdev); EXPORT_SYMBOL(mlx5_lag_get_peer_mdev);
...@@ -1446,6 +1456,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev, ...@@ -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); int outlen = MLX5_ST_SZ_BYTES(query_cong_statistics_out);
struct mlx5_core_dev **mdev; struct mlx5_core_dev **mdev;
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
unsigned long flags;
int num_ports; int num_ports;
int ret, i, j; int ret, i, j;
void *out; void *out;
...@@ -1462,7 +1473,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev, ...@@ -1462,7 +1473,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
memset(values, 0, sizeof(*values) * num_counters); memset(values, 0, sizeof(*values) * num_counters);
spin_lock(&lag_lock); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
if (ldev && __mlx5_lag_is_active(ldev)) { if (ldev && __mlx5_lag_is_active(ldev)) {
num_ports = ldev->ports; num_ports = ldev->ports;
...@@ -1472,7 +1483,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev, ...@@ -1472,7 +1483,7 @@ int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,
num_ports = 1; num_ports = 1;
mdev[MLX5_LAG_P1] = dev; mdev[MLX5_LAG_P1] = dev;
} }
spin_unlock(&lag_lock); spin_unlock_irqrestore(&lag_lock, flags);
for (i = 0; i < num_ports; ++i) { for (i = 0; i < num_ports; ++i) {
u32 in[MLX5_ST_SZ_DW(query_cong_statistics_in)] = {}; 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) ...@@ -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)); memcpy(&dev->profile, &profile[profile_idx], sizeof(dev->profile));
INIT_LIST_HEAD(&priv->ctx_list); INIT_LIST_HEAD(&priv->ctx_list);
spin_lock_init(&priv->ctx_lock); spin_lock_init(&priv->ctx_lock);
lockdep_register_key(&dev->lock_key);
mutex_init(&dev->intf_state_mutex); 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.reg_head.lock);
mutex_init(&priv->bfregs.wc_head.lock); mutex_init(&priv->bfregs.wc_head.lock);
...@@ -1597,6 +1599,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) ...@@ -1597,6 +1599,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
mutex_destroy(&priv->bfregs.wc_head.lock); mutex_destroy(&priv->bfregs.wc_head.lock);
mutex_destroy(&priv->bfregs.reg_head.lock); mutex_destroy(&priv->bfregs.reg_head.lock);
mutex_destroy(&dev->intf_state_mutex); mutex_destroy(&dev->intf_state_mutex);
lockdep_unregister_key(&dev->lock_key);
return err; return err;
} }
...@@ -1618,6 +1621,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev) ...@@ -1618,6 +1621,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev)
mutex_destroy(&priv->bfregs.wc_head.lock); mutex_destroy(&priv->bfregs.wc_head.lock);
mutex_destroy(&priv->bfregs.reg_head.lock); mutex_destroy(&priv->bfregs.reg_head.lock);
mutex_destroy(&dev->intf_state_mutex); 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) static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
......
...@@ -376,8 +376,8 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, ...@@ -376,8 +376,8 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
goto out_dropped; goto out_dropped;
} }
} }
if (err) {
err = mlx5_cmd_check(dev, err, in, out); err = mlx5_cmd_check(dev, err, in, out);
if (err) {
mlx5_core_warn(dev, "func_id 0x%x, npages %d, err %d\n", mlx5_core_warn(dev, "func_id 0x%x, npages %d, err %d\n",
func_id, npages, err); func_id, npages, err);
goto out_dropped; goto out_dropped;
...@@ -524,10 +524,13 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, ...@@ -524,10 +524,13 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u16 func_id, int npages,
dev->priv.reclaim_pages_discard += npages; dev->priv.reclaim_pages_discard += npages;
} }
/* if triggered by FW event and failed by FW then ignore */ /* if triggered by FW event and failed by FW then ignore */
if (event && err == -EREMOTEIO) if (event && err == -EREMOTEIO) {
err = 0; err = 0;
if (err) { goto out_free;
}
err = mlx5_cmd_check(dev, err, in, out); err = mlx5_cmd_check(dev, err, in, out);
if (err) {
mlx5_core_err(dev, "failed reclaiming pages: err %d\n", err); mlx5_core_err(dev, "failed reclaiming pages: err %d\n", err);
goto out_free; goto out_free;
} }
......
...@@ -159,11 +159,11 @@ static int mlx5_sriov_enable(struct pci_dev *pdev, int num_vfs) ...@@ -159,11 +159,11 @@ static int mlx5_sriov_enable(struct pci_dev *pdev, int num_vfs)
devl_lock(devlink); devl_lock(devlink);
err = mlx5_device_enable_sriov(dev, num_vfs); err = mlx5_device_enable_sriov(dev, num_vfs);
devl_unlock(devlink);
if (err) { if (err) {
mlx5_core_warn(dev, "mlx5_device_enable_sriov failed : %d\n", err); mlx5_core_warn(dev, "mlx5_device_enable_sriov failed : %d\n", err);
return err; return err;
} }
devl_unlock(devlink);
err = pci_enable_sriov(pdev, num_vfs); err = pci_enable_sriov(pdev, num_vfs);
if (err) { if (err) {
......
...@@ -779,6 +779,7 @@ struct mlx5_core_dev { ...@@ -779,6 +779,7 @@ struct mlx5_core_dev {
enum mlx5_device_state state; enum mlx5_device_state state;
/* sync interface state */ /* sync interface state */
struct mutex intf_state_mutex; struct mutex intf_state_mutex;
struct lock_class_key lock_key;
unsigned long intf_state; unsigned long intf_state;
struct mlx5_priv priv; struct mlx5_priv priv;
struct mlx5_profile profile; struct mlx5_profile profile;
......
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