🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18042

Re: [PATCH net-next v11 4/4] net: mana: add dynamic HWC queue depth with reinit path

#18042
From: Leon Romanovsky
Date: Tue, 17 Nov 2026 18:09
97 lines
13128 bytes
On Tue, Nov 17, 2026 at 04:01:01PM +0000, Wei Hu wrote:
> From: Long Li <longli@microsoft.com>
> 
> The HWC starts with depth-one bootstrap queues. Treat the PF-reported depth
> as a maximum and rebuild the channel exactly for reports from 2 through
> 128. Keep the untouched bootstrap queues for depth one and reports above
> 128, and require a rebuilt channel to repeat the selected depth.
> 
> Treat the reported request and response sizes as directional maxima.
> Rebuild only when both reports equal the 4096-byte bootstrap allocation.
> Keep allocation strides separate from these limits, and share the effective
> host-to-PF request budget with the GDMA and RDMA request builders. Bound
> RDMA CREATE and ADD_PAGES batches by that budget, checking that the headers
> and at least one page address fit before subtracting their sizes.
> 
> Require nonzero depth, request-size and response-size reports before
> deciding whether to keep the bootstrap queues. Apply the same validation
> to a restored bootstrap channel. A missing or zero required report fails
> with -EPROTO, even at depth one; do not silently substitute guessed limits.
> 
> Reject oversized messages before acquiring a slot or publishing caller
> storage. A retained, stopped channel still returns -ENODEV rather than
> reporting a size error against uninitialized negotiated limits.
> 
> Keep each candidate private through queue creation, establishment and the
> direct EQ test. Publish only the final tested channel. If a rebuild fails,
> including its functional test, tear it down and restore fresh, tested
> bootstrap queues. Stop if teardown is not acknowledged; never reuse
> PF-owned mappings. Restore the previous live timeout budget before the
> fallback so a failed test's fail-fast reduction does not poison the retry,
> without reviving terminal cancellation.
> 
> Invalidate the previous HWC doorbell before every ESTABLISH_HWC. Validate
> the BAR0 page geometry and reported index before accepting a new doorbell,
> and suppress MMIO while it is invalid. The original driver accepted an
> unchecked device-supplied index in its MMIO address calculation; this also
> fixes that existing out-of-bounds MMIO path. Backports need the complete
> ownership and validation dependencies, not the entire feature stack by
> default. A malformed doorbell completes initialization with -EPROTO without
> relying on later INIT_DONE events that might require re-arming through that
> doorbell.
> 
> Use the initial PF report to select the queue geometry. The PF directs
> this choice; the absence of VF size fields in ESTABLISH_HWC does not require
> keeping the bootstrap geometry. Driver-version advertisement occurs after
> HWC establishment and cannot negotiate behavior needed during creation.
> 
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
> Link: https://lore.kernel.org/r/20260908035201.402424-5-longli@microsoft.com
> Link: https://lore.kernel.org/r/179196575846.434549.7933818740976196422@kernel.org
> Link: https://lore.kernel.org/r/179455240227.2199510.2666165032389090040@kernel.org
> Signed-off-by: Long Li <longli@microsoft.com>
> Signed-off-by: Wei Hu <weh@microsoft.com>
> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
> Copilot-Session: 8c2361e6-c0f4-4b0c-bf01-b5e4cdacec50
> ---
>  drivers/infiniband/hw/mana/main.c             |  19 +-
>  .../net/ethernet/microsoft/mana/gdma_main.c   |  26 +-
>  .../net/ethernet/microsoft/mana/hw_channel.c  | 316 +++++++++++++++---
>  include/net/mana/gdma.h                       |   2 +
>  include/net/mana/hw_channel.h                 |  19 +-
>  5 files changed, 317 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c
> index 7d5a8fc7380d..6e036a25a9f7 100644
> --- a/drivers/infiniband/hw/mana/main.c
> +++ b/drivers/infiniband/hw/mana/main.c
> @@ -427,28 +427,38 @@ static int mana_ib_gd_create_dma_region(struct mana_ib_dev *dev, struct ib_umem
>  	unsigned int create_req_msg_size;
>  	struct hw_channel_context *hwc;
>  	struct ib_block_iter biter;
> -	size_t max_pgs_add_cmd = 0;
> +	size_t max_pgs_add_cmd;
>  	size_t max_pgs_create_cmd;
>  	struct gdma_context *gc;
>  	size_t num_pages_total;
>  	unsigned int tail = 0;
> +	u32 req_limit;
>  	u64 *page_addr_list;
>  	void *request_buf;
>  	int err = 0;
>  
>  	gc = mdev_to_gc(dev);
>  	hwc = gc->hwc.driver_data;
> +	req_limit = mana_hwc_get_max_req_size(hwc);
> +	if (req_limit < struct_size(create_req, page_addr_list, 1) ||
> +	    req_limit < struct_size(add_req, page_addr_list, 1)) {
> +		ibdev_dbg(&dev->ib_dev,
> +			  "HWC request budget %u is too small for DMA region commands\n",
> +			  req_limit);
> +		return -EMSGSIZE;
> +	}

No. Make sure you also call mana_ib_gd_create_dma_region() with valid parameters.

Thanks
Technical Details
Message-ID: <20261117180931.GE162713@unreal>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365528-linux-kernel-netdev=dewy.ru
References: <cover.1794751992.git.weh@linux.microsoft.com> <100c6b7a71e86c8d7afd0c55f6b231f01db184d5.1794751992.git.weh@linux.microsoft.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365528-linux-kernel-netdev=dewy.ru
From: leon@kernel.org (Leon Romanovsky)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v11 4/4] net: mana: add dynamic HWC queue depth
 with reinit path
