Skip to content

Commit cb68d1e

Browse files
committed
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>
2 parents b228476 + 664f76b commit cb68d1e

11 files changed

Lines changed: 75 additions & 46 deletions

File tree

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ void mlx5e_ipsec_build_accel_xfrm_attrs(struct mlx5e_ipsec_sa_entry *sa_entry,
342342
void mlx5e_ipsec_handle_mpv_event(int event, struct mlx5e_priv *slave_priv,
343343
struct mlx5e_priv *master_priv);
344344
void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event);
345+
void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv);
345346

346347
static inline struct mlx5_core_dev *
347348
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
387388
static inline void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event)
388389
{
389390
}
391+
392+
static inline void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv)
393+
{
394+
}
390395
#endif
391396

392397
#endif /* __MLX5E_IPSEC_H__ */

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,9 +2893,30 @@ void mlx5e_ipsec_handle_mpv_event(int event, struct mlx5e_priv *slave_priv,
28932893

28942894
void mlx5e_ipsec_send_event(struct mlx5e_priv *priv, int event)
28952895
{
2896-
if (!priv->ipsec)
2897-
return; /* IPsec not supported */
2896+
if (!priv->ipsec || mlx5_devcom_comp_get_size(priv->devcom) < 2)
2897+
return; /* IPsec not supported or no peers */
28982898

28992899
mlx5_devcom_send_event(priv->devcom, event, event, priv);
29002900
wait_for_completion(&priv->ipsec->comp);
29012901
}
2902+
2903+
void mlx5e_ipsec_disable_events(struct mlx5e_priv *priv)
2904+
{
2905+
struct mlx5_devcom_comp_dev *tmp = NULL;
2906+
struct mlx5e_priv *peer_priv;
2907+
2908+
if (!priv->devcom)
2909+
return;
2910+
2911+
if (!mlx5_devcom_for_each_peer_begin(priv->devcom))
2912+
goto out;
2913+
2914+
peer_priv = mlx5_devcom_get_next_peer_data(priv->devcom, &tmp);
2915+
if (peer_priv)
2916+
complete_all(&peer_priv->ipsec->comp);
2917+
2918+
mlx5_devcom_for_each_peer_end(priv->devcom);
2919+
out:
2920+
mlx5_devcom_unregister_component(priv->devcom);
2921+
priv->devcom = NULL;
2922+
}

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ static int mlx5e_devcom_init_mpv(struct mlx5e_priv *priv, u64 *data)
242242
&attr,
243243
mlx5e_devcom_event_mpv,
244244
priv);
245-
if (IS_ERR(priv->devcom))
246-
return PTR_ERR(priv->devcom);
245+
if (!priv->devcom)
246+
return -EINVAL;
247247

248248
if (mlx5_core_is_mp_master(priv->mdev)) {
249249
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)
256256

257257
static void mlx5e_devcom_cleanup_mpv(struct mlx5e_priv *priv)
258258
{
259-
if (IS_ERR_OR_NULL(priv->devcom))
259+
if (!priv->devcom)
260260
return;
261261

262262
if (mlx5_core_is_mp_master(priv->mdev)) {
@@ -266,6 +266,7 @@ static void mlx5e_devcom_cleanup_mpv(struct mlx5e_priv *priv)
266266
}
267267

268268
mlx5_devcom_unregister_component(priv->devcom);
269+
priv->devcom = NULL;
269270
}
270271

271272
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)
61206121
if (mlx5e_monitor_counter_supported(priv))
61216122
mlx5e_monitor_counter_cleanup(priv);
61226123

6124+
mlx5e_ipsec_disable_events(priv);
61236125
mlx5e_disable_blocking_events(priv);
61246126
mlx5e_disable_async_events(priv);
61256127
mlx5_lag_remove_netdev(mdev, priv->netdev);

drivers/net/ethernet/mellanox/mlx5/core/en_stats.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,9 @@ void mlx5e_stats_fec_get(struct mlx5e_priv *priv,
16141614

16151615
fec_set_corrected_bits_total(priv, fec_stats);
16161616
fec_set_block_stats(priv, mode, fec_stats);
1617-
fec_set_histograms_stats(priv, mode, hist);
1617+
1618+
if (MLX5_CAP_PCAM_REG(priv->mdev, pphcr))
1619+
fec_set_histograms_stats(priv, mode, hist);
16181620
}
16191621

16201622
#define PPORT_ETH_EXT_OFF(c) \

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,7 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw,
31293129
attr,
31303130
mlx5_esw_offloads_devcom_event,
31313131
esw);
3132-
if (IS_ERR(esw->devcom))
3132+
if (!esw->devcom)
31333133
return;
31343134

