Skip to content

Commit 854e9bf

Browse files
committed
Merge tag 'mlx5-fixes-2024-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5 fixes 2024-09-25 * tag 'mlx5-fixes-2024-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net/mlx5e: Fix crash caused by calling __xfrm_state_delete() twice net/mlx5e: SHAMPO, Fix overflow of hd_per_wq net/mlx5: HWS, changed E2BIG error to a negative return code net/mlx5: HWS, fixed double-free in error flow of creating SQ net/mlx5: Fix wrong reserved field in hca_cap_2 in mlx5_ifc net/mlx5e: Fix NULL deref in mlx5e_tir_builder_alloc() net/mlx5: Added cond_resched() to crdump collection net/mlx5: Fix error path in multi-packet WQE transmit ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents e5e3f36 + 7b12469 commit 854e9bf

File tree

10 files changed

+33
-9
lines changed

10 files changed

+33
-9
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ struct mlx5e_shampo_hd {
627627
struct mlx5e_dma_info *info;
628628
struct mlx5e_frag_page *pages;
629629
u16 curr_page_index;
630-
u16 hd_per_wq;
630+
u32 hd_per_wq;
631631
u16 hd_per_wqe;
632632
unsigned long *bitmap;
633633
u16 pi;

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

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ struct mlx5e_tir_builder *mlx5e_tir_builder_alloc(bool modify)
2323
struct mlx5e_tir_builder *builder;
2424

2525
builder = kvzalloc(sizeof(*builder), GFP_KERNEL);
26+
if (!builder)
27+
return NULL;
28+
2629
builder->modify = modify;
2730

2831
return builder;

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,20 @@ static void mlx5e_ipsec_handle_sw_limits(struct work_struct *_work)
6767
return;
6868

6969
spin_lock_bh(&x->lock);
70-
xfrm_state_check_expire(x);
7170
if (x->km.state == XFRM_STATE_EXPIRED) {
7271
sa_entry->attrs.drop = true;
7372
spin_unlock_bh(&x->lock);
7473

7574
mlx5e_accel_ipsec_fs_modify(sa_entry);
7675
return;
7776
}
77+
78+
if (x->km.state != XFRM_STATE_VALID) {
79+
spin_unlock_bh(&x->lock);
80+
return;
81+
}
82+
83+
xfrm_state_check_expire(x);
7884
spin_unlock_bh(&x->lock);
7985

8086
queue_delayed_work(sa_entry->ipsec->wq, &dwork->dwork,

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

-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,6 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
642642
return;
643643

644644
err_unmap:
645-
mlx5e_dma_unmap_wqe_err(sq, 1);
646645
sq->stats->dropped++;
647646
dev_kfree_skb_any(skb);
648647
mlx5e_tx_flush(sq);

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

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
pci_write_config_dword((dev)->pdev, (dev)->vsc_addr + (offset), (val))
2525
#define VSC_MAX_RETRIES 2048
2626

27+
/* Reading VSC registers can take relatively long time.
28+
* Yield the cpu every 128 registers read.
29+
*/
30+
#define VSC_GW_READ_BLOCK_COUNT 128
31+
2732
enum {
2833
VSC_CTRL_OFFSET = 0x4,
2934
VSC_COUNTER_OFFSET = 0x8,
@@ -273,13 +278,18 @@ int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data,
273278
{
274279
unsigned int next_read_addr = 0;
275280
unsigned int read_addr = 0;
281+
unsigned int count = 0;
276282

277283
while (read_addr < length) {
278284
if (mlx5_vsc_gw_read_fast(dev, read_addr, &next_read_addr,
279285
&data[(read_addr >> 2)]))
280286
return read_addr;
281287

282288
read_addr = next_read_addr;
289+
if (++count == VSC_GW_READ_BLOCK_COUNT) {
290+
cond_resched();
291+
count = 0;
292+
}
283293
}
284294
return length;
285295
}

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_bwc_complex.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ bool mlx5hws_bwc_match_params_is_complex(struct mlx5hws_context *ctx,
3333
* and let the usual match creation path handle it,
3434
* both for good and bad flows.
3535
*/
36-
if (ret == E2BIG) {
36+
if (ret == -E2BIG) {
3737
is_complex = true;
3838
mlx5hws_dbg(ctx, "Matcher definer layout: need complex matcher\n");
3939
} else {

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_definer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ hws_definer_find_best_match_fit(struct mlx5hws_context *ctx,
18451845
return 0;
18461846
}
18471847

1848-
return E2BIG;
1848+
return -E2BIG;
18491849
}
18501850

18511851
static void
@@ -1931,7 +1931,7 @@ mlx5hws_definer_calc_layout(struct mlx5hws_context *ctx,
19311931
/* Find the match definer layout for header layout match union */
19321932
ret = hws_definer_find_best_match_fit(ctx, match_definer, match_hl);
19331933
if (ret) {
1934-
if (ret == E2BIG)
1934+
if (ret == -E2BIG)
19351935
mlx5hws_dbg(ctx,
19361936
"Failed to create match definer from header layout - E2BIG\n");
19371937
else

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_matcher.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher *matcher)
675675
if (!(matcher->flags & MLX5HWS_MATCHER_FLAGS_COLLISION)) {
676676
ret = mlx5hws_definer_mt_init(ctx, matcher->mt);
677677
if (ret) {
678-
if (ret == E2BIG)
678+
if (ret == -E2BIG)
679679
mlx5hws_err(ctx, "Failed to set matcher templates with match definers\n");
680680
return ret;
681681
}

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,12 @@ static int hws_send_ring_create_sq(struct mlx5_core_dev *mdev, u32 pdn,
653653
return err;
654654
}
655655

656+
static void hws_send_ring_destroy_sq(struct mlx5_core_dev *mdev,
657+
struct mlx5hws_send_ring_sq *sq)
658+
{
659+
mlx5_core_destroy_sq(mdev, sq->sqn);
660+
}
661+
656662
static int hws_send_ring_set_sq_rdy(struct mlx5_core_dev *mdev, u32 sqn)
657663
{
658664
void *in, *sqc;
@@ -696,7 +702,7 @@ static int hws_send_ring_create_sq_rdy(struct mlx5_core_dev *mdev, u32 pdn,
696702

697703
err = hws_send_ring_set_sq_rdy(mdev, sq->sqn);
698704
if (err)
699-
hws_send_ring_close_sq(sq);
705+
hws_send_ring_destroy_sq(mdev, sq);
700706

701707
return err;
702708
}

include/linux/mlx5/mlx5_ifc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ struct mlx5_ifc_cmd_hca_cap_2_bits {
21382138
u8 ts_cqe_metadata_size2wqe_counter[0x5];
21392139
u8 reserved_at_250[0x10];
21402140

2141-
u8 reserved_at_260[0x120];
2141+
u8 reserved_at_260[0x20];
21422142

21432143
u8 format_select_dw_gtpu_dw_0[0x8];
21442144
u8 format_select_dw_gtpu_dw_1[0x8];

0 commit comments

Comments
 (0)