linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues
@ 2023-07-17 19:35 longli
  2023-07-17 19:35 ` [PATCH net-next v5 1/2] net: mana: Batch ringing RX queue doorbell on receiving packets longli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: longli @ 2023-07-17 19:35 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Leon Romanovsky, Shradha Gupta, Ajay Sharma, Shachar Raindel,
	Stephen Hemminger, linux-hyperv, netdev, linux-kernel
  Cc: linux-rdma, Long Li

From: Long Li <longli@microsoft.com>

This patchset fixes the issues discovered during 200G physical link
tests. It fixes doorbell usage and WQE format for receive queues.

Long Li (2):
  net: mana: Batch ringing RX queue doorbell on receiving packets
  net: mana: Use the correct WQE count for ringing RQ doorbell

 drivers/net/ethernet/microsoft/mana/gdma_main.c |  5 ++++-
 drivers/net/ethernet/microsoft/mana/mana_en.c   | 10 ++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next v5 1/2] net: mana: Batch ringing RX queue doorbell on receiving packets
  2023-07-17 19:35 [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues longli
@ 2023-07-17 19:35 ` longli
  2023-07-17 19:35 ` [PATCH net-next v5 2/2] net: mana: Use the correct WQE count for ringing RQ doorbell longli
  2023-07-19  1:10 ` [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: longli @ 2023-07-17 19:35 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Leon Romanovsky, Shradha Gupta, Ajay Sharma, Shachar Raindel,
	Stephen Hemminger, linux-hyperv, netdev, linux-kernel
  Cc: linux-rdma, Long Li

From: Long Li <longli@microsoft.com>

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 during a callback from napi_poll().

With this change, tests showed an improvement from 120G/s to 160G/s on a
200G physical link, with 16 or 32 hardware queues.

Tests showed no regression in network latency benchmarks on single
connection.

Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Long Li <longli@microsoft.com>
---
Change log:
v2:
Check for comp_read > 0 as it might be negative on completion error.
Set rq.wqe_cnt to 0 according to BNIC spec.

v3:
Add details in the commit on the reason of performance increase and test numbers.
Add details in the commit on why rq.wqe_cnt should be set to 0 according to hardware spec.
Add "Reviewed-by" from Haiyang and Dexuan.

v4:
Split the original patch into two: one for batching doorbell, one for setting the correct wqe count

v5:
drop Cc: stable and use net-next

 drivers/net/ethernet/microsoft/mana/mana_en.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index cd4d5ceb9f2d..1d8abe63fcb8 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -1383,8 +1383,8 @@ static void 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,
-				    &recv_buf_oob->wqe_inf);
+	err = mana_gd_post_work_request(rxq->gdma_rq, &recv_buf_oob->wqe_req,
+					&recv_buf_oob->wqe_inf);
 	if (WARN_ON_ONCE(err))
 		return;
 
@@ -1654,6 +1654,12 @@ static void mana_poll_rx_cq(struct mana_cq *cq)
 		mana_process_rx_cqe(rxq, cq, &comp[i]);
 	}
 
+	if (comp_read > 0) {
+		struct gdma_context *gc = rxq->gdma_rq->gdma_dev->gdma_context;
+
+		mana_gd_wq_ring_doorbell(gc, rxq->gdma_rq);
+	}
+
 	if (rxq->xdp_flush)
 		xdp_do_flush();
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next v5 2/2] net: mana: Use the correct WQE count for ringing RQ doorbell
  2023-07-17 19:35 [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues longli
  2023-07-17 19:35 ` [PATCH net-next v5 1/2] net: mana: Batch ringing RX queue doorbell on receiving packets longli
@ 2023-07-17 19:35 ` longli
  2023-07-19  1:10 ` [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: longli @ 2023-07-17 19:35 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Leon Romanovsky, Shradha Gupta, Ajay Sharma, Shachar Raindel,
	Stephen Hemminger, linux-hyperv, netdev, linux-kernel
  Cc: linux-rdma, Long Li

From: Long Li <longli@microsoft.com>

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.

Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Long Li <longli@microsoft.com>
---
Change log:
v4:
Split the original patch into two: one for batching doorbell, one for setting the correct wqe count

v5:
Drop Cc: stable and use net-next

 drivers/net/ethernet/microsoft/mana/gdma_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index 8f3f78b68592..3765d3389a9a 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -300,8 +300,11 @@ static void mana_gd_ring_doorbell(struct gdma_context *gc, u32 db_index,
 
 void mana_gd_wq_ring_doorbell(struct gdma_context *gc, struct gdma_queue *queue)
 {
+	/* Hardware Spec specifies that software client should set 0 for
+	 * wqe_cnt for Receive Queues. This value is not used in Send Queues.
+	 */
 	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 mana_gd_ring_cq(struct gdma_queue *cq, u8 arm_bit)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues
  2023-07-17 19:35 [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues longli
  2023-07-17 19:35 ` [PATCH net-next v5 1/2] net: mana: Batch ringing RX queue doorbell on receiving packets longli
  2023-07-17 19:35 ` [PATCH net-next v5 2/2] net: mana: Use the correct WQE count for ringing RQ doorbell longli
@ 2023-07-19  1:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-19  1:10 UTC (permalink / raw)
  To: Long Li
  Cc: kys, haiyangz, wei.liu, decui, davem, edumazet, kuba, pabeni,
	leon, shradhagupta, sharmaajay, shacharr, stephen, linux-hyperv,
	netdev, linux-kernel, linux-rdma, longli

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 17 Jul 2023 12:35:37 -0700 you wrote:
> From: Long Li <longli@microsoft.com>
> 
> This patchset fixes the issues discovered during 200G physical link
> tests. It fixes doorbell usage and WQE format for receive queues.
> 
> Long Li (2):
>   net: mana: Batch ringing RX queue doorbell on receiving packets
>   net: mana: Use the correct WQE count for ringing RQ doorbell
> 
> [...]

Here is the summary with links:
  - [net-next,v5,1/2] net: mana: Batch ringing RX queue doorbell on receiving packets
    https://git.kernel.org/netdev/net-next/c/da4e8648079e
  - [net-next,v5,2/2] net: mana: Use the correct WQE count for ringing RQ doorbell
    https://git.kernel.org/netdev/net-next/c/f5e39b57124f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-19  1:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 19:35 [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues longli
2023-07-17 19:35 ` [PATCH net-next v5 1/2] net: mana: Batch ringing RX queue doorbell on receiving packets longli
2023-07-17 19:35 ` [PATCH net-next v5 2/2] net: mana: Use the correct WQE count for ringing RQ doorbell longli
2023-07-19  1:10 ` [PATCH net-next v5 0/2] net: mana: Fix doorbell access for receive queues patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).