Skip to content

Commit 4fc7885

Browse files
committed
Merge branch 'mlx5e-misc-fixes-2025-07-23'
Tariq Toukan says: ==================== mlx5e misc fixes 2025-07-23 This small patchset provides misc bug fixes from the team to the mlx5e driver. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents c8f1313 + e80d655 commit 4fc7885

File tree

5 files changed

+40
-1
lines changed

5 files changed

+40
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ struct mlx5e_rq {
728728
struct xsk_buff_pool *xsk_pool;
729729

730730
struct work_struct recover_work;
731+
struct work_struct rx_timeout_work;
731732

732733
/* control */
733734
struct mlx5_wq_ctrl wq_ctrl;

drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ static int port_set_buffer(struct mlx5e_priv *priv,
331331
if (err)
332332
goto out;
333333

334+
/* RO bits should be set to 0 on write */
335+
MLX5_SET(pbmc_reg, in, port_buffer_size, 0);
336+
334337
err = mlx5e_port_set_pbmc(mdev, in);
335338
out:
336339
kfree(in);

drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,23 @@ static int mlx5e_rx_reporter_err_rq_cqe_recover(void *ctx)
170170
static int mlx5e_rx_reporter_timeout_recover(void *ctx)
171171
{
172172
struct mlx5_eq_comp *eq;
173+
struct mlx5e_priv *priv;
173174
struct mlx5e_rq *rq;
174175
int err;
175176

176177
rq = ctx;
178+
priv = rq->priv;
179+
180+
mutex_lock(&priv->state_lock);
181+
177182
eq = rq->cq.mcq.eq;
178183

179184
err = mlx5e_health_channel_eq_recover(rq->netdev, eq, rq->cq.ch_stats);
180185
if (err && rq->icosq)
181186
clear_bit(MLX5E_SQ_STATE_ENABLED, &rq->icosq->state);
182187

188+
mutex_unlock(&priv->state_lock);
189+
183190
return err;
184191
}
185192

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,
327327
if (unlikely(!sa_entry)) {
328328
rcu_read_unlock();
329329
atomic64_inc(&ipsec->sw_stats.ipsec_rx_drop_sadb_miss);
330+
/* Clear secpath to prevent invalid dereference
331+
* in downstream XFRM policy checks.
332+
*/
333+
secpath_reset(skb);
330334
return;
331335
}
332336
xfrm_state_hold(sa_entry->x);

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,27 @@ static void mlx5e_rq_err_cqe_work(struct work_struct *recover_work)
707707
mlx5e_reporter_rq_cqe_err(rq);
708708
}
709709

710+
static void mlx5e_rq_timeout_work(struct work_struct *timeout_work)
711+
{
712+
struct mlx5e_rq *rq = container_of(timeout_work,
713+
struct mlx5e_rq,
714+
rx_timeout_work);
715+
716+
/* Acquire netdev instance lock to synchronize with channel close and
717+
* reopen flows. Either successfully obtain the lock, or detect that
718+
* channels are closing for another reason, making this work no longer
719+
* necessary.
720+
*/
721+
while (!netdev_trylock(rq->netdev)) {
722+
if (!test_bit(MLX5E_STATE_CHANNELS_ACTIVE, &rq->priv->state))
723+
return;
724+
msleep(20);
725+
}
726+
727+
mlx5e_reporter_rx_timeout(rq);
728+
netdev_unlock(rq->netdev);
729+
}
730+
710731
static int mlx5e_alloc_mpwqe_rq_drop_page(struct mlx5e_rq *rq)
711732
{
712733
rq->wqe_overflow.page = alloc_page(GFP_KERNEL);
@@ -830,6 +851,7 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
830851

831852
rqp->wq.db_numa_node = node;
832853
INIT_WORK(&rq->recover_work, mlx5e_rq_err_cqe_work);
854+
INIT_WORK(&rq->rx_timeout_work, mlx5e_rq_timeout_work);
833855

834856
if (params->xdp_prog)
835857
bpf_prog_inc(params->xdp_prog);
@@ -1204,7 +1226,8 @@ int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq, int wait_time)
12041226
netdev_warn(rq->netdev, "Failed to get min RX wqes on Channel[%d] RQN[0x%x] wq cur_sz(%d) min_rx_wqes(%d)\n",
12051227
rq->ix, rq->rqn, mlx5e_rqwq_get_cur_sz(rq), min_wqes);
12061228

1207-
mlx5e_reporter_rx_timeout(rq);
1229+
queue_work(rq->priv->wq, &rq->rx_timeout_work);
1230+
12081231
return -ETIMEDOUT;
12091232
}
12101233

@@ -1375,6 +1398,7 @@ void mlx5e_close_rq(struct mlx5e_rq *rq)
13751398
if (rq->dim)
13761399
cancel_work_sync(&rq->dim->work);
13771400
cancel_work_sync(&rq->recover_work);
1401+
cancel_work_sync(&rq->rx_timeout_work);
13781402
mlx5e_destroy_rq(rq);
13791403
mlx5e_free_rx_descs(rq);
13801404
mlx5e_free_rq(rq);

0 commit comments

Comments
 (0)