Article View: linux.kernel.netdev
Article #26432[PATCH net-next v8 0/2] dinghai: MSI-X interrupt pools and async event queue
From: han.junyang
Date: Thu, 03 Dec 2026 14:44
Date: Thu, 03 Dec 2026 14:44
147 lines
16540 bytes
16540 bytes
From: Junyang Han <han.junyang@zte.com.cn> This is v8 of the series. Patch 1 of v6 (firmware version check and RISC-V readiness polling) has been applied; this version contains the remaining two patches rebased on top of it. The first patch allocates the MSI-X vector layout and manages the vectors in per-purpose pools. The second creates the async event queue through which the firmware will report events. Some notes on the IRQ design: The vector space is partitioned into per-purpose pools (async, RDMA, vq). Event queues share a vector through an atomic notifier chain attached to the IRQ, and the sharing degree is governed by pool thresholds. The IRQ table hangs off a void *priv in the shared core device: the PF, MPF and SF core devices each carry a different pool layout behind that pointer, so a type-specific struct in en_pf.c keeps the shared header free of PF-only details. Changes in v8: - Include the en_pf.h and Makefile changes that add the IRQ table to the core device and build the new objects. v7 left them out, so patch 1 did not build on its own (kernel test robot). Changes in v7: - Patch 1: select the vector layout from the device ID, so that a VF requests the 20 vectors it exposes instead of the 78 of a PF, and check the MSI-X table size with pci_msix_vec_count() before the vectors are requested. DINGHAI_PF now depends on PCI_MSI. - Patch 1: keep the NVIDIA copyright notice on the IRQ pool code that is derived from mlx5's irq_affinity.c, remove the dead affinity == NULL branch, and make the comments and the overload message describe the sharing policy and its units correctly. - Patch 2: check the valid flag of the message header before using the event_id, and clear it once the message has been dispatched. Remove the unused eq_table lock. - The async event queue has no subscriber until the BAR message channel series; it is kept here because the vector allocation, the IRQ lifetime and the teardown order belong with the interrupt pools. Changes in v6: - Guard the IRQ table teardown in patch 2 rather than deferring the guards to patch 3, so the probe error paths of the MSI-X patch are safe on their own and bisection cannot land on an unguarded cleanup (sashiko review of v5). - Review findings not taken from v5: The sashiko automated review of v5 [1], which was not posted to the list, reported four findings. The IRQ table teardown NULL dereferences on the probe error paths were real and are fixed in this revision. The remaining three restate earlier findings or do not apply: the BAR0 bounds item repeats the BAR 0 entry below; the 20 s legacy wait is the legacy-firmware detection itself: firmware that predates the compat region never populates it and the driver reports and proceeds in legacy mode after the timeout (see Changes in v4); and the health_version read cannot race the RISC-V core initialization: the readiness skip fires only for firmware with patch < ZXDH_HPIRQ_PATCH, which never reports the power-on flag, while firmware that does report health_version carries patch >= ZXDH_HPIRQ_PATCH and initializes the health buffer before the compat block reports ready. [1] https://sashiko.dev/#/patchset/20261014151200489685SCIlolykW0NGfL5EtQ%40zte.com.cn Changes in v5: - Drop __packed from zxdh_fw_compat and zxdh_health_buffer: both structs are naturally aligned with no padding. Changes in v4: - Fold the irq and eq table create() steps into their init() counterparts and route every probe error path through the same destroy() functions remove() uses, so cleanup has a single authority from the start (review feedback on v3). - Give the pool name a buffer bound of its own (16 bytes) instead of sharing the 100-byte IRQ name buffer, so W=1 builds stay clean of -Wformat-truncation (review feedback on v3). - Lower the compat region wait from 200 s to 20 s: the firmware publishes the block within 10 s of boot, so twice that leaves margin, and the wait now sits far below the 180 s udev event window raised on the thread (review feedback on v3). - Wait for the compat block with a per-field readiness check instead of only the first dword: the firmware fills the fields one by one, and a dword-granular check can read a half-populated block (the "single write" justification given in v3 was wrong). - Log the legacy-firmware assumption when the compat region wait times out, making the intentionally ignored timeout visible. Changes in v3: - Unmap the modern config MMIO regions on the probe error paths added in this series; they used to leak when the fw compat check or the RISC-V readiness wait failed. - Skip the RISC-V readiness wait for firmware without the compat region: the erased patch field read as 0xffff and defeated the skip. - Make fw_minor unsigned so firmware minor versions >= 128 are not rejected through sign wrap. - Balance the per-CPU IRQ accounting on release, so pool teardown does not trip its leftover WARN; set the IRQ affinity for real with irq_set_affinity_and_hint() instead of only updating the hint; name IRQs after their pool instead of a hardcoded prefix; assert that the pool is empty at free instead of force-releasing leftovers. - Clear eq->irq when the async IRQ request fails, so teardown does not treat the ERR_PTR as a live IRQ. Review findings not taken: - xa_alloc() with a NULL entry does not fail: __xa_alloc() turns a NULL entry into the internal zero entry as a reservation (lib/xarray.c), which is the reservation semantics the pool relies on. - BAR 0 length checks against a truncated bar: the bar layout is part of the board firmware contract and the driver does not defend against a broken device, as settled during the review of the earlier device bring-up series (Andrew Lunn). - IRQF_NO_AUTOEN on the async vector: no firmware notification is expected before the BAR message channel handshake lands. The series that adds the first consumer will switch to it then. Changes in v2: - Convert both firmware readiness polls to readx_poll_timeout() (Andrew Lunn). - Read the fw compat block field by field through ioread*() accessors instead of an ioread32_rep() bulk copy, which misplaces the u8/u16 fields on big-endian; no __le annotations are needed since each accessor converts from little-endian (Andrew Lunn). - Use kref for the IRQ reference count (Andrew Lunn). Junyang Han (2): dinghai: add MSI-X interrupt pools dinghai: add async event queue for firmware notifications drivers/net/ethernet/zte/dinghai/Kconfig | 1 + drivers/net/ethernet/zte/dinghai/Makefile | 2 +- drivers/net/ethernet/zte/dinghai/en_pf.c | 120 ++++++ drivers/net/ethernet/zte/dinghai/en_pf.h | 10 + drivers/net/ethernet/zte/dinghai/zxdh_eq.c | 142 +++++++ drivers/net/ethernet/zte/dinghai/zxdh_eq.h | 62 +++ drivers/net/ethernet/zte/dinghai/zxdh_irq.c | 401 ++++++++++++++++++++ drivers/net/ethernet/zte/dinghai/zxdh_irq.h | 77 ++++ 8 files changed, 814 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_eq.c create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_eq.h create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_irq.c create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_irq.h -- 2.27.0
Technical Details
Message-ID:
<202612032244071171OAGR9IOCOfB74ztF1sEb@zte.com.cn>Path:
mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376671-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376671-linux-kernel-netdev=dewy.ru
From: han.junyang@zte.com.cn
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v8 0/2] dinghai: MSI-X interrupt pools and async event queue
Date: Thu, 3 Dec 2026 22:44:07 +0800 (CST)
Organization: Usenet Network
Message-ID: <202612032244071171OAGR9IOCOfB74ztF1sEb@zte.com.cn>
MIME-Version: 1.0
Content-Type: text/plain;
charset="UTF-8"
Injection-Info: usenet.network;
logging-data="2517202"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Q8BiDQLZ1OQBbFlkvW+R8jq30z4= sha256:Mm64RHti6Bae1wiJhHp55t81lWaEOwTyUJv7ohq6bkE=
sha1:Y6h1c3iACc8pgah1dnwU+6nlyU8= sha256:lqBNRXY35LnHYW2avLuonLoJXnobHA6LUc3xm2If7n8=
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 C4D97117986; Thu, 3 Dec 2026 17:44:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.298
X-Spam-Status: No, score=-3.298 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=zte.com.cn
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 5OhdwbGmjvd6;
Thu, 3 Dec 2026 17:44:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376671-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=zte.com.cn
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id C3841117981; Thu, 3 Dec 2026 17:44:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id DCA142E21F; Thu, 3 Dec 2026 14:44:22 +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=1796309062;
b=Gb5YOI/hrEhwDURF22v42cxq8+TqaPbwI7qB4ORe3V2tk6BsYcp3eIUZMf89zh01mCrk
TiAduB580/USJuttV0bYmIyZHVPb4GExQ5BSDFyb9iavghORDARbInAKmSBVt2OL3DlVR
SRb2L6t4cSXSCbflpPJm7k+CxbOSsklagn0H2b8h+EaNrGJUsG/eM7MarcxnrDKfM6Kyb
S6WQeLrBeqwyXej1mHThf4WuTdnJdqIL+G1FUGIxZk4rcC22xqG+WejSZyL8t/TRXei94
yu2GfmRvhM2GdYxS7bAgGCW5wkYhjD0TKFJ+V/8w9QH8/FajM6uvOd0FGUNNVhBcPMw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796309062;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
Received:X-Zmail-TransId:X-Mailer:Message-ID:Date:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:Mime-Version:From:To:Cc:Subject:Content-Type:
X-MAIL:X-TLS:X-ENVELOPE-SENDER:X-SOURCE-IP:X-CLEAN:
X-Fangmail-Anti-Spam-Filtered:X-Fangmail-MID-QID;
bh=mmGxcC8NbzywPzR8Lk3x2qIYbvrB7APKqNJWCT5881U=;
b=H1oB7CTnu66mtsS8XKiTbnIfY2XM1Wqn7lHWDrXpPqIRey542Z7bB0rgV4cJN2GcDLtH
R6HjdYGLrJQXEmqE0j90bxBCNhcxOE/zR4f4mjfYiYhuIp3tHrmzjQqWqSybxOuKbsbFh
pPzQugh4sAZvOsxE4iuVzIPLFieGcKROo9T8maYTKP4jsmft1/xV/15lFAXKs2mFRjbYL
WQ+joR0I8+/0W8r0HtwOK8396WEwMNPuTUm5cqxYmrMKMSEqaAPsbfTkApW2QZW5YWMBr
Yc9nmE09CYKRB6B8ltaEE3ODH8mnBZAko2CkSbDTiaaMd5mGvO9xf6KnVW1f9Pafnsw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=zte.com.cn header.i=@zte.com.cn header.a=rsa-sha256 header.s=z202610 header.b=yyqdV3jy;
dmarc=pass header.from=zte.com.cn;
spf=pass smtp.mailfrom=zte.com.cn;
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 3E087606A339;
Thu, 3 Dec 2026 14:44:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=zte.com.cn header.i=@zte.com.cn header.a=rsa-sha256 header.s=z202610 header.b=yyqdV3jy
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=183.62.165.209
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796309061;
b=lfPg5fbdZ9Qvo54/h5/5LCl/ncWXIiBJOKbDuSicaXbHkFgx0w7uc1TAPOp7BiRBx1xL
+GrzmF1KcsyJBV3qh0hEYShLyJxfQIJY5SPJzUfS+o8gNowUVVDYAA9jaxRcNUdN+Bz+6
G2WNqcXfFppO8/X1PYqZDrfXGxw/coIMhLqPZZuJ3Lu9zejVNMRvdlUR5xfRNG+1uFh6n
dwkhVg2zhXQKBDlHbUu5iaTgXDl/toEsO6f/GyhOtV65WJfsBwakgzMyLYa7Ni3fTG8HS
5q/goWsy2EGQylcJqsbkcTAPbGI7ZdJaXiWCnLh53hGSkvrvdvvazu+39jUjusRf7ow==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796309061;
h=DMARC-Filter:Received:DKIM-Signature:Received:Received:
X-Zmail-TransId:X-Mailer:Message-ID:Date:Mime-Version:From:To:Cc:
Subject:Content-Type:X-MAIL:X-TLS:X-ENVELOPE-SENDER:X-SOURCE-IP:
X-CLEAN:X-Fangmail-Anti-Spam-Filtered:X-Fangmail-MID-QID;
bh=mmGxcC8NbzywPzR8Lk3x2qIYbvrB7APKqNJWCT5881U=;
b=xKcTfJlpXqRllXzyVcwxBALpAmE3X0KIaOJrqjKJjDxlo9Ye+BrbN0qjMh6L7izU9wl6
M4hhR/n1a0Vtk8KD2XQ9k1LKjZma4LU3+9O7fgHI8+7lqRyJn5rvYx8R5t+RB2Vb0NZVP
s9Es6j8x2Y4LeObpNOr+lW3881hVv9O6eWNOBFVLOv1reQ5RMFcwCluCExT23dydvVNCJ
yEDXpAJkXiF9cTvxcRCvjpyDaVkRInhyfTFKYYuHVxMuGUHLMMZ1ZVN2DYbGS1ClL5uW7
dg4n3ahdl5D8CkiUna6PlIUca1lcSZPlwNTlDVcu1qYxIA6rLbMiGqlLH6FD4UrjdcA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=zte.com.cn;
spf=pass smtp.mailfrom=zte.com.cn;
dkim=pass header.d=zte.com.cn header.i=@zte.com.cn header.a=rsa-sha256 header.s=z202610 header.b=yyqdV3jy;
arc=none smtp.remote-ip=183.62.165.209
X-Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 351EE606A322;
Thu, 3 Dec 2026 14:44:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 351EE606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn
X-Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
(No client certificate requested)
by mxct.zte.com.cn (FangMail) with ESMTPS id 4jgHSl2Rgnz5B7RN;
Thu, 03 Dec 2026 22:44:07 +0800 (CST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zte.com.cn;
s=z202610; t=1796309047;
bh=vfCWeqx5U3+zsN12r514ZBasugcagfZQtmsZn7WCLMw=;
h=Date:From:To:Cc:Subject;
b=yyqdV3jy+jTFK+aNTK/wf97NHR+l29FFtTpx0wbCIIcHaWy6QWFWZQaEF7d8dMJGr
t+WtNp8/6qfVZJsgTUMXpKjIvOvrVK4XZyLxtxVHsnFGZEIjgdAnZR1+bq2R13I4eW
xVI9gC3xUVeKuy9xPzM2zMatJGu4pFjuKDXBg63WX5De/Nvy/omk6CsGmyu2WIsLU/
+/9moFeiRk+YyBVxDk3sBLMlaMOxpFO8FDN9d2Dcth3+Wd6teciCb+OYq8jxfwMpB3
tFupU2+YqyHqMhssLtNz8CDJZYYpmKwZafDVxtfVPotQZ3wYPV21LA0EwuPXd9UIlo
wlWMWqQPH9pyA==
X-Received: from njb2app05.zte.com.cn ([10.55.22.121])
by mse-fl2.zte.com.cn with SMTP id 6B3Ei3uH045497;
Thu, 3 Dec 2026 22:44:03 +0800 (+08)
(envelope-from han.junyang@zte.com.cn)
X-Received: from mapi (njb2app07[null])
by mapi (Zmail) with MAPI id mid204;
Thu, 3 Dec 2026 22:44:07 +0800 (CST)
X-Zmail-TransId: 2aff6b118037118-b18b9
X-Mailer: Zmail v1.0
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-Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<han.junyang@zte.com.cn>, <ran.ming@zte.com.cn>,
<han.chengfei@zte.com.cn>, <zhang.yanze@zte.com.cn>
X-MAIL: mse-fl2.zte.com.cn 6B3Ei3uH045497
X-TLS: YES
X-ENVELOPE-SENDER: han.junyang@zte.com.cn
X-SOURCE-IP: 10.5.228.133 unknown Thu, 03 Dec 2026 22:44:07 +0800
X-CLEAN: YES
X-Fangmail-Anti-Spam-Filtered: true
X-Fangmail-MID-QID: 6B118037.000/4jgHSl2Rgnz5B7RN