Skip to content

Commit 8aa7486

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: "Primarily rtrs and irdma fixes: - Fix uninitialized value in ib_get_eth_speed() - Fix hns refusing to work if userspace doesn't select the correct congestion control algorithm - Several irdma fixes - unreliable Send Queue Drain, use after free, 64k page size bugs, device removal races - Several rtrs bug fixes - crashes, memory leaks, use after free, bad credit accounting, bogus WARN_ON - Typos and a MAINTAINER update" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/irdma: Avoid free the non-cqp_request scratch RDMA/irdma: Fix support for 64k pages RDMA/irdma: Ensure iWarp QP queue memory is OS paged aligned RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz RDMA/irdma: Fix UAF in irdma_sc_ccq_get_cqe_info() RDMA/bnxt_re: Correct module description string RDMA/rtrs-clt: Remove the warnings for req in_use check RDMA/rtrs-clt: Fix the max_send_wr setting RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight RDMA/rtrs-srv: Free srv_mr iu only when always_invalidate is true RDMA/rtrs-srv: Check return values while processing info request RDMA/rtrs-clt: Start hb after path_up RDMA/rtrs-srv: Do not unconditionally enable irq MAINTAINERS: Add Chengchang Tang as Hisilicon RoCE maintainer RDMA/irdma: Add wait for suspend on SQD RDMA/irdma: Do not modify to SQD on error RDMA/hns: Fix unnecessary err return when using invalid congest control algorithm RDMA/core: Fix uninit-value access in ib_get_eth_speed()
2 parents 081ed90 + e3e82fc commit 8aa7486

File tree

14 files changed

+90
-44
lines changed

14 files changed

+90
-44
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9573,6 +9573,7 @@ F: drivers/crypto/hisilicon/sgl.c
95739573
F: include/linux/hisi_acc_qm.h
95749574

95759575
HISILICON ROCE DRIVER
9576+
M: Chengchang Tang <[email protected]>
95769577
M: Junxian Huang <[email protected]>
95779578
95789579
S: Maintained

drivers/infiniband/core/umem.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,
9696
return page_size;
9797
}
9898

99-
/* rdma_for_each_block() has a bug if the page size is smaller than the
100-
* page size used to build the umem. For now prevent smaller page sizes
101-
* from being returned.
102-
*/
103-
pgsz_bitmap &= GENMASK(BITS_PER_LONG - 1, PAGE_SHIFT);
104-
10599
/* The best result is the smallest page size that results in the minimum
106100
* number of required pages. Compute the largest page size that could
107101
* work based on VA address bits that don't change.

drivers/infiniband/core/verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,7 @@ int ib_get_eth_speed(struct ib_device *dev, u32 port_num, u16 *speed, u8 *width)
19711971
int rc;
19721972
u32 netdev_speed;
19731973
struct net_device *netdev;
1974-
struct ethtool_link_ksettings lksettings;
1974+
struct ethtool_link_ksettings lksettings = {};
19751975

19761976
if (rdma_port_get_link_layer(dev, port_num) != IB_LINK_LAYER_ETHERNET)
19771977
return -EINVAL;

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static char version[] =
7171
BNXT_RE_DESC "\n";
7272

7373
MODULE_AUTHOR("Eddie Wai <[email protected]>");
74-
MODULE_DESCRIPTION(BNXT_RE_DESC " Driver");
74+
MODULE_DESCRIPTION(BNXT_RE_DESC);
7575
MODULE_LICENSE("Dual BSD/GPL");
7676

7777
/* globals */

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4760,10 +4760,15 @@ static int check_cong_type(struct ib_qp *ibqp,
47604760
cong_alg->wnd_mode_sel = WND_LIMIT;
47614761
break;
47624762
default:
4763-
ibdev_err(&hr_dev->ib_dev,
4764-
"error type(%u) for congestion selection.\n",
4765-
hr_dev->caps.cong_type);
4766-
return -EINVAL;
4763+
ibdev_warn(&hr_dev->ib_dev,
4764+
"invalid type(%u) for congestion selection.\n",
4765+
hr_dev->caps.cong_type);
4766+
hr_dev->caps.cong_type = CONG_TYPE_DCQCN;
4767+
cong_alg->alg_sel = CONG_DCQCN;
4768+
cong_alg->alg_sub_sel = UNSUPPORT_CONG_LEVEL;
4769+
cong_alg->dip_vld = DIP_INVALID;
4770+
cong_alg->wnd_mode_sel = WND_LIMIT;
4771+
break;
47674772
}
47684773

