Skip to content

Commit ae13366

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "Fix a few more of the usual sorts of bugs: - Another regression with source route validation in CMA, introduced this merge window - Crash in hfi1 due to faulty list operations - PCI ID updates for EFA - Disable LOCAL_INV in hns because it causes a HW hang - Crash in hns due to missing initialization - Memory leak in rxe - Missing error unwind during ib_core module loading - Missing error handling in qedr around work queue creation during startup" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/qedr: clean up work queue on failure in qedr_alloc_resources() RDMA/core: Fix null-ptr-deref in ib_core_cleanup() RDMA/rxe: Fix mr leak in RESPST_ERR_RNR RDMA/hns: Fix NULL pointer problem in free_mr_init() RDMA/hns: Disable local invalidate operation RDMA/efa: Add EFA 0xefa2 PCI ID IB/hfi1: Correctly move list in sc_disable() RDMA/cma: Use output interface for net_dev check
2 parents 8f71a2b + 7a47e07 commit ae13366

File tree

9 files changed

+30
-21
lines changed

9 files changed

+30
-21
lines changed

drivers/infiniband/core/cma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ static bool validate_ipv4_net_dev(struct net_device *net_dev,
15561556
return false;
15571557

15581558
memset(&fl4, 0, sizeof(fl4));
1559-
fl4.flowi4_iif = net_dev->ifindex;
1559+
fl4.flowi4_oif = net_dev->ifindex;
15601560
fl4.daddr = daddr;
15611561
fl4.saddr = saddr;
15621562

drivers/infiniband/core/device.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2815,10 +2815,18 @@ static int __init ib_core_init(void)
28152815

28162816
nldev_init();
28172817
rdma_nl_register(RDMA_NL_LS, ibnl_ls_cb_table);
2818-
roce_gid_mgmt_init();
2818+
ret = roce_gid_mgmt_init();
2819+
if (ret) {
2820+
pr_warn("Couldn't init RoCE GID management\n");
2821+
goto err_parent;
2822+
}
28192823

28202824
return 0;
28212825

2826+
err_parent:
2827+
rdma_nl_unregister(RDMA_NL_LS);
2828+
nldev_exit();
2829+
unregister_pernet_device(&rdma_dev_net_ops);
28222830
err_compat:
28232831
unregister_blocking_lsm_notifier(&ibdev_lsm_nb);
28242832
err_sa:

drivers/infiniband/core/nldev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2537,7 +2537,7 @@ void __init nldev_init(void)
25372537
rdma_nl_register(RDMA_NL_NLDEV, nldev_cb_table);
25382538
}
25392539

2540-
void __exit nldev_exit(void)
2540+
void nldev_exit(void)
25412541
{
25422542
rdma_nl_unregister(RDMA_NL_NLDEV);
25432543
}

drivers/infiniband/hw/efa/efa_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
22
/*
3-
* Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
3+
* Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All rights reserved.
44
*/
55

66
#include <linux/module.h>
@@ -14,10 +14,12 @@
1414

1515
#define PCI_DEV_ID_EFA0_VF 0xefa0
1616
#define PCI_DEV_ID_EFA1_VF 0xefa1
17+
#define PCI_DEV_ID_EFA2_VF 0xefa2
1718

1819
static const struct pci_device_id efa_pci_tbl[] = {
1920
{ PCI_VDEVICE(AMAZON, PCI_DEV_ID_EFA0_VF) },
2021
{ PCI_VDEVICE(AMAZON, PCI_DEV_ID_EFA1_VF) },
22+
{ PCI_VDEVICE(AMAZON, PCI_DEV_ID_EFA2_VF) },
2123
{ }
2224
};
2325

drivers/infiniband/hw/hfi1/pio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,7 @@ void sc_disable(struct send_context *sc)
913913
spin_unlock(&sc->release_lock);
914914