31353135
mlx5_devcom_send_event(esw->devcom,
@@ -3140,7 +3140,7 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw,
31403140

31413141
void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw)
31423142
{
3143-
if (IS_ERR_OR_NULL(esw->devcom))
3143+
if (!esw->devcom)
31443144
return;
31453145

31463146
mlx5_devcom_send_event(esw->devcom,

drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,11 +1430,10 @@ static int mlx5_lag_register_hca_devcom_comp(struct mlx5_core_dev *dev)
14301430
mlx5_devcom_register_component(dev->priv.devc,
14311431
MLX5_DEVCOM_HCA_PORTS,
14321432
&attr, NULL, dev);
1433-
if (IS_ERR(dev->priv.hca_devcom_comp)) {
1433+
if (!dev->priv.hca_devcom_comp) {
14341434
mlx5_core_err(dev,
1435-
"Failed to register devcom HCA component, err: %ld\n",
1436-
PTR_ERR(dev->priv.hca_devcom_comp));
1437-
return PTR_ERR(dev->priv.hca_devcom_comp);
1435+
"Failed to register devcom HCA component.");
1436+
return -EINVAL;
14381437
}
14391438

14401439
return 0;

drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ static void mlx5_shared_clock_register(struct mlx5_core_dev *mdev, u64 key)
14441444
compd = mlx5_devcom_register_component(mdev->priv.devc,
14451445
MLX5_DEVCOM_SHARED_CLOCK,
14461446
&attr, NULL, mdev);
1447-
if (IS_ERR(compd))
1447+
if (!compd)
14481448
return;
14491449

14501450
mdev->clock_state->compdev = compd;

drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,18 @@ mlx5_devcom_dev_alloc(struct mlx5_core_dev *dev)
7676
struct mlx5_devcom_dev *
7777
mlx5_devcom_register_device(struct mlx5_core_dev *dev)
7878
{
79-
struct mlx5_devcom_dev *devc;
79+
struct mlx5_devcom_dev *devc = NULL;
8080

8181
mutex_lock(&dev_list_lock);
8282

8383
if (devcom_dev_exists(dev)) {
84-
devc = ERR_PTR(-EEXIST);
84+
mlx5_core_err(dev, "devcom device already exists");
8585
goto out;
8686
}
8787

8888
devc = mlx5_devcom_dev_alloc(dev);
89-
if (!devc) {
90-
devc = ERR_PTR(-ENOMEM);
89+
if (!devc)
9190
goto out;
92-
}
9391

9492
list_add_tail(&devc->list, &devcom_dev_list);
9593
out:
@@ -110,8 +108,10 @@ mlx5_devcom_dev_release(struct kref *ref)
110108

111109
void mlx5_devcom_unregister_device(struct mlx5_devcom_dev *devc)
112110
{
113-
if (!IS_ERR_OR_NULL(devc))
114-
kref_put(&devc->ref, mlx5_devcom_dev_release);
111+
if (!devc)
112+
return;
113+
114+
kref_put(&devc->ref, mlx5_devcom_dev_release);
115115
}
116116

117117
static struct mlx5_devcom_comp *
@@ -122,7 +122,7 @@ mlx5_devcom_comp_alloc(u64 id, const struct mlx5_devcom_match_attr *attr,
122122

123123
comp = kzalloc(sizeof(*comp), GFP_KERNEL);
124124
if (!comp)
125-
return ERR_PTR(-ENOMEM);
125+
return NULL;
126126

127127
comp->id = id;
128128
comp->key.key = attr->key;
@@ -160,7 +160,7 @@ devcom_alloc_comp_dev(struct mlx5_devcom_dev *devc,
160160

161161
devcom = kzalloc(sizeof(*devcom), GFP_KERNEL);
162162
if (!devcom)
163-
return ERR_PTR(-ENOMEM);
163+
return NULL;
164164

165165
kref_get(&devc->ref);
166166
devcom->devc = devc;
@@ -240,31 +240,28 @@ mlx5_devcom_register_component(struct mlx5_devcom_dev *devc,
240240
mlx5_devcom_event_handler_t handler,
241241
void *data)
242242
{
243-
struct mlx5_devcom_comp_dev *devcom;
243+
struct mlx5_devcom_comp_dev *devcom = NULL;
244244
struct mlx5_devcom_comp *comp;
245245

246-
if (IS_ERR_OR_NULL(devc))
247-
return ERR_PTR(-EINVAL);
246+
if (!devc)
247+
return NULL;
248248

249249
mutex_lock(&comp_list_lock);
250250
comp = devcom_component_get(devc, id, attr, handler);
251-
if (IS_ERR(comp)) {
252-
devcom = ERR_PTR(-EINVAL);
251+
if (IS_ERR(comp))
253252
goto out_unlock;
254-
}
255253

256254
if (!comp) {
257255
comp = mlx5_devcom_comp_alloc(id, attr, handler);
258-
if (IS_ERR(comp)) {
259-
devcom = ERR_CAST(comp);
256+
if (!comp)
260257
goto out_unlock;
261-
}
258+
262259
list_add_tail(&comp->comp_list, &devcom_comp_list);
263260
}
264261
mutex_unlock(&comp_list_lock);
265262

266263
devcom = devcom_alloc_comp_dev(devc, comp, data);
267-
if (IS_ERR(devcom))
264+
if (!devcom)
268265
kref_put(&comp->ref, mlx5_devcom_comp_release);
269266

270267
return devcom;
@@ -276,8 +273,10 @@ mlx5_devcom_register_component(struct mlx5_devcom_dev *devc,
276273

277274
void mlx5_devcom_unregister_component(struct mlx5_devcom_comp_dev *devcom)
278275
{
279-
if (!IS_ERR_OR_NULL(devcom))
280-
devcom_free_comp_dev(devcom);
276+
if (!devcom)
277+
return;
278+
279+
devcom_free_comp_dev(devcom);
281280
}
282281

283282
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,
296295
int err = 0;
297296
void *data;
298297

299-
if (IS_ERR_OR_NULL(devcom))
298+
if (!devcom)
300299
return -ENODEV;
301300

302301
comp = devcom->comp;
@@ -338,7 +337,7 @@ void mlx5_devcom_comp_set_ready(struct mlx5_devcom_comp_dev *devcom, bool ready)
338337

339338
bool mlx5_devcom_comp_is_ready(struct mlx5_devcom_comp_dev *devcom)
340339
{
341-
if (IS_ERR_OR_NULL(devcom))
340+
if (!devcom)
342341
return false;
343342

344343
return READ_ONCE(devcom->comp->ready);
@@ -348,7 +347,7 @@ bool mlx5_devcom_for_each_peer_begin(struct mlx5_devcom_comp_dev *devcom)
348347
{
349348
struct mlx5_devcom_comp *comp;
350349

351-
if (IS_ERR_OR_NULL(devcom))
350+
if (!devcom)
352351
return false;
353352

354353
comp = devcom->comp;
@@ -421,21 +420,21 @@ void *mlx5_devcom_get_next_peer_data_rcu(struct mlx5_devcom_comp_dev *devcom,
421420

422421
void mlx5_devcom_comp_lock(struct mlx5_devcom_comp_dev *devcom)
423422
{
424-
if (IS_ERR_OR_NULL(devcom))
423+
if (!devcom)
425424
return;
426425
down_write(&devcom->comp->sem);
427426
}
428427

429428
void mlx5_devcom_comp_unlock(struct mlx5_devcom_comp_dev *devcom)
430429
{
431-
if (IS_ERR_OR_NULL(devcom))
430+
if (!devcom)
432431
return;
433432
up_write(&devcom->comp->sem);
434433
}
435434

436435
int mlx5_devcom_comp_trylock(struct mlx5_devcom_comp_dev *devcom)
437436
{
438-
if (IS_ERR_OR_NULL(devcom))
437+
if (!devcom)
439438
return 0;
440439
return down_write_trylock(&devcom->comp->sem);
441440
}

drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ static int sd_register(struct mlx5_core_dev *dev)
221221
attr.net = mlx5_core_net(dev);
222222
devcom = mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_SD_GROUP,
223223
&attr, NULL, dev);
224-
if (IS_ERR(devcom))
225-
return PTR_ERR(devcom);
224+
if (!devcom)
225+
return -EINVAL;
226226

227227
sd->devcom = devcom;
228228

drivers/net/ethernet/mellanox/mlx5/core/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,9 +978,8 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)
978978
int err;
979979

980980
dev->priv.devc = mlx5_devcom_register_device(dev);
981-
if (IS_ERR(dev->priv.devc))
982-
mlx5_core_warn(dev, "failed to register devcom device %pe\n",
983-
dev->priv.devc);
981+
if (!dev->priv.devc)
982+
mlx5_core_warn(dev, "failed to register devcom device\n");
984983

985984
err = mlx5_query_board_id(dev);
986985
if (err) {

0 commit comments

Comments
 (0)