Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jacob Moroni and committed by
Leon Romanovsky
5c3f795d 52f3d34c

+11 -9
+2
drivers/infiniband/hw/irdma/main.h
··· 23 23 #include <linux/workqueue.h> 24 24 #include <linux/slab.h> 25 25 #include <linux/io.h> 26 + #include <linux/iopoll.h> 26 27 #include <linux/crc32c.h> 27 28 #include <linux/kthread.h> 28 29 #ifndef CONFIG_64BIT ··· 529 528 void irdma_srq_event(struct irdma_sc_srq *srq); 530 529 void irdma_srq_wq_destroy(struct irdma_pci_f *rf, struct irdma_sc_srq *srq); 531 530 void irdma_cleanup_pending_cqp_op(struct irdma_pci_f *rf); 531 + int irdma_get_timeout_threshold(struct irdma_sc_dev *dev); 532 532 int irdma_hw_modify_qp(struct irdma_device *iwdev, struct irdma_qp *iwqp, 533 533 struct irdma_modify_qp_info *info, bool wait); 534 534 int irdma_qp_suspend_resume(struct irdma_sc_qp *qp, bool suspend);
+1 -1
drivers/infiniband/hw/irdma/utils.c
··· 572 572 } 573 573 } 574 574 575 - static int irdma_get_timeout_threshold(struct irdma_sc_dev *dev) 575 + int irdma_get_timeout_threshold(struct irdma_sc_dev *dev) 576 576 { 577 577 u16 time_s = dev->vc_caps.cqp_timeout_s; 578 578
+8 -8
drivers/infiniband/hw/irdma/verbs.c
··· 5027 5027 } 5028 5028 5029 5029 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; 5031 5032 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"); 5039 5039 err = -ETIMEDOUT; 5040 5040 goto err_ah_create; 5041 5041 }