Merge branch 'mlx5-misc-fixes-2025-10-22'

Tariq Toukan says:

====================
mlx5 misc fixes 2025-10-22

This patchset provides misc bug fixes from the team to the mlx5 core and
Eth drivers.
====================

Link: https://patch.msgid.link/1761136182-918470-1-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2025-10-23 07:14:38 -07:00
commit cb68d1e5c5
11 changed files with 75 additions and 46 deletions

View File

@ -342,6 +342,7 @@ void mlx5e_ipsec_build_accel_xfrm_attrs(struct mlx5e_ipsec_sa_entry *sa_entry,
void mlx5e_ipsec_handle_mpv_event(int event, struct mlx5e_priv *slave_priv,
struct mlx5e_priv *master_priv);
void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event);
void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv);
static inline struct mlx5_core_dev *
mlx5e_ipsec_sa2dev(struct mlx5e_ipsec_sa_entry *sa_entry)
@ -387,6 +388,10 @@ static inline void mlx5e_ipsec_handle_mpv_event(int event, struct mlx5e_priv *sl
static inline void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event)
{
}
static inline void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv)
{
}
#endif
#endif /* __MLX5E_IPSEC_H__ */

View File

@ -2893,9 +2893,30 @@ void mlx5e_ipsec_handle_mpv_event(int event, struct mlx5e_priv *slave_priv,
void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event)
{
if (!priv->ipsec)
return; /* IPsec not supported */
if (!priv->ipsec || mlx5_devcom_comp_get_size(priv->devcom) < 2)
return; /* IPsec not supported or no peers */
mlx5_devcom_send_event(priv->devcom, event, event, priv);
wait_for_completion(&priv->ipsec->comp);
}
void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv)
{
struct mlx5_devcom_comp_dev *tmp = NULL;
struct mlx5e_priv *peer_priv;
if (!priv->devcom)
return;
if (!mlx5_devcom_for_each_peer_begin(priv->devcom))
goto out;
peer_priv = mlx5_devcom_get_next_peer_data(priv->devcom, &tmp);
if (peer_priv)
complete_all(&peer_priv->ipsec->comp);
mlx5_devcom_for_each_peer_end(priv->devcom);
out:
mlx5_devcom_unregister_component(priv->devcom);
priv->devcom = NULL;
}

View File

