Commit 72041e53 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'mlx5-fixes'

Tariq Toukan says:

====================
mlx5 fixes

This patchset provides bug fixes to mlx5 core and Eth drivers.
====================

Link: https://lore.kernel.org/r/20240411115444.374475-1-tariqt@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 68aba004 fef96576
...@@ -108,7 +108,10 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx) ...@@ -108,7 +108,10 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx)
mlx5e_reset_txqsq_cc_pc(sq); mlx5e_reset_txqsq_cc_pc(sq);
sq->stats->recover++; sq->stats->recover++;
clear_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state); clear_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state);
rtnl_lock();
mlx5e_activate_txqsq(sq); mlx5e_activate_txqsq(sq);
rtnl_unlock();
if (sq->channel) if (sq->channel)
mlx5e_trigger_napi_icosq(sq->channel); mlx5e_trigger_napi_icosq(sq->channel);
else else
...@@ -179,12 +182,16 @@ static int mlx5e_tx_reporter_ptpsq_unhealthy_recover(void *ctx) ...@@ -179,12 +182,16 @@ static int mlx5e_tx_reporter_ptpsq_unhealthy_recover(void *ctx)
carrier_ok = netif_carrier_ok(netdev); carrier_ok = netif_carrier_ok(netdev);
netif_carrier_off(netdev); netif_carrier_off(netdev);
rtnl_lock();
mlx5e_deactivate_priv_channels(priv); mlx5e_deactivate_priv_channels(priv);
rtnl_unlock();
mlx5e_ptp_close(chs->ptp); mlx5e_ptp_close(chs->ptp);
err = mlx5e_ptp_open(priv, &chs->params, chs->c[0]->lag_port, &chs->ptp); err = mlx5e_ptp_open(priv, &chs->params, chs->c[0]->lag_port, &chs->ptp);
rtnl_lock();
mlx5e_activate_priv_channels(priv); mlx5e_activate_priv_channels(priv);
rtnl_unlock();
/* return carrier back if needed */ /* return carrier back if needed */
if (carrier_ok) if (carrier_ok)
......
...@@ -46,6 +46,10 @@ struct arfs_table { ...@@ -46,6 +46,10 @@ struct arfs_table {
struct hlist_head rules_hash[ARFS_HASH_SIZE]; struct hlist_head rules_hash[ARFS_HASH_SIZE];
}; };
enum {
MLX5E_ARFS_STATE_ENABLED,
};
enum arfs_type { enum arfs_type {
ARFS_IPV4_TCP, ARFS_IPV4_TCP,
ARFS_IPV6_TCP, ARFS_IPV6_TCP,
...@@ -60,6 +64,7 @@ struct mlx5e_arfs_tables { ...@@ -60,6 +64,7 @@ struct mlx5e_arfs_tables {
spinlock_t arfs_lock; spinlock_t arfs_lock;
int last_filter_id; int last_filter_id;
struct workqueue_struct *wq; struct workqueue_struct *wq;
unsigned long state;
}; };
struct arfs_tuple { struct arfs_tuple {
...@@ -170,6 +175,8 @@ int mlx5e_arfs_enable(struct mlx5e_flow_steering *fs) ...@@ -170,6 +175,8 @@ int mlx5e_arfs_enable(struct mlx5e_flow_steering *fs)
return err; return err;
} }
} }
set_bit(MLX5E_ARFS_STATE_ENABLED, &arfs->state);
return 0; return 0;
} }
...@@ -455,6 +462,8 @@ static void arfs_del_rules(struct mlx5e_flow_steering *fs) ...@@ -455,6 +462,8 @@ static void arfs_del_rules(struct mlx5e_flow_steering *fs)
int i; int i;
int j; int j;
clear_bit(MLX5E_ARFS_STATE_ENABLED, &arfs->state);
spin_lock_bh(&arfs->arfs_lock); spin_lock_bh(&arfs->arfs_lock);
mlx5e_for_each_arfs_rule(rule, htmp, arfs->arfs_tables, i, j) { mlx5e_for_each_arfs_rule(rule, htmp, arfs->arfs_tables, i, j) {
hlist_del_init(&rule->hlist); hlist_del_init(&rule->hlist);
...@@ -627,17 +636,8 @@ static void arfs_handle_work(struct work_struct *work) ...@@ -627,17 +636,8 @@ static void arfs_handle_work(struct work_struct *work)
struct mlx5_flow_handle *rule; struct mlx5_flow_handle *rule;
arfs = mlx5e_fs_get_arfs(priv->fs); arfs = mlx5e_fs_get_arfs(priv->fs);
mutex_lock(&priv->state_lock); if (!test_bit(MLX5E_ARFS_STATE_ENABLED, &arfs->state))
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { return;
spin_lock_bh(&arfs->arfs_lock);
hlist_del(&arfs_rule->hlist);
spin_unlock_bh(&arfs->arfs_lock);
mutex_unlock(&priv->state_lock);
kfree(arfs_rule);
goto out;
}
mutex_unlock(&priv->state_lock);
if (!arfs_rule->rule) { if (!arfs_rule->rule) {
rule = arfs_add_rule(priv, arfs_rule); rule = arfs_add_rule(priv, arfs_rule);
...@@ -753,6 +753,11 @@ int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, ...@@ -753,6 +753,11 @@ int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
spin_lock_bh(&arfs->arfs_lock); spin_lock_bh(&arfs->arfs_lock);
if (!test_bit(MLX5E_ARFS_STATE_ENABLED, &arfs->state)) {
spin_unlock_bh(&arfs->arfs_lock);
return -EPERM;
}
arfs_rule = arfs_find_rule(arfs_t, &fk); arfs_rule = arfs_find_rule(arfs_t, &fk);
if (arfs_rule) { if (arfs_rule) {
if (arfs_rule->rxq == rxq_index || work_busy(&arfs_rule->arfs_work)) { if (arfs_rule->rxq == rxq_index || work_busy(&arfs_rule->arfs_work)) {
......
...@@ -589,12 +589,12 @@ static int mlx5e_get_coalesce(struct net_device *netdev, ...@@ -589,12 +589,12 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
static void static void
mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
{ {
struct mlx5_core_dev *mdev = priv->mdev;
int tc; int tc;
int i; int i;
for (i = 0; i < priv->channels.num; ++i) { for (i = 0; i < priv->channels.num; ++i) {
struct mlx5e_channel *c = priv->channels.c[i]; struct mlx5e_channel *c = priv->channels.c[i];
struct mlx5_core_dev *mdev = c->mdev;
for (tc = 0; tc < c->num_tc; tc++) { for (tc = 0; tc < c->num_tc; tc++) {
mlx5_core_modify_cq_moderation(mdev, mlx5_core_modify_cq_moderation(mdev,
...@@ -608,11 +608,11 @@ mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, struct ethtool_coal ...@@ -608,11 +608,11 @@ mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, struct ethtool_coal
static void static void
mlx5e_set_priv_channels_rx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) mlx5e_set_priv_channels_rx_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
{ {
struct mlx5_core_dev *mdev = priv->mdev;
int i; int i;
for (i = 0; i < priv->channels.num; ++i) { for (i = 0; i < priv->channels.num; ++i) {
struct mlx5e_channel *c = priv->channels.c[i]; struct mlx5e_channel *c = priv->channels.c[i];
struct mlx5_core_dev *mdev = c->mdev;
mlx5_core_modify_cq_moderation(mdev, &c->rq.cq.mcq, mlx5_core_modify_cq_moderation(mdev, &c->rq.cq.mcq,
coal->rx_coalesce_usecs, coal->rx_coalesce_usecs,
......
...@@ -209,8 +209,8 @@ static int mlx5e_devcom_init_mpv(struct mlx5e_priv *priv, u64 *data) ...@@ -209,8 +209,8 @@ static int mlx5e_devcom_init_mpv(struct mlx5e_priv *priv, u64 *data)
*data, *data,
mlx5e_devcom_event_mpv, mlx5e_devcom_event_mpv,
priv); priv);
if (IS_ERR_OR_NULL(priv->devcom)) if (IS_ERR(priv->devcom))
return -EOPNOTSUPP; return PTR_ERR(priv->devcom);
if (mlx5_core_is_mp_master(priv->mdev)) { if (mlx5_core_is_mp_master(priv->mdev)) {
mlx5_devcom_send_event(priv->devcom, MPV_DEVCOM_MASTER_UP, mlx5_devcom_send_event(priv->devcom, MPV_DEVCOM_MASTER_UP,
......
...@@ -3060,7 +3060,7 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw, u64 key) ...@@ -3060,7 +3060,7 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw, u64 key)
key, key,
mlx5_esw_offloads_devcom_event, mlx5_esw_offloads_devcom_event,
esw); esw);
if (IS_ERR_OR_NULL(esw->devcom)) if (IS_ERR(esw->devcom))
return; return;
mlx5_devcom_send_event(esw->devcom, mlx5_devcom_send_event(esw->devcom,
......
...@@ -703,8 +703,10 @@ int mlx5_deactivate_lag(struct mlx5_lag *ldev) ...@@ -703,8 +703,10 @@ int mlx5_deactivate_lag(struct mlx5_lag *ldev)
return err; return err;
} }
if (test_bit(MLX5_LAG_MODE_FLAG_HASH_BASED, &flags)) if (test_bit(MLX5_LAG_MODE_FLAG_HASH_BASED, &flags)) {
mlx5_lag_port_sel_destroy(ldev); mlx5_lag_port_sel_destroy(ldev);
ldev->buckets = 1;
}
if (mlx5_lag_has_drop_rule(ldev)) if (mlx5_lag_has_drop_rule(ldev))
mlx5_lag_drop_rule_cleanup(ldev); mlx5_lag_drop_rule_cleanup(ldev);
......
...@@ -220,7 +220,7 @@ mlx5_devcom_register_component(struct mlx5_devcom_dev *devc, ...@@ -220,7 +220,7 @@ mlx5_devcom_register_component(struct mlx5_devcom_dev *devc,
struct mlx5_devcom_comp *comp; struct mlx5_devcom_comp *comp;
if (IS_ERR_OR_NULL(devc)) if (IS_ERR_OR_NULL(devc))
return NULL; return ERR_PTR(-EINVAL);
mutex_lock(&comp_list_lock); mutex_lock(&comp_list_lock);
comp = devcom_component_get(devc, id, key, handler); comp = devcom_component_get(devc, id, key, handler);
......
...@@ -213,8 +213,8 @@ static int sd_register(struct mlx5_core_dev *dev) ...@@ -213,8 +213,8 @@ static int sd_register(struct mlx5_core_dev *dev)
sd = mlx5_get_sd(dev); sd = mlx5_get_sd(dev);
devcom = mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_SD_GROUP, devcom = mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_SD_GROUP,
sd->group_id, NULL, dev); sd->group_id, NULL, dev);
if (!devcom) if (IS_ERR(devcom))
return -ENOMEM; return PTR_ERR(devcom);
sd->devcom = devcom; sd->devcom = devcom;
......
...@@ -956,7 +956,7 @@ static void mlx5_register_hca_devcom_comp(struct mlx5_core_dev *dev) ...@@ -956,7 +956,7 @@ static void mlx5_register_hca_devcom_comp(struct mlx5_core_dev *dev)
mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_HCA_PORTS, mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_HCA_PORTS,
mlx5_query_nic_system_image_guid(dev), mlx5_query_nic_system_image_guid(dev),
NULL, dev); NULL, dev);
if (IS_ERR_OR_NULL(dev->priv.hca_devcom_comp)) if (IS_ERR(dev->priv.hca_devcom_comp))
mlx5_core_err(dev, "Failed to register devcom HCA component\n"); mlx5_core_err(dev, "Failed to register devcom HCA component\n");
} }
...@@ -1699,12 +1699,15 @@ int mlx5_init_one_light(struct mlx5_core_dev *dev) ...@@ -1699,12 +1699,15 @@ int mlx5_init_one_light(struct mlx5_core_dev *dev)
err = mlx5_devlink_params_register(priv_to_devlink(dev)); err = mlx5_devlink_params_register(priv_to_devlink(dev));
if (err) { if (err) {
mlx5_core_warn(dev, "mlx5_devlink_param_reg err = %d\n", err); mlx5_core_warn(dev, "mlx5_devlink_param_reg err = %d\n", err);
goto query_hca_caps_err; goto params_reg_err;
} }
devl_unlock(devlink); devl_unlock(devlink);
return 0; return 0;
params_reg_err:
devl_unregister(devlink);
devl_unlock(devlink);
query_hca_caps_err: query_hca_caps_err:
devl_unregister(devlink); devl_unregister(devlink);
devl_unlock(devlink); devl_unlock(devlink);
......
...@@ -75,7 +75,6 @@ static int mlx5_sf_dev_probe(struct auxiliary_device *adev, const struct auxilia ...@@ -75,7 +75,6 @@ static int mlx5_sf_dev_probe(struct auxiliary_device *adev, const struct auxilia
goto peer_devlink_set_err; goto peer_devlink_set_err;
} }
devlink_register(devlink);
return 0; return 0;
peer_devlink_set_err: peer_devlink_set_err:
......
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