Skip to content

Commit f798a5a

Browse files
committed
Merge tag 'mlx5-fixes-2020-02-06' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== Mellanox, mlx5 fixes 2020-02-06 This series introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem. For -stable v4.19: ('net/mlx5: IPsec, Fix esp modify function attribute') ('net/mlx5: IPsec, fix memory leak at mlx5_fpga_ipsec_delete_sa_ctx') For -stable v5.4: ('net/mlx5: Deprecate usage of generic TLS HW capability bit') ('net/mlx5: Fix deadlock in fs_core') For -stable v5.5: ('net/mlx5e: TX, Error completion is for last WQE in batch') ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 263a425 + 61c00cc commit f798a5a

File tree

8 files changed

+40
-40
lines changed

8 files changed

+40
-40
lines changed

drivers/net/ethernet/mellanox/mlx5/core/accel/tls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void mlx5_ktls_destroy_key(struct mlx5_core_dev *mdev, u32 key_id);
4545

4646
static inline bool mlx5_accel_is_ktls_device(struct mlx5_core_dev *mdev)
4747
{
48-
if (!MLX5_CAP_GEN(mdev, tls))
48+
if (!MLX5_CAP_GEN(mdev, tls_tx))
4949
return false;
5050

5151
if (!MLX5_CAP_GEN(mdev, log_max_dek))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ struct sk_buff *mlx5e_tls_handle_tx_skb(struct net_device *netdev,
269269
int datalen;
270270
u32 skb_seq;
271271

272-
if (MLX5_CAP_GEN(sq->channel->mdev, tls)) {
272+
if (MLX5_CAP_GEN(sq->channel->mdev, tls_tx)) {
273273
skb = mlx5e_ktls_handle_tx_skb(netdev, sq, skb, wqe, pi);
274274
goto out;
275275
}

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,13 +613,6 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
613613

614614
wqe_counter = be16_to_cpu(cqe->wqe_counter);
615615

616-
if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_REQ)) {
617-
netdev_WARN_ONCE(cq->channel->netdev,
618-
"Bad OP in ICOSQ CQE: 0x%x\n", get_cqe_opcode(cqe));
619-
if (!test_and_set_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state))
620-
queue_work(cq->channel->priv->wq, &sq->recover_work);
621-
break;
622-
}
623616
do {
624617
struct mlx5e_sq_wqe_info *wi;
625618
u16 ci;
@@ -629,6 +622,15 @@ void mlx5e_poll_ico_cq(struct mlx5e_cq *cq)
629622
ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sqcc);
630623
wi = &sq->db.ico_wqe[ci];
631624

