git: 63a564508b1a - releng/14.0 - mana: batch ringing RX queue doorbell on receiving packets
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 09 Sep 2023 13:37:50 UTC
The branch releng/14.0 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=63a564508b1a4247386cd77d44b679fcdc0436bb commit 63a564508b1a4247386cd77d44b679fcdc0436bb Author: Wei Hu <whu@FreeBSD.org> AuthorDate: 2023-08-28 09:15:16 +0000 Commit: Wei Hu <whu@FreeBSD.org> CommitDate: 2023-09-09 13:27:03 +0000 mana: batch ringing RX queue doorbell on receiving packets It's inefficient to ring the doorbell page every time a WQE is posted to the received queue. Excessive MMIO writes result in CPU spending more time waiting on LOCK instructions (atomic operations), resulting in poor scaling performance. Move the code for ringing doorbell page to where after we have posted all WQEs to the receive queue in mana_poll_rx_cq(). In addition, use the correct WQE count for ringing RQ doorbell. The hardware specification specifies that WQE_COUNT should set to 0 for the Receive Queue. Although currently the hardware doesn't enforce the check, in the future releases it may check on this value. Approved by: re (gjb) Sponsored by: Microsoft (cherry picked from commit e4e11c1d07f5d58ff8cf4e07ac8f61eecbbb5417) (cherry picked from commit 55b7a8233e3da9355d555dff80011a97fac23079) --- sys/dev/mana/gdma_main.c | 2 +- sys/dev/mana/mana_en.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/dev/mana/gdma_main.c b/sys/dev/mana/gdma_main.c index 2de606d54957..a601873876cb 100644 --- a/sys/dev/mana/gdma_main.c +++ b/sys/dev/mana/gdma_main.c @@ -471,7 +471,7 @@ void mana_gd_wq_ring_doorbell(struct gdma_context *gc, struct gdma_queue *queue) { mana_gd_ring_doorbell(gc, queue->gdma_dev->doorbell, queue->type, - queue->id, queue->head * GDMA_WQE_BU_SIZE, 1); + queue->id, queue->head * GDMA_WQE_BU_SIZE, 0); } void diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index 49558cdc97c6..fa49e06e4862 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -1524,7 +1524,7 @@ mana_post_pkt_rxq(struct mana_rxq *rxq) recv_buf_oob = &rxq->rx_oobs[curr_index]; - err = mana_gd_post_and_ring(rxq->gdma_rq, &recv_buf_oob->wqe_req, + err = mana_gd_post_work_request(rxq->gdma_rq, &recv_buf_oob->wqe_req, &recv_buf_oob->wqe_inf); if (err) { mana_err(NULL, "WARNING: rxq %u post pkt err %d\n", @@ -1757,6 +1757,13 @@ mana_poll_rx_cq(struct mana_cq *cq) mana_process_rx_cqe(cq->rxq, cq, &comp[i]); } + if (comp_read > 0) { + struct gdma_context *gc = + cq->rxq->gdma_rq->gdma_dev->gdma_context; + + mana_gd_wq_ring_doorbell(gc, cq->rxq->gdma_rq); + } + tcp_lro_flush_all(&cq->rxq->lro); }