@ -242,8 +242,8 @@ static int mlx5e_devcom_init_mpv(struct mlx5e_priv *priv, u64 *data)
&attr,
mlx5e_devcom_event_mpv,
priv);
if (IS_ERR(priv->devcom))
return PTR_ERR(priv->devcom);
if (!priv->devcom)
return -EINVAL;
if (mlx5_core_is_mp_master(priv->mdev)) {
mlx5_devcom_send_event(priv->devcom, MPV_DEVCOM_MASTER_UP,
@ -256,7 +256,7 @@ static int mlx5e_devcom_init_mpv(struct mlx5e_priv *priv, u64 *data)
static void mlx5e_devcom_cleanup_mpv(struct mlx5e_priv *priv)
{
if (IS_ERR_OR_NULL(priv->devcom))
if (!priv->devcom)
return;
if (mlx5_core_is_mp_master(priv->mdev)) {
@ -266,6 +266,7 @@ static void mlx5e_devcom_cleanup_mpv(struct mlx5e_priv *priv)
}
mlx5_devcom_unregister_component(priv->devcom);
priv->devcom = NULL;
}
static int blocking_event(struct notifier_block *nb, unsigned long event, void *data)
@ -6120,6 +6121,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
if (mlx5e_monitor_counter_supported(priv))
mlx5e_monitor_counter_cleanup(priv);
mlx5e_ipsec_disable_events(priv);
mlx5e_disable_blocking_events(priv);
mlx5e_disable_async_events(priv);
mlx5_lag_remove_netdev(mdev, priv->netdev);

View File

@ -1614,7 +1614,9 @@ void mlx5e_stats_fec_get(struct mlx5e_priv *priv,
fec_set_corrected_bits_total(priv, fec_stats);
fec_set_block_stats(priv, mode, fec_stats);
fec_set_histograms_stats(priv, mode, hist);
if (MLX5_CAP_PCAM_REG(priv->mdev, pphcr))
fec_set_histograms_stats(priv, mode, hist);
}
#define PPORT_ETH_EXT_OFF(c) \

View File

@ -3129,7 +3129,7 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw,
attr,
mlx5_esw_offloads_devcom_event,
esw);
if (IS_ERR(esw->devcom))
if (!esw->devcom)
return;
mlx5_devcom_send_event(esw->devcom,
@ -3140,7 +3140,7 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw,
void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw)
{
if (IS_ERR_OR_NULL(esw->devcom))
if (!esw->devcom)
return;
mlx5_devcom_send_event(esw->devcom,

View File

@ -1430,11 +1430,10 @@ static int mlx5_lag_register_hca_devcom_comp(struct mlx5_core_dev *dev)
mlx5_devcom_register_component(dev->priv.devc,
MLX5_DEVCOM_HCA_PORTS,
&attr, NULL, dev);
if (IS_ERR(dev->priv.hca_devcom_comp)) {
if (!dev->priv.hca_devcom_comp) {
mlx5_core_err(dev,
"Failed to register devcom HCA component, err: %ld\n",
PTR_ERR(dev->priv.hca_devcom_comp));
return PTR_ERR(dev->priv.hca_devcom_comp);
"Failed to register devcom HCA component.");
return -EINVAL;
}
return 0;

View File

@ -1444,7 +1444,7 @@ static void mlx5_shared_clock_register(struct mlx5_core_dev *mdev, u64 key)
compd = mlx5_devcom_register_component(mdev->priv.devc,
MLX5_DEVCOM_SHARED_CLOCK,
&attr, NULL, mdev);
if (IS_ERR(compd))
if (!compd)
return;
mdev->clock_state->compdev = compd;

View File

@ -76,20 +76,18 @@ mlx5_devcom_dev_alloc(struct mlx5_core_dev *dev)
struct mlx5_devcom_dev *
mlx5_devcom_register_device(struct mlx5_core_dev *dev)
{
struct mlx5_devcom_dev *devc;
struct mlx5_devcom_dev *devc = NULL;
mutex_lock(&dev_list_lock);
if (devcom_dev_exists(dev)) {
devc = ERR_PTR(-EEXIST);
mlx5_core_err(dev, "devcom device already exists");
goto out;
}
devc = mlx5_devcom_dev_alloc(dev);
if (!devc) {
devc = ERR_PTR(-ENOMEM);
if (!devc)
goto out;
}
list_add_tail(&devc->list, &devcom_dev_list);
out:
@ -110,8 +108,10 @@ mlx5_devcom_dev_release(struct kref *ref)
void mlx5_devcom_unregister_device(struct mlx5_devcom_dev *devc)
{
if (!IS_ERR_OR_NULL(devc))
kref_put(&devc->ref, mlx5_devcom_dev_release);
if (!devc)
return;
kref_put(&devc->ref, mlx5_devcom_dev_release);
}
static struct mlx5_devcom_comp *
@ -122,7 +122,7 @@ mlx5_devcom_comp_alloc(u64 id, const struct mlx5_devcom_match_attr *attr,
comp = kzalloc(sizeof(*comp), GFP_KERNEL);
if (!comp)
return ERR_PTR(-ENOMEM);
return NULL;
comp->id = id;
comp->key.key = attr->key;
@ -160,7 +160,7 @@ devcom_alloc_comp_dev(struct mlx5_devcom_dev *devc,
devcom = kzalloc(sizeof(*devcom), GFP_KERNEL);
if (!devcom)
return ERR_PTR(-ENOMEM);
return NULL;
kref_get(&devc->ref);
devcom->devc = devc;
@ -240,31 +240,28 @@ mlx5_devcom_register_component(struct mlx5_devcom_dev *devc,
mlx5_devcom_event_handler_t handler,
void *data)
{
struct mlx5_devcom_comp_dev *devcom;
struct mlx5_devcom_comp_dev *devcom = NULL;
struct mlx5_devcom_comp *comp;
if (IS_ERR_OR_NULL(devc))
return ERR_PTR(-EINVAL);
if (!devc)
return NULL;
mutex_lock(&comp_list_lock);
comp = devcom_component_get(devc, id, attr, handler);
if (IS_ERR(comp)) {
devcom = ERR_PTR(-EINVAL);
if (IS_ERR(comp))
goto out_unlock;
}
if (!comp) {
comp = mlx5_devcom_comp_alloc(id, attr, handler);
if (IS_ERR(comp)) {
devcom = ERR_CAST(comp);
if (!comp)
goto out_unlock;
}
list_add_tail(&comp->comp_list, &devcom_comp_list);
}
mutex_unlock(&comp_list_lock);
devcom = devcom_alloc_comp_dev(devc, comp, data);
if (IS_ERR(devcom))
if (!devcom)
kref_put(&comp->ref, mlx5_devcom_comp_release);
return devcom;
@ -276,8 +273,10 @@ mlx5_devcom_register_component(struct mlx5_devcom_dev *devc,
void mlx5_devcom_unregister_component(struct mlx5_devcom_comp_dev *devcom)
{
if (!IS_ERR_OR_NULL(devcom))
devcom_free_comp_dev(devcom);
if (!devcom)
return;
devcom_free_comp_dev(devcom);
}
int mlx5_devcom_comp_get_size(struct mlx5_devcom_comp_dev *devcom)
@ -296,7 +295,7 @@ int mlx5_devcom_send_event(struct mlx5_devcom_comp_dev *devcom,
int err = 0;
void *data;
if (IS_ERR_OR_NULL(devcom))
if (!devcom)
return -ENODEV;
comp = devcom->comp;
@ -338,7 +337,7 @@ void mlx5_devcom_comp_set_ready(struct mlx5_devcom_comp_dev *devcom, bool ready)
bool mlx5_devcom_comp_is_ready(struct mlx5_devcom_comp_dev *devcom)
{
if (IS_ERR_OR_NULL(devcom))
if (!devcom)
return false;
return READ_ONCE(devcom->comp->ready);
@ -348,7 +347,7 @@ bool mlx5_devcom_for_each_peer_begin(struct mlx5_devcom_comp_dev *devcom)
{
struct mlx5_devcom_comp *comp;
if (IS_ERR_OR_NULL(devcom))
if (!devcom)
return false;
comp = devcom->comp;
@ -421,21 +420,21 @@ void *mlx5_devcom_get_next_peer_data_rcu(struct mlx5_devcom_comp_dev *devcom,
void mlx5_devcom_comp_lock(struct mlx5_devcom_comp_dev *devcom)
{
if (IS_ERR_OR_NULL(devcom))
if (!devcom)
return;
down_write(&devcom->comp->sem);
}
void mlx5_devcom_comp_unlock(struct mlx5_devcom_comp_dev *devcom)
{
if (IS_ERR_OR_NULL(devcom))
if (!devcom)
return;
up_write(&devcom->comp->sem);
}
int mlx5_devcom_comp_trylock(struct mlx5_devcom_comp_dev *devcom)
{
if (IS_ERR_OR_NULL(devcom))
if (!devcom)
return 0;
return down_write_trylock(&devcom->comp->sem);
}

View File

@ -221,8 +221,8 @@ static int sd_register(struct mlx5_core_dev *dev)
attr.net = mlx5_core_net(dev);
devcom = mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_SD_GROUP,
&attr, NULL, dev);
if (IS_ERR(devcom))
return PTR_ERR(devcom);
if (!devcom)
return -EINVAL;
sd->devcom = devcom;

View File

@ -978,9 +978,8 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)
int err;
dev->priv.devc = mlx5_devcom_register_device(dev);
if (IS_ERR(dev->priv.devc))
mlx5_core_warn(dev, "failed to register devcom device %pe\n",
dev->priv.devc);
if (!dev->priv.devc)
mlx5_core_warn(dev, "failed to register devcom device\n");
err = mlx5_query_board_id(dev);
if (err) {

View File

@ -10833,7 +10833,9 @@ struct mlx5_ifc_pcam_regs_5000_to_507f_bits {
u8 port_access_reg_cap_mask_127_to_96[0x20];
u8 port_access_reg_cap_mask_95_to_64[0x20];
u8 port_access_reg_cap_mask_63_to_36[0x1c];
u8 port_access_reg_cap_mask_63[0x1];
u8 pphcr[0x1];
u8 port_access_reg_cap_mask_61_to_36[0x1a];
u8 pplm[0x1];
u8 port_access_reg_cap_mask_34_to_32[0x3];