mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: mana: Reserve extra CQ slot for the fence completion CQE
@ 2026-09-01 12:17 Sahil Chandna
  2026-09-01 18:11 ` Haiyang Zhang
  2026-09-05  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Sahil Chandna @ 2026-09-01 12:17 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, longli, andrew+netdev, davem,
	edumazet, kuba, pabeni, horms, ernis, gargaditya, linux-hyperv,
	netdev, linux-kernel

The RX completion queue is sized to hold exactly one CQE per posted RX WQE.
MANA_FENCE_RQ makes hardware post an additional CQE_RX_OBJECT_FENCE after
the packet CQEs. The current sizing reserves no extra slot for it and in
rare cases, CQ has no guaranteed slot for the fence CQE when it is full of
packet CQEs. This can lead to dropping the fence completion while the
driver waits holding RTNL lock throughout the timeout duration.
Reserve one extra CQE slot for CQE_RX_OBJECT_FENCE. mana_gd_alloc_memory()
requires queue_size to be a power-of-two and at least MANA_PAGE_SIZE;
the reservation pushes cq_size past a power-of-two, so round up the CQ size
in mana_create_rxq().

Fixes: 6cc74443a773 ("net: mana: Add RX fencing")
Signed-off-by: Sahil Chandna <sahilchandna@linux.microsoft.com>
---
 drivers/net/ethernet/microsoft/mana/mana_en.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 7dfb453ae75a..e677842059e2 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -3020,6 +3020,10 @@ static int mana_alloc_rx_wqe(struct mana_port_context *apc,
 		*cq_size += COMP_ENTRY_SIZE;
 	}

+	/* Reserve an extra slot for Fence completion
+	 * event (CQE_RX_OBJECT_FENCE) in case RX CQ is full.
+	 */
+	*cq_size += COMP_ENTRY_SIZE;
 	return 0;
 }

@@ -3114,7 +3118,7 @@ static struct mana_rxq *mana_create_rxq(struct mana_port_context *apc,
 		goto out;

 	rq_size = MANA_PAGE_ALIGN(rq_size);
-	cq_size = MANA_PAGE_ALIGN(cq_size);
+	cq_size = MANA_PAGE_ALIGN(roundup_pow_of_two(cq_size));

 	/* Create RQ */
 	memset(&spec, 0, sizeof(spec));
--
2.53.0


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

* RE: [PATCH] net: mana: Reserve extra CQ slot for the fence completion CQE
  2026-09-01 12:17 [PATCH] net: mana: Reserve extra CQ slot for the fence completion CQE Sahil Chandna
@ 2026-09-01 18:11 ` Haiyang Zhang
  2026-09-05  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Haiyang Zhang @ 2026-09-01 18:11 UTC (permalink / raw)
  To: Sahil Chandna, KY Srinivasan, wei.liu, Dexuan Cui, Long Li,
	andrew+netdev, davem, edumazet, kuba, pabeni, horms, ernis,
	gargaditya, linux-hyperv, netdev, linux-kernel
  Cc: stable



> -----Original Message-----
> From: Sahil Chandna <sahilchandna@linux.microsoft.com>
> Sent: Tuesday, September 1, 2026 8:18 AM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; wei.liu@kernel.org; Dexuan Cui
> <DECUI@microsoft.com>; Long Li <longli@microsoft.com>;
> andrew+netdev@lunn.ch; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; horms@kernel.org;
> ernis@linux.microsoft.com; gargaditya@linux.microsoft.com; linux-
> hyperv@vger.kernel.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] net: mana: Reserve extra CQ slot for the fence completion
> CQE
> 
> The RX completion queue is sized to hold exactly one CQE per posted RX
> WQE.
> MANA_FENCE_RQ makes hardware post an additional CQE_RX_OBJECT_FENCE after
> the packet CQEs. The current sizing reserves no extra slot for it and in
> rare cases, CQ has no guaranteed slot for the fence CQE when it is full of
> packet CQEs. This can lead to dropping the fence completion while the
> driver waits holding RTNL lock throughout the timeout duration.
> Reserve one extra CQE slot for CQE_RX_OBJECT_FENCE. mana_gd_alloc_memory()
> requires queue_size to be a power-of-two and at least MANA_PAGE_SIZE;
> the reservation pushes cq_size past a power-of-two, so round up the CQ
> size
> in mana_create_rxq().
> 
> Fixes: 6cc74443a773 ("net: mana: Add RX fencing")
> Signed-off-by: Sahil Chandna <sahilchandna@linux.microsoft.com>

The code change looks good.
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>

For bug fixes, please indicate "net" branch in the Subject, and add 
Cc: stable@vger.kernel.org

Thanks,
- Haiyang


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

* Re: [PATCH] net: mana: Reserve extra CQ slot for the fence completion CQE
  2026-09-01 12:17 [PATCH] net: mana: Reserve extra CQ slot for the fence completion CQE Sahil Chandna
  2026-09-01 18:11 ` Haiyang Zhang
@ 2026-09-05  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-05  2:00 UTC (permalink / raw)
  To: Sahil Chandna
  Cc: kys, haiyangz, wei.liu, decui, longli, andrew+netdev, davem,
	edumazet, kuba, pabeni, horms, ernis, gargaditya, linux-hyperv,
	netdev, linux-kernel

Hello:

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

On Tue,  1 Sep 2026 07:17:58 -0500 you wrote:
> The RX completion queue is sized to hold exactly one CQE per posted RX WQE.
> MANA_FENCE_RQ makes hardware post an additional CQE_RX_OBJECT_FENCE after
> the packet CQEs. The current sizing reserves no extra slot for it and in
> rare cases, CQ has no guaranteed slot for the fence CQE when it is full of
> packet CQEs. This can lead to dropping the fence completion while the
> driver waits holding RTNL lock throughout the timeout duration.
> Reserve one extra CQE slot for CQE_RX_OBJECT_FENCE. mana_gd_alloc_memory()
> requires queue_size to be a power-of-two and at least MANA_PAGE_SIZE;
> the reservation pushes cq_size past a power-of-two, so round up the CQ size
> in mana_create_rxq().
> 
> [...]

Here is the summary with links:
  - net: mana: Reserve extra CQ slot for the fence completion CQE
    https://git.kernel.org/netdev/net/c/80dd7e754b3a

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] 3+ messages in thread

end of thread, other threads:[~2026-09-05  2:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 12:17 [PATCH] net: mana: Reserve extra CQ slot for the fence completion CQE Sahil Chandna
2026-09-01 18:11 ` Haiyang Zhang
2026-09-05  2:00 ` 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

all inboxes | Powered by JetHome®