47694774
return 0;

drivers/infiniband/hw/irdma/hw.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,11 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
321321
break;
322322
case IRDMA_AE_QP_SUSPEND_COMPLETE:
323323
if (iwqp->iwdev->vsi.tc_change_pending) {
324-
atomic_dec(&iwqp->sc_qp.vsi->qp_suspend_reqs);
324+
if (!atomic_dec_return(&qp->vsi->qp_suspend_reqs))
325+
wake_up(&iwqp->iwdev->suspend_wq);
326+
}
327+
if (iwqp->suspend_pending) {
328+
iwqp->suspend_pending = false;
325329
wake_up(&iwqp->iwdev->suspend_wq);
326330
}
327331
break;
@@ -581,9 +585,6 @@ static void irdma_destroy_cqp(struct irdma_pci_f *rf)
581585
struct irdma_cqp *cqp = &rf->cqp;
582586
int status = 0;
583587

584-
if (rf->cqp_cmpl_wq)
585-
destroy_workqueue(rf->cqp_cmpl_wq);
586-
587588
status = irdma_sc_cqp_destroy(dev->cqp);
588589
if (status)
589590
ibdev_dbg(to_ibdev(dev), "ERR: Destroy CQP failed %d\n", status);
@@ -748,6 +749,9 @@ static void irdma_destroy_ccq(struct irdma_pci_f *rf)
748749
struct irdma_ccq *ccq = &rf->ccq;
749750
int status = 0;
750751

752+
if (rf->cqp_cmpl_wq)
753+
destroy_workqueue(rf->cqp_cmpl_wq);
754+
751755
if (!rf->reset)
752756
status = irdma_sc_ccq_destroy(dev->ccq, 0, true);
753757
if (status)
@@ -1180,7 +1184,6 @@ static int irdma_create_ceq(struct irdma_pci_f *rf, struct irdma_ceq *iwceq,
11801184
int status;
11811185
struct irdma_ceq_init_info info = {};
11821186
struct irdma_sc_dev *dev = &rf->sc_dev;
1183-
u64 scratch;
11841187
u32 ceq_size;
11851188

11861189
info.ceq_id = ceq_id;
@@ -1201,14 +1204,13 @@ static int irdma_create_ceq(struct irdma_pci_f *rf, struct irdma_ceq *iwceq,
12011204
iwceq->sc_ceq.ceq_id = ceq_id;
12021205
info.dev = dev;
12031206
info.vsi = vsi;
1204-
scratch = (uintptr_t)&rf->cqp.sc_cqp;
12051207
status = irdma_sc_ceq_init(&iwceq->sc_ceq, &info);
12061208
if (!status) {
12071209
if (dev->ceq_valid)
12081210
status = irdma_cqp_ceq_cmd(&rf->sc_dev, &iwceq->sc_ceq,
12091211
IRDMA_OP_CEQ_CREATE);
12101212
else
1211-
status = irdma_sc_cceq_create(&iwceq->sc_ceq, scratch);
1213+
status = irdma_sc_cceq_create(&iwceq->sc_ceq, 0);
12121214
}
12131215

12141216
if (status) {

drivers/infiniband/hw/irdma/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void irdma_prep_tc_change(struct irdma_device *iwdev)
4848
/* Wait for all qp's to suspend */
4949
wait_event_timeout(iwdev->suspend_wq,
5050
!atomic_read(&iwdev->vsi.qp_suspend_reqs),
51-
IRDMA_EVENT_TIMEOUT);
51+
msecs_to_jiffies(IRDMA_EVENT_TIMEOUT_MS));
5252
irdma_ws_reset(&iwdev->vsi);
5353
}
5454

drivers/infiniband/hw/irdma/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extern struct auxiliary_driver i40iw_auxiliary_drv;
7878

7979
#define MAX_DPC_ITERATIONS 128
8080

81-
#define IRDMA_EVENT_TIMEOUT 50000
81+
#define IRDMA_EVENT_TIMEOUT_MS 5000
8282
#define IRDMA_VCHNL_EVENT_TIMEOUT 100000
8383
#define IRDMA_RST_TIMEOUT_HZ 4
8484

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,21 @@ static u8 irdma_roce_get_vlan_prio(const struct ib_gid_attr *attr, u8 prio)
11571157
return prio;
11581158
}
11591159

