Skip to content

Commit 6d43a9f

Browse files
committed
Merge branch 'mlx5-misc-fixes-2026-03-16'
Tariq Toukan says: ==================== mlx5 misc fixes 2026-03-16 This patchset provides misc bug fixes from the team to the mlx5 core and Eth drivers. ==================== Link: https://patch.msgid.link/20260316094603.6999-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents d0f9eca + beb6e2e commit 6d43a9f

3 files changed

Lines changed: 32 additions & 42 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ struct mlx5e_ipsec_sa_entry {
287287
struct mlx5e_ipsec_dwork *dwork;
288288
struct mlx5e_ipsec_limits limits;
289289
u32 rx_mapped_id;
290+
u8 ctx[MLX5_ST_SZ_BYTES(ipsec_aso)];
290291
};
291292

292293
struct mlx5_accel_pol_xfrm_attrs {

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

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,11 @@ static void mlx5e_ipsec_aso_update(struct mlx5e_ipsec_sa_entry *sa_entry,
310310
mlx5e_ipsec_aso_query(sa_entry, data);
311311
}
312312

313-
static void mlx5e_ipsec_update_esn_state(struct mlx5e_ipsec_sa_entry *sa_entry,
314-
u32 mode_param)
313+
static void
314+
mlx5e_ipsec_update_esn_state(struct mlx5e_ipsec_sa_entry *sa_entry,
315+
u32 mode_param,
316+
struct mlx5_accel_esp_xfrm_attrs *attrs)
315317
{
316-
struct mlx5_accel_esp_xfrm_attrs attrs = {};
317318
struct mlx5_wqe_aso_ctrl_seg data = {};
318319

319320
if (mode_param < MLX5E_IPSEC_ESN_SCOPE_MID) {
@@ -323,18 +324,7 @@ static void mlx5e_ipsec_update_esn_state(struct mlx5e_ipsec_sa_entry *sa_entry,
323324
sa_entry->esn_state.overlap = 1;
324325
}
325326

326-
mlx5e_ipsec_build_accel_xfrm_attrs(sa_entry, &attrs);
327-
328-
/* It is safe to execute the modify below unlocked since the only flows
329-
* that could affect this HW object, are create, destroy and this work.
330-
*
331-
* Creation flow can't co-exist with this modify work, the destruction
332-
* flow would cancel this work, and this work is a single entity that
333-
* can't conflict with it self.
334-
*/
335-
spin_unlock_bh(&sa_entry->x->lock);
336-
mlx5_accel_esp_modify_xfrm(sa_entry, &attrs);
337-
spin_lock_bh(&sa_entry->x->lock);
327+
mlx5e_ipsec_build_accel_xfrm_attrs(sa_entry, attrs);
338328

339329
data.data_offset_condition_operand =
340330
MLX5_IPSEC_ASO_REMOVE_FLOW_PKT_CNT_OFFSET;
@@ -370,20 +360,18 @@ static void mlx5e_ipsec_aso_update_soft(struct mlx5e_ipsec_sa_entry *sa_entry,
370360
static void mlx5e_ipsec_handle_limits(struct mlx5e_ipsec_sa_entry *sa_entry)
371361
{
372362
struct mlx5_accel_esp_xfrm_attrs *attrs = &sa_entry->attrs;
373-
struct mlx5e_ipsec *ipsec = sa_entry->ipsec;
374-
struct mlx5e_ipsec_aso *aso = ipsec->aso;
375363
bool soft_arm, hard_arm;
376364
u64 hard_cnt;
377365

378366
lockdep_assert_held(&sa_entry->x->lock);
379367

380-
soft_arm = !MLX5_GET(ipsec_aso, aso->ctx, soft_lft_arm);
381-
hard_arm = !MLX5_GET(ipsec_aso, aso->ctx, hard_lft_arm);
368+
soft_arm = !MLX5_GET(ipsec_aso, sa_entry->ctx, soft_lft_arm);
369+
hard_arm = !MLX5_GET(ipsec_aso, sa_entry->ctx, hard_lft_arm);
382370
if (!soft_arm && !hard_arm)
383371
/* It is not lifetime event */
384372
return;
385373

386-
hard_cnt = MLX5_GET(ipsec_aso, aso->ctx, remove_flow_pkt_cnt);
374+
hard_cnt = MLX5_GET(ipsec_aso, sa_entry->ctx, remove_flow_pkt_cnt);
387375
if (!hard_cnt || hard_arm) {
388376
/* It is possible to see packet counter equal to zero without
389377
* hard limit event armed. Such situation can be if packet
@@ -453,30 +441,34 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work)
453441
struct mlx5e_ipsec_work *work =
454442
container_of(_work, struct mlx5e_ipsec_work, work);
455443
struct mlx5e_ipsec_sa_entry *sa_entry = work->data;
444+
struct mlx5_accel_esp_xfrm_attrs tmp = {};
456445
struct mlx5_accel_esp_xfrm_attrs *attrs;
457-
struct mlx5e_ipsec_aso *aso;
446+
bool need_modify = false;
458447
int ret;
459448

460-
aso = sa_entry->ipsec->aso;
461449
attrs = &sa_entry->attrs;
462450

463451
spin_lock_bh(&sa_entry->x->lock);
464452
ret = mlx5e_ipsec_aso_query(sa_entry, NULL);
465453
if (ret)
466454
goto unlock;
467455

456+
if (attrs->lft.soft_packet_limit != XFRM_INF)
457+
mlx5e_ipsec_handle_limits(sa_entry);
458+
468459
if (attrs->replay_esn.trigger &&
469-
!MLX5_GET(ipsec_aso, aso->ctx, esn_event_arm)) {
470-
u32 mode_param = MLX5_GET(ipsec_aso, aso->ctx, mode_parameter);
460+
!MLX5_GET(ipsec_aso, sa_entry->ctx, esn_event_arm)) {
461+
u32 mode_param = MLX5_GET(ipsec_aso, sa_entry->ctx,
462+
mode_parameter);
471463

472-
mlx5e_ipsec_update_esn_state(sa_entry, mode_param);
464+
mlx5e_ipsec_update_esn_state(sa_entry, mode_param, &tmp);
465+
need_modify = true;
473466
}
474467

475-
if (attrs->lft.soft_packet_limit != XFRM_INF)
476-
mlx5e_ipsec_handle_limits(sa_entry);
477-
478468
unlock:
479469
spin_unlock_bh(&sa_entry->x->lock);
470+
if (need_modify)
471+
mlx5_accel_esp_modify_xfrm(sa_entry, &tmp);
480472
kfree(work);
481473
}
482474

@@ -629,6 +621,8 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry,
629621
/* We are in atomic context */
630622
udelay(10);
631623
} while (ret && time_is_after_jiffies(expires));
624+
if (!ret)
625+
memcpy(sa_entry->ctx, aso->ctx, MLX5_ST_SZ_BYTES(ipsec_aso));
632626
spin_unlock_bh(&aso->lock);
633627
return ret;
634628
}

drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,45 +1489,40 @@ static int esw_qos_node_enable_tc_arbitration(struct mlx5_esw_sched_node *node,
14891489
return err;
14901490
}
14911491

1492-
static u32 mlx5_esw_qos_lag_link_speed_get_locked(struct mlx5_core_dev *mdev)
1492+
static u32 mlx5_esw_qos_lag_link_speed_get(struct mlx5_core_dev *mdev,
1493+
bool take_rtnl)
14931494
{
14941495
struct ethtool_link_ksettings lksettings;
14951496
struct net_device *slave, *master;
14961497
u32 speed = SPEED_UNKNOWN;
14971498

1498-
/* Lock ensures a stable reference to master and slave netdevice
1499-
* while port speed of master is queried.
1500-
*/
1501-
ASSERT_RTNL();
1502-
15031499
slave = mlx5_uplink_netdev_get(mdev);
15041500
if (!slave)
15051501
goto out;
15061502

1503+
if (take_rtnl)
1504+
rtnl_lock();
15071505
master = netdev_master_upper_dev_get(slave);
15081506
if (master && !__ethtool_get_link_ksettings(master, &lksettings))
15091507
speed = lksettings.base.speed;
1508+
if (take_rtnl)
1509+
rtnl_unlock();
15101510

15111511
out:
15121512
mlx5_uplink_netdev_put(mdev, slave);
15131513
return speed;
15141514
}
15151515

15161516
static int mlx5_esw_qos_max_link_speed_get(struct mlx5_core_dev *mdev, u32 *link_speed_max,
1517-
bool hold_rtnl_lock, struct netlink_ext_ack *extack)
1517+
bool take_rtnl,
1518+
struct netlink_ext_ack *extack)
15181519
{
15191520
int err;
15201521

15211522
if (!mlx5_lag_is_active(mdev))
15221523
goto skip_lag;
15231524

1524-
if (hold_rtnl_lock)
1525-
rtnl_lock();
1526-
1527-
*link_speed_max = mlx5_esw_qos_lag_link_speed_get_locked(mdev);
1528-
1529-
if (hold_rtnl_lock)
1530-
rtnl_unlock();
1525+
*link_speed_max = mlx5_esw_qos_lag_link_speed_get(mdev, take_rtnl);
15311526

15321527
if (*link_speed_max != (u32)SPEED_UNKNOWN)
15331528
return 0;

0 commit comments

Comments
 (0)