Skip to content

Commit 5c31257

Browse files
author
Paolo Abeni
committed
Merge tag 'mlx5-fixes-2023-01-18' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== This series provides bug fixes to mlx5 driver. * tag 'mlx5-fixes-2023-01-18' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net: mlx5: eliminate anonymous module_init & module_exit net/mlx5: E-switch, Fix switchdev mode after devlink reload net/mlx5e: Protect global IPsec ASO net/mlx5e: Remove optimization which prevented update of ESN state net/mlx5e: Set decap action based on attr for sample net/mlx5e: QoS, Fix wrongfully setting parent_element_id on MODIFY_SCHEDULING_ELEMENT net/mlx5: E-switch, Fix setting of reserved fields on MODIFY_SCHEDULING_ELEMENT net/mlx5e: Remove redundant xsk pointer check in mlx5e_mpwrq_validate_xsk net/mlx5e: Avoid false lock dependency warning on tc_ht even more net/mlx5: fix missing mutex_unlock in mlx5_fw_fatal_reporter_err_work() ==================== Link: https://lore.kernel.org/r/ Signed-off-by: Paolo Abeni <[email protected]>
2 parents 55ba18d + 2c1e1b9 commit 5c31257

File tree

12 files changed

+27
-40
lines changed

12 files changed