915915
write_seqlock(&sc->waitlock);
916-
if (!list_empty(&sc->piowait))
917-
list_move(&sc->piowait, &wake_list);
916+
list_splice_init(&sc->piowait, &wake_list);
918917
write_sequnlock(&sc->waitlock);
919918
while (!list_empty(&wake_list)) {
920919
struct iowait *wait;

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ static const u32 hns_roce_op_code[] = {
118118
HR_OPC_MAP(ATOMIC_CMP_AND_SWP, ATOM_CMP_AND_SWAP),
119119
HR_OPC_MAP(ATOMIC_FETCH_AND_ADD, ATOM_FETCH_AND_ADD),
120120
HR_OPC_MAP(SEND_WITH_INV, SEND_WITH_INV),
121-
HR_OPC_MAP(LOCAL_INV, LOCAL_INV),
122121
HR_OPC_MAP(MASKED_ATOMIC_CMP_AND_SWP, ATOM_MSK_CMP_AND_SWAP),
123122
HR_OPC_MAP(MASKED_ATOMIC_FETCH_AND_ADD, ATOM_MSK_FETCH_AND_ADD),
124123
HR_OPC_MAP(REG_MR, FAST_REG_PMR),
@@ -559,9 +558,6 @@ static int set_rc_opcode(struct hns_roce_dev *hr_dev,
559558
else
560559
ret = -EOPNOTSUPP;
561560
break;
562-
case IB_WR_LOCAL_INV:
563-
hr_reg_enable(rc_sq_wqe, RC_SEND_WQE_SO);
564-
fallthrough;
565561
case IB_WR_SEND_WITH_INV:
566562
rc_sq_wqe->inv_key = cpu_to_le32(wr->ex.invalidate_rkey);
567563
break;
@@ -2805,8 +2801,12 @@ static int free_mr_modify_qp(struct hns_roce_dev *hr_dev)
28052801

28062802
static int free_mr_init(struct hns_roce_dev *hr_dev)
28072803
{
2804+
struct hns_roce_v2_priv *priv = hr_dev->priv;
2805+
struct hns_roce_v2_free_mr *free_mr = &priv->free_mr;
28082806
int ret;
28092807

2808+
mutex_init(&free_mr->mutex);
2809+
28102810
ret = free_mr_alloc_res(hr_dev);
28112811
if (ret)
28122812
return ret;
@@ -3222,7 +3222,6 @@ static int hns_roce_v2_write_mtpt(struct hns_roce_dev *hr_dev,
32223222

32233223
hr_reg_write(mpt_entry, MPT_ST, V2_MPT_ST_VALID);
32243224
hr_reg_write(mpt_entry, MPT_PD, mr->pd);
3225-
hr_reg_enable(mpt_entry, MPT_L_INV_EN);
32263225

32273226
hr_reg_write_bool(mpt_entry, MPT_BIND_EN,
32283227
mr->access & IB_ACCESS_MW_BIND);
@@ -3313,7 +3312,6 @@ static int hns_roce_v2_frmr_write_mtpt(struct hns_roce_dev *hr_dev,
33133312

33143313
hr_reg_enable(mpt_entry, MPT_RA_EN);
33153314
hr_reg_enable(mpt_entry, MPT_R_INV_EN);
3316-
hr_reg_enable(mpt_entry, MPT_L_INV_EN);
33173315

33183316
hr_reg_enable(mpt_entry, MPT_FRE);
33193317
hr_reg_clear(mpt_entry, MPT_MR_MW);
@@ -3345,7 +3343,6 @@ static int hns_roce_v2_mw_write_mtpt(void *mb_buf, struct hns_roce_mw *mw)
33453343
hr_reg_write(mpt_entry, MPT_PD, mw->pdn);
33463344

33473345
hr_reg_enable(mpt_entry, MPT_R_INV_EN);
3348-
hr_reg_enable(mpt_entry, MPT_L_INV_EN);
33493346
hr_reg_enable(mpt_entry, MPT_LW_EN);
33503347

33513348
hr_reg_enable(mpt_entry, MPT_MR_MW);
@@ -3794,7 +3791,6 @@ static const u32 wc_send_op_map[] = {
37943791
HR_WC_OP_MAP(RDMA_READ, RDMA_READ),
37953792
HR_WC_OP_MAP(RDMA_WRITE, RDMA_WRITE),
37963793
HR_WC_OP_MAP(RDMA_WRITE_WITH_IMM, RDMA_WRITE),
3797-
HR_WC_OP_MAP(LOCAL_INV, LOCAL_INV),
37983794
HR_WC_OP_MAP(ATOM_CMP_AND_SWAP, COMP_SWAP),
37993795
HR_WC_OP_MAP(ATOM_FETCH_AND_ADD, FETCH_ADD),
38003796
HR_WC_OP_MAP(ATOM_MSK_CMP_AND_SWAP, MASKED_COMP_SWAP),
@@ -3844,9 +3840,6 @@ static void fill_send_wc(struct ib_wc *wc, struct hns_roce_v2_cqe *cqe)
38443840
case HNS_ROCE_V2_WQE_OP_RDMA_WRITE_WITH_IMM:
38453841
wc->wc_flags |= IB_WC_WITH_IMM;
38463842
break;
3847-
case HNS_ROCE_V2_WQE_OP_LOCAL_INV:
3848-
wc->wc_flags |= IB_WC_WITH_INVALIDATE;
3849-
break;
38503843
case HNS_ROCE_V2_WQE_OP_ATOM_CMP_AND_SWAP:
38513844
case HNS_ROCE_V2_WQE_OP_ATOM_FETCH_AND_ADD:
38523845
case HNS_ROCE_V2_WQE_OP_ATOM_MSK_CMP_AND_SWAP:

drivers/infiniband/hw/hns/hns_roce_hw_v2.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ enum {
179179
HNS_ROCE_V2_WQE_OP_ATOM_MSK_CMP_AND_SWAP = 0x8,
180180
HNS_ROCE_V2_WQE_OP_ATOM_MSK_FETCH_AND_ADD = 0x9,
181181
HNS_ROCE_V2_WQE_OP_FAST_REG_PMR = 0xa,
182-
HNS_ROCE_V2_WQE_OP_LOCAL_INV = 0xb,
183182
HNS_ROCE_V2_WQE_OP_BIND_MW = 0xc,
184183
HNS_ROCE_V2_WQE_OP_MASK = 0x1f,
185184
};
@@ -915,7 +914,6 @@ struct hns_roce_v2_rc_send_wqe {
915914
#define RC_SEND_WQE_OWNER RC_SEND_WQE_FIELD_LOC(7, 7)
916915
#define RC_SEND_WQE_CQE RC_SEND_WQE_FIELD_LOC(8, 8)
917916
#define RC_SEND_WQE_FENCE RC_SEND_WQE_FIELD_LOC(9, 9)
918-
#define RC_SEND_WQE_SO RC_SEND_WQE_FIELD_LOC(10, 10)
919917
#define RC_SEND_WQE_SE RC_SEND_WQE_FIELD_LOC(11, 11)
920918
#define RC_SEND_WQE_INLINE RC_SEND_WQE_FIELD_LOC(12, 12)
921919
#define RC_SEND_WQE_WQE_INDEX RC_SEND_WQE_FIELD_LOC(30, 15)

drivers/infiniband/hw/qedr/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,18 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
344344
if (IS_IWARP(dev)) {
345345
xa_init(&dev->qps);
346346
dev->iwarp_wq = create_singlethread_workqueue("qedr_iwarpq");
347+
if (!dev->iwarp_wq) {
348+
rc = -ENOMEM;
349+
goto err1;
350+
}
347351
}
348352

349353
/* Allocate Status blocks for CNQ */
350354
dev->sb_array = kcalloc(dev->num_cnq, sizeof(*dev->sb_array),
351355
GFP_KERNEL);
352356
if (!dev->sb_array) {
353357
rc = -ENOMEM;
354-
goto err1;
358+
goto err_destroy_wq;
355359
}
356360

357361
dev->cnq_array = kcalloc(dev->num_cnq,
@@ -402,6 +406,9 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
402406
kfree(dev->cnq_array);
403407
err2:
404408
kfree(dev->sb_array);
409+
err_destroy_wq:
410+
if (IS_IWARP(dev))
411+
destroy_workqueue(dev->iwarp_wq);
405412
err1:
406413
kfree(dev->sgid_tbl);
407414
return rc;

drivers/infiniband/sw/rxe/rxe_resp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,10 @@ static enum resp_states read_reply(struct rxe_qp *qp,
806806

807807
skb = prepare_ack_packet(qp, &ack_pkt, opcode, payload,
808808
res->cur_psn, AETH_ACK_UNLIMITED);
809-
if (!skb)
809+
if (!skb) {
810+
rxe_put(mr);
810811
return RESPST_ERR_RNR;
812+
}
811813

812814
rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
813815
payload, RXE_FROM_MR_OBJ);

0 commit comments

Comments
 (0)