Skip to content

Commit bd6da69

Browse files
mustafakismailrleon
authored andcommitted
RDMA/irdma: Add wait for suspend on SQD
Currently, there is no wait for the QP suspend to complete on a modify to SQD state. Add a wait, after the modify to SQD state, for the Suspend Complete AE. While we are at it, update the suspend timeout value in irdma_prep_tc_change to use IRDMA_EVENT_TIMEOUT_MS too. Fixes: b48c24c ("RDMA/irdma: Implement device supported verb APIs") Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Link: https://lore.kernel.org/r/20231114170246.238-3-shiraz.saleem@intel.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent ba12ab6 commit bd6da69

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

drivers/infiniband/hw/irdma/hw.c

Lines changed: 5 additions & 1 deletion
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;

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: 21 additions & 0 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,6 +1435,7 @@ 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:
@@ -1460,6 +1476,11 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
14601476
ctx_info->rem_endpoint_idx = udp_info->arp_idx;
14611477
if (irdma_hw_modify_qp(iwdev, iwqp, &info, true))
14621478
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+
}
14631484
spin_lock_irqsave(&iwqp->lock, flags);
14641485
if (iwqp->iwarp_state == info.curr_iwarp_state) {
14651486
iwqp->iwarp_state = info.next_iwarp_state;

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)