Skip to content

Commit 5c3f795

Browse files
jakemoronirleon
authored andcommitted
RDMA/irdma: Remove fixed 1 ms delay during AH wait loop
The AH CQP command wait loop executes in an atomic context and was using a fixed 1 ms delay. Since many AH create commands can complete much faster than 1 ms, use poll_timeout_us_atomic with a 1 us delay. Also, use the timeout value indicated during the capability exchange rather than a hard-coded value. Signed-off-by: Jacob Moroni <jmoroni@google.com> Link: https://patch.msgid.link/20260105180550.2907858-1-jmoroni@google.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 52f3d34 commit 5c3f795

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

drivers/infiniband/hw/irdma/main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/workqueue.h>
2424
#include <linux/slab.h>
2525
#include <linux/io.h>
26+
#include <linux/iopoll.h>
2627
#include <linux/crc32c.h>
2728
#include <linux/kthread.h>
2829
#ifndef CONFIG_64BIT
@@ -528,6 +529,7 @@ void irdma_cq_wq_destroy(struct irdma_pci_f *rf, struct irdma_sc_cq *cq);
528529
void irdma_srq_event(struct irdma_sc_srq *srq);
529530
void irdma_srq_wq_destroy(struct irdma_pci_f *rf, struct irdma_sc_srq *srq);
530531
void irdma_cleanup_pending_cqp_op(struct irdma_pci_f *rf);
532+
int irdma_get_timeout_threshold(struct irdma_sc_dev *dev);
531533
int irdma_hw_modify_qp(struct irdma_device *iwdev, struct irdma_qp *iwqp,
532534
struct irdma_modify_qp_info *info, bool wait);
533535
int irdma_qp_suspend_resume(struct irdma_sc_qp *qp, bool suspend);

drivers/infiniband/hw/irdma/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ void irdma_cleanup_pending_cqp_op(struct irdma_pci_f *rf)
572572
}
573573
}
574574

575-
static int irdma_get_timeout_threshold(struct irdma_sc_dev *dev)
575+
int irdma_get_timeout_threshold(struct irdma_sc_dev *dev)
576576
{
577577
u16 time_s = dev->vc_caps.cqp_timeout_s;
578578

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5027,15 +5027,15 @@ static int irdma_create_hw_ah(struct irdma_device *iwdev, struct irdma_ah *ah, b
50275027
}
50285028

50295029
if (!sleep) {
5030-
int cnt = CQP_COMPL_WAIT_TIME_MS * CQP_TIMEOUT_THRESHOLD;
5030+
const u64 tmout_ms = irdma_get_timeout_threshold(&rf->sc_dev) *
5031+
CQP_COMPL_WAIT_TIME_MS;
50315032

5032-
do {
5033-
irdma_cqp_ce_handler(rf, &rf->ccq.sc_cq);
5034-
mdelay(1);
5035-
} while (!ah->sc_ah.ah_info.ah_valid && --cnt);
5036-
5037-
if (!cnt) {
5038-
ibdev_dbg(&iwdev->ibdev, "VERBS: CQP create AH timed out");
5033+
if (poll_timeout_us_atomic(irdma_cqp_ce_handler(rf,
5034+
&rf->ccq.sc_cq),
5035+
ah->sc_ah.ah_info.ah_valid, 1,
5036+
tmout_ms * USEC_PER_MSEC, false)) {
5037+
ibdev_dbg(&iwdev->ibdev,
5038+
"VERBS: CQP create AH timed out");
50395039
err = -ETIMEDOUT;
50405040
goto err_ah_create;
50415041
}

0 commit comments

Comments
 (0)