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

Revert "net/smc: don't req_notify until all CQEs drained"

This reverts commit a505cce6f7cfaf2aa2385aab7286063c96444526.

Leon says:
We already discussed that. SMC should be changed to use
RDMA CQ pool API
drivers/infiniband/core/cq.c.
ib_poll_handler() has much better implementation (tracing,
IRQ rescheduling, proper error handling) than this SMC variant.

Since we will switch to ib_poll_handler() in the future,
revert this patch.

Link: https://lore.kernel.org/netdev/20220301105332.GA9417@linux.alibaba.com/
Suggested-by: Leon Romanovsky <leon@kernel.org>
Suggested-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Dust Li and committed by
David S. Miller
925a2421 d59e3cba

+21 -28
+21 -28
net/smc/smc_wr.c
··· 137 137 { 138 138 struct smc_ib_device *dev = from_tasklet(dev, t, send_tasklet); 139 139 struct ib_wc wc[SMC_WR_MAX_POLL_CQE]; 140 - int i, rc; 140 + int i = 0, rc; 141 + int polled = 0; 141 142 142 143 again: 144 + polled++; 143 145 do { 144 146 memset(&wc, 0, sizeof(wc)); 145 147 rc = ib_poll_cq(dev->roce_cq_send, SMC_WR_MAX_POLL_CQE, wc); 148 + if (polled == 1) { 149 + ib_req_notify_cq(dev->roce_cq_send, 150 + IB_CQ_NEXT_COMP | 151 + IB_CQ_REPORT_MISSED_EVENTS); 152 + } 153 + if (!rc) 154 + break; 146 155 for (i = 0; i < rc; i++) 147 156 smc_wr_tx_process_cqe(&wc[i]); 148 - if (rc < SMC_WR_MAX_POLL_CQE) 149 - /* If < SMC_WR_MAX_POLL_CQE, the CQ should have been 150 - * drained, no need to poll again. --Guangguan Wang 151 - */ 152 - break; 153 157 } while (rc > 0); 154 - 155 - /* IB_CQ_REPORT_MISSED_EVENTS make sure if ib_req_notify_cq() returns 156 - * 0, it is safe to wait for the next event. 157 - * Else we must poll the CQ again to make sure we won't miss any event 158 - */ 159 - if (ib_req_notify_cq(dev->roce_cq_send, 160 - IB_CQ_NEXT_COMP | 161 - IB_CQ_REPORT_MISSED_EVENTS)) 158 + if (polled == 1) 162 159 goto again; 163 160 } 164 161 ··· 478 481 { 479 482 struct smc_ib_device *dev = from_tasklet(dev, t, recv_tasklet); 480 483 struct ib_wc wc[SMC_WR_MAX_POLL_CQE]; 484 + int polled = 0; 481 485 int rc; 482 486 483 487 again: 488 + polled++; 484 489 do { 485 490 memset(&wc, 0, sizeof(wc)); 486 491 rc = ib_poll_cq(dev->roce_cq_recv, SMC_WR_MAX_POLL_CQE, wc); 487 - if (rc > 0) 488 - smc_wr_rx_process_cqes(&wc[0], rc); 489 - if (rc < SMC_WR_MAX_POLL_CQE) 490 - /* If < SMC_WR_MAX_POLL_CQE, the CQ should have been 491 - * drained, no need to poll again. --Guangguan Wang 492 - */ 492 + if (polled == 1) { 493 + ib_req_notify_cq(dev->roce_cq_recv, 494 + IB_CQ_SOLICITED_MASK 495 + | IB_CQ_REPORT_MISSED_EVENTS); 496 + } 497 + if (!rc) 493 498 break; 499 + smc_wr_rx_process_cqes(&wc[0], rc); 494 500 } while (rc > 0); 495 - 496 - /* IB_CQ_REPORT_MISSED_EVENTS make sure if ib_req_notify_cq() returns 497 - * 0, it is safe to wait for the next event. 498 - * Else we must poll the CQ again to make sure we won't miss any event 499 - */ 500 - if (ib_req_notify_cq(dev->roce_cq_recv, 501 - IB_CQ_SOLICITED_MASK | 502 - IB_CQ_REPORT_MISSED_EVENTS)) 501 + if (polled == 1) 503 502 goto again; 504 503 } 505 504