From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F1E83921DD; Wed, 15 Jul 2026 03:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784086205; cv=none; b=GuasjNqZ8RZbT/sVbkMj8TEU62Y4z0MNCl13tIjHAJPWP/nDK3DcL/iIe/lJarBjNa9lZxvDs/3iZ83b/gmq9BnrHs4BJY6lC6GNBejReZqrHEMbezU6mwFnhOA/J84nTCI4+Mr8UItAvOjsVAcnrGnzj8lR2mKY9wMTYUA7oKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784086205; c=relaxed/simple; bh=XQHjrjwOb6CCDALTtfR4DOdZJaA9AaPWzpgyD1WW8jA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EK+Q9ngFCmzWWFd8BB7r4mviGZCwf9mQAjEBjTPKAJrU9T8RfEOqgYIVsanL3+4UfaUbmhEuWTf2q7jH3fsTbCLaW8AZe5xJIOCUrOxrOkiGQrwkTtnZA4NSjRkPJd2TQNY7JgDQE0SwsjvSQg4VdnMca8DCNYoBe1eptPaTrK0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1202) id 603E420B7167; Tue, 14 Jul 2026 20:29:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 603E420B7167 From: Long Li To: Long Li , Konstantin Taranov , Jakub Kicinski , "David S . Miller" , Paolo Abeni , Eric Dumazet , Andrew Lunn , Jason Gunthorpe , Leon Romanovsky , Haiyang Zhang , "K . Y . Srinivasan" , Wei Liu , Dexuan Cui , shradhagupta@linux.microsoft.com, Simon Horman Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 0/7] net: mana: harden the HWC and add dynamic queue depth Date: Tue, 14 Jul 2026 20:29:34 -0700 Message-ID: <20260715032942.3945317-1-longli@microsoft.com> X-Mailer: git-send-email 2.43.7 Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series hardens the MANA Hardware Channel (HWC) control-plane path and then builds on that to support a dynamic HWC queue depth. The HWC is the command channel the driver uses to talk to the device. Today it is created at a fixed depth of one outstanding request, and several of its lookup and teardown paths predate the RCU and DMA-lifetime rules they now need to follow. Raising the queue depth and allowing concurrent commands makes those latent races reachable, so the fixes come first and the feature builds on them. Patches 1-5 are fixes for pre-existing HWC bugs, each with a Fixes: tag: 1: cq_table was a plain pointer array freed with no grace period while the EQ interrupt handler dereferenced it; put it under RCU. 2: the HWC RQ and SQ were sized with each other's message size, so a response could overflow the RQ buffer and the RX slot stride was computed with the wrong size. 3: comp_buf was freed before the EQ was destroyed, so a late completion handler could touch freed memory. 4: the RX path consumed device-supplied lengths and indices without validation; validate them before use (this matters for confidential VMs, where the DMA buffer is shared with the host). 5: a failed mana_hwc_establish_channel() could leave live MST entries while the driver freed the queue buffers, and destroy_channel() freed the TXQ/RXQ before the EQ was quiesced; add a setup_active teardown gate and destroy the CQ first. Patches 6-7 add the feature: 6: replace the depth-1 semaphore with a slot bitmap and per-slot synchronization so several management commands can be in flight, with teardown that drains in-flight senders before freeing the HWC. 7: bootstrap the HWC at depth 1, query the device maximum and, if it is larger, tear down and rebuild the queues at that depth. The reported dimensions are validated before they size DMA allocations, and the capability is advertised so firmware enables it only when the driver supports it. The fixes are grouped ahead of the feature they enable rather than sent separately to net, since the HWC runs at depth 1 today and the races are reached only once the later patches raise the depth. Long Li (7): net: mana: RCU-protect gc->cq_table lookups against concurrent CQ destroy net: mana: fix HWC RQ/SQ buffer size swap net: mana: free HWC comp_buf after destroying the EQ net: mana: validate hardware-supplied values in the HWC RX path net: mana: fix HWC teardown safety with setup_active flag and destroy ordering net: mana: support concurrent HWC requests with proper synchronization net: mana: add dynamic HWC queue depth with reinit path drivers/infiniband/hw/mana/cq.c | 46 +- .../net/ethernet/microsoft/mana/gdma_main.c | 78 +- .../net/ethernet/microsoft/mana/hw_channel.c | 707 ++++++++++++++++-- drivers/net/ethernet/microsoft/mana/mana_en.c | 22 +- include/net/mana/gdma.h | 48 +- include/net/mana/hw_channel.h | 40 +- 6 files changed, 849 insertions(+), 92 deletions(-) base-commit: f6f3b36c15ed44de1fbb44e645e4fae8c4a4453e -- 2.43.0