+27
-40
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ mlx5e_htb_update_children(struct mlx5e_htb *htb, struct mlx5e_qos_node *node,
637637
if (child->bw_share == old_bw_share)
638638
continue;
639639

640-
err_one = mlx5_qos_update_node(htb->mdev, child->hw_id, child->bw_share,
640+
err_one = mlx5_qos_update_node(htb->mdev, child->bw_share,
641641
child->max_average_bw, child->hw_id);
642642
if (!err && err_one) {
643643
err = err_one;
@@ -671,7 +671,7 @@ mlx5e_htb_node_modify(struct mlx5e_htb *htb, u16 classid, u64 rate, u64 ceil,
671671
mlx5e_htb_convert_rate(htb, rate, node->parent, &bw_share);
672672
mlx5e_htb_convert_ceil(htb, ceil, &max_average_bw);
673673

674-
err = mlx5_qos_update_node(htb->mdev, node->parent->hw_id, bw_share,
674+
err = mlx5_qos_update_node(htb->mdev, bw_share,
675675
max_average_bw, node->hw_id);
676676
if (err) {
677677
NL_SET_ERR_MSG_MOD(extack, "Firmware error when modifying a node.");

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa
578578
{
579579
enum mlx5e_mpwrq_umr_mode umr_mode = mlx5e_mpwrq_umr_mode(mdev, xsk);
580580
u8 page_shift = mlx5e_mpwrq_page_shift(mdev, xsk);
581-
bool unaligned = xsk ? xsk->unaligned : false;
582581
u16 max_mtu_pkts;
583582

584583
if (!mlx5e_check_fragmented_striding_rq_cap(mdev, page_shift, umr_mode))
@@ -591,7 +590,7 @@ int mlx5e_mpwrq_validate_xsk(struct mlx5_core_dev *mdev, struct mlx5e_params *pa
591590
* needed number of WQEs exceeds the maximum.
592591
*/
593592
max_mtu_pkts = min_t(u8, MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE,
594-
mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, unaligned));
593+
mlx5e_mpwrq_max_log_rq_pkts(mdev, page_shift, xsk->unaligned));
595594
if (params->log_rq_mtu_frames > max_mtu_pkts) {
596595
mlx5_core_err(mdev, "Current RQ length %d is too big for XSK with given frame size %u\n",
597596
1 << params->log_rq_mtu_frames, xsk->chunk_size);

drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample,
477477
struct mlx5e_sample_flow *sample_flow;
478478
struct mlx5e_sample_attr *sample_attr;
479479
struct mlx5_flow_attr *pre_attr;
480-
u32 tunnel_id = attr->tunnel_id;
481480
struct mlx5_eswitch *esw;
482481
u32 default_tbl_id;
483482
u32 obj_id;
@@ -522,7 +521,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample,
522521
restore_obj.sample.group_id = sample_attr->group_num;
523522
restore_obj.sample.rate = sample_attr->rate;
524523
restore_obj.sample.trunc_size = sample_attr->trunc_size;
525-
restore_obj.sample.tunnel_id = tunnel_id;
524+
restore_obj.sample.tunnel_id = attr->tunnel_id;
526525
err = mapping_add(esw->offloads.reg_c0_obj_pool, &restore_obj, &obj_id);
527526
if (err)
528527
goto err_obj_id;
@@ -548,7 +547,7 @@ mlx5e_tc_sample_offload(struct mlx5e_tc_psample *tc_psample,
548547
/* For decap action, do decap in the original flow table instead of the
549548
* default flow table.
550549
*/
551-
if (tunnel_id)
550+
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_DECAP)
552551
pre_attr->action |= MLX5_FLOW_CONTEXT_ACTION_DECAP;
553552
pre_attr->modify_hdr = sample_flow->restore->modify_hdr;
554553
pre_attr->flags = MLX5_ATTR_FLAG_SAMPLE;

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,8 @@ struct mlx5e_ipsec_aso {
122122
u8 ctx[MLX5_ST_SZ_BYTES(ipsec_aso)];
123123
dma_addr_t dma_addr;
124124
struct mlx5_aso *aso;
125-
/* IPsec ASO caches data on every query call,
126-
* so in nested calls, we can use this boolean to save
127-
* recursive calls to mlx5e_ipsec_aso_query()
128-
*/
129-
u8 use_cache : 1;
125+
/* Protect ASO WQ access, as it is global to whole IPsec */
126+
spinlock_t lock;
130127
};
131128

132129
struct mlx5e_ipsec {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work)
320320
if (ret)
321321
goto unlock;
322322

323-
aso->use_cache = true;
324323
if (attrs->esn_trigger &&
325324
!MLX5_GET(ipsec_aso, aso->ctx, esn_event_arm)) {
326325
u32 mode_param = MLX5_GET(ipsec_aso, aso->ctx, mode_parameter);
@@ -333,7 +332,6 @@ static void mlx5e_ipsec_handle_event(struct work_struct *_work)
333332
!MLX5_GET(ipsec_aso, aso->ctx, hard_lft_arm) ||
334333
!MLX5_GET(ipsec_aso, aso->ctx, remove_flow_enable))
335334
xfrm_state_check_expire(sa_entry->x);
336-
aso->use_cache = false;
337335

338336
unlock:
339337
spin_unlock(&sa_entry->x->lock);
@@ -398,6 +396,7 @@ int mlx5e_ipsec_aso_init(struct mlx5e_ipsec *ipsec)
398396
goto err_aso_create;
399397
}
400398

399+
spin_lock_init(&aso->lock);
401400
ipsec->nb.notifier_call = mlx5e_ipsec_event;
402401
mlx5_notifier_register(mdev, &ipsec->nb);
403402

@@ -456,13 +455,12 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry,
456455
struct mlx5e_hw_objs *res;
457456
struct mlx5_aso_wqe *wqe;
458457
u8 ds_cnt;
458+
int ret;
459459

460460
lockdep_assert_held(&sa_entry->x->lock);
461-
if (aso->use_cache)
462-
return 0;
463-
464461
res = &mdev->mlx5e_res.hw_objs;
465462

463+
spin_lock_bh(&aso->lock);
466464
memset(aso->ctx, 0, sizeof(aso->ctx));
467465
wqe = mlx5_aso_get_wqe(aso->aso);
468466
ds_cnt = DIV_ROUND_UP(sizeof(*wqe), MLX5_SEND_WQE_DS);
@@ -477,7 +475,9 @@ int mlx5e_ipsec_aso_query(struct mlx5e_ipsec_sa_entry *sa_entry,
477475
mlx5e_ipsec_aso_copy(ctrl, data);
478476

479477
mlx5_aso_post_wqe(aso->aso, false, &wqe->ctrl);
480-
return mlx5_aso_poll_cq(aso->aso, false);
478+
ret = mlx5_aso_poll_cq(aso->aso, false);
479+
spin_unlock_bh(&aso->lock);
480+
return ret;
481481
}
482482

483483
void mlx5e_ipsec_aso_update_curlft(struct mlx5e_ipsec_sa_entry *sa_entry,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ struct mlx5_fs_chains *mlx5e_nic_chains(struct mlx5e_tc_table *tc)
166166
* it's different than the ht->mutex here.
167167
*/
168168
static struct lock_class_key tc_ht_lock_key;
169+
static struct lock_class_key tc_ht_wq_key;
169170

170171
static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow);
171172
static void free_flow_post_acts(struct mlx5e_tc_flow *flow);
@@ -5182,6 +5183,7 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
51825183
return err;
51835184

51845185
lockdep_set_class(&tc->ht.mutex, &tc_ht_lock_key);
5186+
lockdep_init_map(&tc->ht.run_work.lockdep_map, "tc_ht_wq_key", &tc_ht_wq_key, 0);
51855187

51865188
mapping_id = mlx5_query_nic_system_image_guid(dev);
51875189

@@ -5288,6 +5290,7 @@ int mlx5e_tc_ht_init(struct rhashtable *tc_ht)
52885290
return err;
52895291

52905292
lockdep_set_class(&tc_ht->mutex, &tc_ht_lock_key);
5293+
lockdep_init_map(&tc_ht->run_work.lockdep_map, "tc_ht_wq_key", &tc_ht_wq_key, 0);
52915294

52925295
return 0;
52935296
}

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ struct mlx5_esw_rate_group {
2222
};
2323

2424
static int esw_qos_tsar_config(struct mlx5_core_dev *dev, u32 *sched_ctx,
25-
u32 parent_ix, u32 tsar_ix,
26-
u32 max_rate, u32 bw_share)
25+
u32 tsar_ix, u32 max_rate, u32 bw_share)
2726
{
2827
u32 bitmask = 0;
2928

3029
if (!MLX5_CAP_GEN(dev, qos) || !MLX5_CAP_QOS(dev, esw_scheduling))
3130
return -EOPNOTSUPP;
3231

33-
MLX5_SET(scheduling_context, sched_ctx, parent_element_id, parent_ix);
3432
MLX5_SET(scheduling_context, sched_ctx, max_average_bw, max_rate);
3533
MLX5_SET(scheduling_context, sched_ctx, bw_share, bw_share);
3634
bitmask |= MODIFY_SCHEDULING_ELEMENT_IN_MODIFY_BITMASK_MAX_AVERAGE_BW;
@@ -51,7 +49,7 @@ static int esw_qos_group_config(struct mlx5_eswitch *esw, struct mlx5_esw_rate_g
5149
int err;
5250

5351
err = esw_qos_tsar_config(dev, sched_ctx,
54-
esw->qos.root_tsar_ix, group->tsar_ix,
52+
group->tsar_ix,
5553
max_rate, bw_share);
5654
if (err)
5755
NL_SET_ERR_MSG_MOD(extack, "E-Switch modify group TSAR element failed");
@@ -67,23 +65,13 @@ static int esw_qos_vport_config(struct mlx5_eswitch *esw,
6765
struct netlink_ext_ack *extack)
6866
{
6967
u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
70-
struct mlx5_esw_rate_group *group = vport->qos.group;
7168
struct mlx5_core_dev *dev = esw->dev;
72-
u32 parent_tsar_ix;
73-
void *vport_elem;
7469
int err;
7570

7671
if (!vport->qos.enabled)
7772
return -EIO;
7873

79-
parent_tsar_ix = group ? group->tsar_ix : esw->qos.root_tsar_ix;
80-
MLX5_SET(scheduling_context, sched_ctx, element_type,
81-
SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT);
82-
vport_elem = MLX5_ADDR_OF(scheduling_context, sched_ctx,
83-
element_attributes);
84-
MLX5_SET(vport_element, vport_elem, vport_number, vport->vport);
85-
86-
err = esw_qos_tsar_config(dev, sched_ctx, parent_tsar_ix, vport->qos.esw_tsar_ix,
74+
err = esw_qos_tsar_config(dev, sched_ctx, vport->qos.esw_tsar_ix,
8775
max_rate, bw_share);
8876
if (err) {
8977
esw_warn(esw->dev,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,7 @@ void mlx5_eswitch_disable(struct mlx5_eswitch *esw)
14641464
mlx5_lag_disable_change(esw->dev);
14651465
down_write(&esw->mode_lock);
14661466
mlx5_eswitch_disable_locked(esw);
1467+
esw->mode = MLX5_ESWITCH_LEGACY;
14671468
up_write(&esw->mode_lock);
14681469
mlx5_lag_enable_change(esw->dev);
14691470
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work)
677677
mutex_lock(&dev->intf_state_mutex);
678678
if (test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) {
679679
mlx5_core_err(dev, "health works are not permitted at this stage\n");
680+
mutex_unlock(&dev->intf_state_mutex);
680681
return;
681682
}
682683
mutex_unlock(&dev->intf_state_mutex);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,7 @@ static void mlx5_core_verify_params(void)
20982098
}
20992099
}
21002100

2101-
static int __init init(void)
2101+
static int __init mlx5_init(void)
21022102
{
21032103
int err;
21042104

@@ -2133,13 +2133,13 @@ static int __init init(void)
21332133
return err;
21342134
}
21352135

2136-
static void __exit cleanup(void)
2136+
static void __exit mlx5_cleanup(void)
21372137
{
21382138
mlx5e_cleanup();
21392139
mlx5_sf_driver_unregister();
21402140
pci_unregister_driver(&mlx5_core_driver);
21412141
mlx5_unregister_debugfs();
21422142
}
21432143

2144-
module_init(init);
2145-
module_exit(cleanup);
2144+
module_init(mlx5_init);
2145+
module_exit(mlx5_cleanup);

0 commit comments

Comments
 (0)