Date: Tue, 17 Nov 2026 20:09:31 +0200
Organization: Usenet Network
Message-ID: <20261117180931.GE162713@unreal>
References: <cover.1794751992.git.weh@linux.microsoft.com>
 <100c6b7a71e86c8d7afd0c55f6b231f01db184d5.1794751992.git.weh@linux.microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2396848"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:y4ci02smZMYs+igLtT0LjnTY6Uw= sha256:unKRrBQurNim43RlhR3Nmv+8L7R3Ws/F1X1SdAzhNSQ=
	sha1:PDhFfciWIJj96PTlqvVpyBoPRx4= sha256:o5KnRHx7alve0yB8rlOJ6E3wEcKRnscFg3ZQ1RR2+LQ=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E5BCE115006; Tue, 17 Nov 2026 21:10:02 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id mFz8hh-k2NWX;
	Tue, 17 Nov 2026 21:09:53 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-365528-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 386AD115037; Tue, 17 Nov 2026 21:09:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 3C5AC3799D; Tue, 17 Nov 2026 18:09:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794938981;
	b=OB+vZSCSOndmqm2n2vSRnUY+mZHMkNV4+jWEh4G+y//h74aZYXr4zJJ5fEDqE/7rBH5R
	 VimenefsTOZnFJidUxh57pVFTynwXqx+go/2h7uPKtOG03BQdAucMn26Tls9onOz5b/N5
	 7bWdgKbWzG9k1eVa9WDaX6urhfWp5jqVIKzBbgOPtAYYJnazX9PU4JHT8DE6eLbwuEY4Q
	 aY4N98vJA+mUu3/keIuah7Ja5bEyLy8r4B5CXH+Rt0KxNoWVlwMnDGuP/n3m2cqbFrStG
	 YzlhYxdG3yjwmsdy9p8eGZNKz8k3eUfJxBVZ+4QoVpLsd6wTzz0LwW7A7D21UkeCOTA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794938981;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=BsKxt9nBAEfHX3Rjct/RuZ6P/gqzP6gTfo1UjEyhmRg=;
	b=UQR2RwdQEzeXH16IVqeloXZVOX6M6EeVXUrlag9VXfBQtk1Hpd8/1EzcwH1dWerNlOHD
	 jowMiNymdq5ulfe4e1m8yvT/wnMfAUM+SrvKJlq8xYiw2KLaeyEFGd/4zqdHP15ZYJIt7
	 9bhzzCWPwipvS5JKhHZRlAlrD4sLWxYCYJYMFbK++riu8hSAieob+S7v2g7UxSumG/yx5
	 8IUMtNYf+4c4QCTYYJKbZF41D7JjmBnCz9x0rIeNhPvkRMD/hyJ2iyGHsxwQqgUrAUFMR
	 y/et+I5j62hLNU2nSSjhbxUy+lTIYxzhy+0Ajx024DbD7FjcoQHr0m4LJVfPGo+NjfA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X9bgNJXQ;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9713E606A330;
	Tue, 17 Nov 2026 18:09:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X9bgNJXQ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794938975;
	b=v/XzRrQir54NO4g/UTfksiXmhjT6e8/mcX2uVny/s3FeBM38n2RmdZaf8cPRQDjoakmV
	 aNrJfSBUWXXtBZYjYIhUJnGEMnyenkbQwJiLVRHR4cDqICJmbtFOa1hGs6K4HkOEsXvBa
	 oYSqKNQ+6aQr6DAVif8HIJ7p+T9oIAoYE2aVLQJSVxVa6SONJp92jp+p/jfYd2QlPjQpV
	 X2UgOQYVr+IkArlGBN6gEzBMLW9G/UDWxgUdxLUjRcc1EqYewYMwVCDzpto4+Jqqou3sD
	 YofMYH+WQ94seS6i9K90uB+E4zIKSFg4lxygKhZzPPUmaXevoYYM5U7kqA3bq9Sjlhw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794938975;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=BsKxt9nBAEfHX3Rjct/RuZ6P/gqzP6gTfo1UjEyhmRg=;
	b=yanHkJPqbFtaLynAMEAwdmhQmGDF+LyUDGvOmvSZWOCuNyS6l/RzGR7C9lLDN5BSFzQy
	 sVsX28u1i2zhVsepeJ/PnjZp5HmN1246XiyVgLfnl4yqYd7App1hcmYPOCES7zCsRFwYj
	 jMs7RjFLcUYg2ycJ2IK+iz+dlEsrZNAUmxOzKaAJSvKLaL+YpONinV+GcaMS+YvGj8oRf
	 ABHlRgIIcKjdgVramAKDuyuuZlt3MYCsjK3Xu1mIGb4wIi4A4lG1BLMoG8ZqukIciacEk
	 9Zgha22xUcPxOjuyEROFITUUWOLbjXVoG0swlDZrZwKFiHbkutBA76C3v+2cv84HQTQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X9bgNJXQ;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B20B1606A31C;
	Tue, 17 Nov 2026 18:09:35 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC5A71F000C4;
	Tue, 17 Nov 2026 18:09:34 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794938975;
	bh=BsKxt9nBAEfHX3Rjct/RuZ6P/gqzP6gTfo1UjEyhmRg=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=X9bgNJXQaOXS1uA/Of7mTNbh5+XkG0/WlduzwZAR/P1OlrcTQsurTkjIMJc6MQMm9
	 R+U6ZngdfMXMalhwFOUWVJn8VAw2lp7+MsOrm7bTNiczmVru8ilT0OSpWzrXsR2Dja
	 03QA/maQ/odkiL6qE41DxRGCrpgzHTlY99y0aSpszjFWdADbshxHHR+egN26yOZenQ
	 FdZLFb3VCJnUZyWFxwoi6V+NkS+TsiLUO6Up1iTT9zyiQOLB/68sLJUknqDLSV/XnB
	 xS8j+UeusWkmCkw3PdTzGf9QIARNp08XUPnXlqHXmkP6CtulZj+H6MfORn1OUsGCUB
	 SpK4IcmwfOqFQ==
X-Cc: longli@kernel.org, kotaranov@microsoft.com, kuba@kernel.org,
	davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
	andrew+netdev@lunn.ch, jgg@ziepe.ca, haiyangz@microsoft.com,
	wei.liu@kernel.org, decui@microsoft.com,
	shradhagupta@linux.microsoft.com, horms@kernel.org,
	ernis@linux.microsoft.com, stephen@networkplumber.org,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	gargaditya@linux.microsoft.com, kees+treewide@kernel.org,
	kees@kernel.org, mawasthi@linux.microsoft.com, weh@microsoft.com,
	edumazet@kernel.org, shacharr@microsoft.com
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <100c6b7a71e86c8d7afd0c55f6b231f01db184d5.1794751992.git.weh@linux.microsoft.com>