625+
if (last_wqe && unlikely(get_cqe_opcode(cqe) != MLX5_CQE_REQ)) {
626+
netdev_WARN_ONCE(cq->channel->netdev,
627+
"Bad OP in ICOSQ CQE: 0x%x\n",
628+
get_cqe_opcode(cqe));
629+
if (!test_and_set_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state))
630+
queue_work(cq->channel->priv->wq, &sq->recover_work);
631+
break;
632+
}
633+
632634
if (likely(wi->opcode == MLX5_OPCODE_UMR)) {
633635
sqcc += MLX5E_UMR_WQEBBS;
634636
wi->umr.rq->mpwqe.umr_completed++;

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

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -451,34 +451,17 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
451451

452452
i = 0;
453453
do {
454+
struct mlx5e_tx_wqe_info *wi;
454455
u16 wqe_counter;
455456
bool last_wqe;
457+
u16 ci;
456458

457459
mlx5_cqwq_pop(&cq->wq);
458460

459461
wqe_counter = be16_to_cpu(cqe->wqe_counter);
460462

461-
if (unlikely(get_cqe_opcode(cqe) == MLX5_CQE_REQ_ERR)) {
462-
if (!test_and_set_bit(MLX5E_SQ_STATE_RECOVERING,
463-
&sq->state)) {
464-
struct mlx5e_tx_wqe_info *wi;
465-
u16 ci;
466-
467-
ci = mlx5_wq_cyc_ctr2ix(&sq->wq, sqcc);
468-
wi = &sq->db.wqe_info[ci];
469-
mlx5e_dump_error_cqe(sq,
470-
(struct mlx5_err_cqe *)cqe);
471-
mlx5_wq_cyc_wqe_dump(&sq->wq, ci, wi->num_wqebbs);
472-
queue_work(cq->channel->priv->wq,
473-
&sq->recover_work);
474-
}
475-
stats->cqe_err++;
476-
}
477-
478463
do {
479-
struct mlx5e_tx_wqe_info *wi;
480464
struct sk_buff *skb;
481-
u16 ci;
482465
int j;
483466

484467
last_wqe = (sqcc == wqe_counter);
@@ -516,6 +499,18 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
516499
napi_consume_skb(skb, napi_budget);
517500
} while (!last_wqe);
518501

502+
if (unlikely(get_cqe_opcode(cqe) == MLX5_CQE_REQ_ERR)) {
503+
if (!test_and_set_bit(MLX5E_SQ_STATE_RECOVERING,
504+
&sq->state)) {
505+
mlx5e_dump_error_cqe(sq,
506+
(struct mlx5_err_cqe *)cqe);
507+
mlx5_wq_cyc_wqe_dump(&sq->wq, ci, wi->num_wqebbs);
508+
queue_work(cq->channel->priv->wq,
509+
&sq->recover_work);
510+
}
511+
stats->cqe_err++;
512+
}
513+
519514
} while ((++i < MLX5E_TX_CQ_POLL_BUDGET) && (cqe = mlx5_cqwq_get_cqe(&cq->wq)));
520515

521516
stats->cqes += i;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ void mlx5_fpga_ipsec_delete_sa_ctx(void *context)
850850
mutex_lock(&fpga_xfrm->lock);
851851
if (!--fpga_xfrm->num_rules) {
852852
mlx5_fpga_ipsec_release_sa_ctx(fpga_xfrm->sa_ctx);
853+
kfree(fpga_xfrm->sa_ctx);
853854
fpga_xfrm->sa_ctx = NULL;
854855
}
855856
mutex_unlock(&fpga_xfrm->lock);
@@ -1478,7 +1479,7 @@ int mlx5_fpga_esp_modify_xfrm(struct mlx5_accel_esp_xfrm *xfrm,
14781479
if (!memcmp(&xfrm->attrs, attrs, sizeof(xfrm->attrs)))
14791480
return 0;
14801481

1481-
if (!mlx5_fpga_esp_validate_xfrm_attrs(mdev, attrs)) {
1482+
if (mlx5_fpga_esp_validate_xfrm_attrs(mdev, attrs)) {
14821483
mlx5_core_warn(mdev, "Tried to create an esp with unsupported attrs\n");
14831484
return -EOPNOTSUPP;
14841485
}

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,16 +1582,16 @@ struct match_list_head {
15821582
struct match_list first;
15831583
};
15841584

1585-
static void free_match_list(struct match_list_head *head)
1585+
static void free_match_list(struct match_list_head *head, bool ft_locked)
15861586
{
15871587
if (!list_empty(&head->list)) {
15881588
struct match_list *iter, *match_tmp;
15891589

15901590
list_del(&head->first.list);
1591-
tree_put_node(&head->first.g->node, false);
1591+
tree_put_node(&head->first.g->node, ft_locked);
15921592
list_for_each_entry_safe(iter, match_tmp, &head->list,
15931593
list) {
1594-
tree_put_node(&iter->g->node, false);
1594+
tree_put_node(&iter->g->node, ft_locked);
15951595
list_del(&iter->list);
15961596
kfree(iter);
15971597
}
@@ -1600,7 +1600,8 @@ static void free_match_list(struct match_list_head *head)
16001600

16011601
static int build_match_list(struct match_list_head *match_head,
16021602
struct mlx5_flow_table *ft,
1603-
const struct mlx5_flow_spec *spec)
1603+
const struct mlx5_flow_spec *spec,
1604+
bool ft_locked)
16041605
{
16051606
struct rhlist_head *tmp, *list;
16061607
struct mlx5_flow_group *g;
@@ -1625,7 +1626,7 @@ static int build_match_list(struct match_list_head *match_head,
16251626

16261627
curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC);
16271628
if (!curr_match) {
1628-
free_match_list(match_head);
1629+
free_match_list(match_head, ft_locked);
16291630
err = -ENOMEM;
16301631
goto out;
16311632
}
@@ -1805,7 +1806,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
18051806
version = atomic_read(&ft->node.version);
18061807

18071808
/* Collect all fgs which has a matching match_criteria */
1808-
err = build_match_list(&match_head, ft, spec);
1809+
err = build_match_list(&match_head, ft, spec, take_write);
18091810
if (err) {
18101811
if (take_write)
18111812
up_write_ref_node(&ft->node, false);
@@ -1819,7 +1820,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
18191820

18201821
rule = try_add_to_existing_fg(ft, &match_head.list, spec, flow_act, dest,
18211822
dest_num, version);
1822-
free_match_list(&match_head);
1823+
free_match_list(&match_head, take_write);
18231824
if (!IS_ERR(rule) ||
18241825
(PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN)) {
18251826
if (take_write)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)
242242
return err;
243243
}
244244

245-
if (MLX5_CAP_GEN(dev, tls)) {
245+
if (MLX5_CAP_GEN(dev, tls_tx)) {
246246
err = mlx5_core_get_caps(dev, MLX5_CAP_TLS);
247247
if (err)
248248
return err;

include/linux/mlx5/mlx5_ifc.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,14 +1448,15 @@ struct mlx5_ifc_cmd_hca_cap_bits {
14481448

14491449
u8 reserved_at_440[0x20];
14501450

1451-
u8 tls[0x1];
1452-
u8 reserved_at_461[0x2];
1451+
u8 reserved_at_460[0x3];
14531452
u8 log_max_uctx[0x5];
14541453
u8 reserved_at_468[0x3];
14551454
u8 log_max_umem[0x5];
14561455
u8 max_num_eqs[0x10];
14571456

1458-
u8 reserved_at_480[0x3];
1457+
u8 reserved_at_480[0x1];
1458+
u8 tls_tx[0x1];
1459+
u8 reserved_at_482[0x1];
14591460
u8 log_max_l2_table[0x5];
14601461
u8 reserved_at_488[0x8];
14611462
u8 log_uar_page_sz[0x10];

0 commit comments

Comments
 (0)