1160+
static int irdma_wait_for_suspend(struct irdma_qp *iwqp)
1161+
{
1162+
if (!wait_event_timeout(iwqp->iwdev->suspend_wq,
1163+
!iwqp->suspend_pending,
1164+
msecs_to_jiffies(IRDMA_EVENT_TIMEOUT_MS))) {
1165+
iwqp->suspend_pending = false;
1166+
ibdev_warn(&iwqp->iwdev->ibdev,
1167+
"modify_qp timed out waiting for suspend. qp_id = %d, last_ae = 0x%x\n",
1168+
iwqp->ibqp.qp_num, iwqp->last_aeq);
1169+
return -EBUSY;
1170+
}
1171+
1172+
return 0;
1173+
}
1174+
11601175
/**
11611176
* irdma_modify_qp_roce - modify qp request
11621177
* @ibqp: qp's pointer for modify
@@ -1420,17 +1435,11 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
14201435

14211436
info.next_iwarp_state = IRDMA_QP_STATE_SQD;
14221437
issue_modify_qp = 1;
1438+
iwqp->suspend_pending = true;
14231439
break;
14241440
case IB_QPS_SQE:
14251441
case IB_QPS_ERR:
14261442
case IB_QPS_RESET:
1427-
if (iwqp->iwarp_state == IRDMA_QP_STATE_RTS) {
1428-
spin_unlock_irqrestore(&iwqp->lock, flags);
1429-
info.next_iwarp_state = IRDMA_QP_STATE_SQD;
1430-
irdma_hw_modify_qp(iwdev, iwqp, &info, true);
1431-
spin_lock_irqsave(&iwqp->lock, flags);
1432-
}
1433-
14341443
if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) {
14351444
spin_unlock_irqrestore(&iwqp->lock, flags);
14361445
if (udata && udata->inlen) {
@@ -1467,6 +1476,11 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
14671476
ctx_info->rem_endpoint_idx = udp_info->arp_idx;
14681477
if (irdma_hw_modify_qp(iwdev, iwqp, &info, true))
14691478
return -EINVAL;
1479+
if (info.next_iwarp_state == IRDMA_QP_STATE_SQD) {
1480+
ret = irdma_wait_for_suspend(iwqp);
1481+
if (ret)
1482+
return ret;
1483+
}
14701484
spin_lock_irqsave(&iwqp->lock, flags);
14711485
if (iwqp->iwarp_state == info.curr_iwarp_state) {
14721486
iwqp->iwarp_state = info.next_iwarp_state;
@@ -2900,7 +2914,7 @@ static struct irdma_mr *irdma_alloc_iwmr(struct ib_umem *region,
29002914
iwmr->type = reg_type;
29012915

29022916
pgsz_bitmap = (reg_type == IRDMA_MEMREG_TYPE_MEM) ?
2903-
iwdev->rf->sc_dev.hw_attrs.page_size_cap : PAGE_SIZE;
2917+
iwdev->rf->sc_dev.hw_attrs.page_size_cap : SZ_4K;
29042918

29052919
iwmr->page_size = ib_umem_find_best_pgsz(region, pgsz_bitmap, virt);
29062920
if (unlikely(!iwmr->page_size)) {
@@ -2932,6 +2946,11 @@ static int irdma_reg_user_mr_type_qp(struct irdma_mem_reg_req req,
29322946
int err;
29332947
u8 lvl;
29342948

2949+
/* iWarp: Catch page not starting on OS page boundary */
2950+
if (!rdma_protocol_roce(&iwdev->ibdev, 1) &&
2951+
ib_umem_offset(iwmr->region))
2952+
return -EINVAL;
2953+
29352954
total = req.sq_pages + req.rq_pages + 1;
29362955
if (total > iwmr->page_cnt)
29372956
return -EINVAL;

drivers/infiniband/hw/irdma/verbs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ struct irdma_qp {
198198
u8 flush_issued : 1;
199199
u8 sig_all : 1;
200200
u8 pau_mode : 1;
201+
u8 suspend_pending : 1;
201202
u8 rsvd : 1;
202203
u8 iwarp_state;
203204
u16 term_sq_flush_code;

0 commit comments

Comments
 (0)