* [PATCH net-next v7 0/2] dinghai: MSI-X interrupt pools and async event queue
@ 2026-12-02 15:23 han.junyang
2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
2026-12-02 15:29 ` [PATCH net-next v7 2/2] dinghai: add async event queue for firmware notifications han.junyang
0 siblings, 2 replies; 6+ messages in thread
From: han.junyang @ 2026-12-02 15:23 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, horms
Cc: linux-kernel, netdev, han.junyang, ran.ming, han.chengfei, zhang.yanze
From: Junyang Han <han.junyang@zte.com.cn>
This is v7 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 review feedback on both
patches is addressed below; one item is not taken and is listed under
Review findings not taken.
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 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).
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/en_pf.c | 121 ++++++
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 ++++
6 files changed, 804 insertions(+)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools
2026-12-02 15:23 [PATCH net-next v7 0/2] dinghai: MSI-X interrupt pools and async event queue han.junyang
@ 2026-12-02 15:26 ` han.junyang
2026-12-03 2:38 ` kernel test robot
` (2 more replies)
2026-12-02 15:29 ` [PATCH net-next v7 2/2] dinghai: add async event queue for firmware notifications han.junyang
1 sibling, 3 replies; 6+ messages in thread
From: han.junyang @ 2026-12-02 15:26 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, horms
Cc: linux-kernel, netdev, han.junyang, ran.ming, han.chengfei, zhang.yanze
From: Junyang Han <han.junyang@zte.com.cn>
Allocate the MSI-X vector layout of the device and manage the vectors in
per-purpose pools: the async event queues first, a range reserved for
RDMA in between and the vq queue pairs last. This series wires up the
async pool; the vq pool comes with the netdev series.
The pool hands out the least loaded matching IRQ while it is below the
pool minimum threshold and creates a new one otherwise; an existing IRQ
is shared again only once the pool is exhausted. With a minimum
threshold of zero the async pool gives every event queue its own vector
until all of them are in use. New IRQs are bound to the least loaded CPU
of the requested affinity mask, and interrupt delivery fans out through
an atomic notifier chain attached to the IRQ.
The layout is 78 vectors for a PF and 20 for a VF.
The pool and CPU spreading code is derived from mlx5's
drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c.
Signed-off-by: Junyang Han <han.junyang@zte.com.cn>
---
drivers/net/ethernet/zte/dinghai/Kconfig | 1 +
drivers/net/ethernet/zte/dinghai/en_pf.c | 121 ++++++
drivers/net/ethernet/zte/dinghai/zxdh_irq.c | 401 ++++++++++++++++++++
drivers/net/ethernet/zte/dinghai/zxdh_irq.h | 77 ++++
4 files changed, 600 insertions(+)
create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_irq.c
create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_irq.h
diff --git a/drivers/net/ethernet/zte/dinghai/Kconfig b/drivers/net/ethernet/zte/dinghai/Kconfig
index 121be3bf7707..116da81be064 100644
--- a/drivers/net/ethernet/zte/dinghai/Kconfig
+++ b/drivers/net/ethernet/zte/dinghai/Kconfig
@@ -22,6 +22,7 @@ if DINGHAI
config DINGHAI_PF
tristate "ZTE DingHai PF (Physical Function) driver"
+ depends on PCI_MSI
help
This driver supports ZTE DingHai PCI Express Ethernet
adapters (PF).
diff --git a/drivers/net/ethernet/zte/dinghai/en_pf.c b/drivers/net/ethernet/zte/dinghai/en_pf.c
index ddff9b0438fb..9ea6205d2975 100644
--- a/drivers/net/ethernet/zte/dinghai/en_pf.c
+++ b/drivers/net/ethernet/zte/dinghai/en_pf.c
@@ -8,6 +8,8 @@
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/iopoll.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
#include <net/devlink.h>
#include <linux/dma-mapping.h>
#include "en_pf.h"
@@ -27,6 +29,14 @@ static const struct pci_device_id zxdh_pf_pci_table[] = {
MODULE_DEVICE_TABLE(pci, zxdh_pf_pci_table);
+struct zxdh_pf_irq_table {
+ struct zxdh_irq_pool *async_pool;
+};
+
+/* IRQ compaction thresholds of the async pool, in number of queues. */
+#define ZXDH_PF_ASYNC_IRQ_MIN_COMP 0
+#define ZXDH_PF_ASYNC_IRQ_MAX_COMP 7
+
void *zxdh_core_alloc_priv(struct zxdh_core_dev *zxdh_dev, size_t size)
{
void *priv = kzalloc(size, GFP_KERNEL);
@@ -485,6 +495,99 @@ static int zxdh_pf_wait_riscv_ready(struct zxdh_core_dev *zxdh_dev)
return 0;
}
+/* is_virtfn is not set for VFs passed through to a guest. */
+static bool zxdh_pf_is_vf(struct zxdh_core_dev *zxdh_dev)
+{
+ return zxdh_dev->pdev->device == ZXDH_VF_DEVICE_ID;
+}
+
+static int zxdh_pf_async_channels(struct zxdh_core_dev *zxdh_dev)
+{
+ if (zxdh_pf_is_vf(zxdh_dev))
+ return ZXDH_VF_ASYNC_CHANNELS_NUM;
+
+ return ZXDH_ASYNC_CHANNELS_NUM;
+}
+
+static int zxdh_pf_irq_pools_init(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
+ struct zxdh_irq_pool *pool;
+
+ pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
+ "zxdh_pf_async", ZXDH_PF_ASYNC_IRQ_MIN_COMP,
+ ZXDH_PF_ASYNC_IRQ_MAX_COMP);
+ if (IS_ERR(pool))
+ return PTR_ERR(pool);
+
+ pf_irq_table->async_pool = pool;
+
+ return 0;
+}
+
+static void zxdh_pf_irq_pools_destroy(struct zxdh_pf_irq_table *pf_irq_table)
+{
+ if (pf_irq_table->async_pool)
+ zxdh_irq_pool_free(pf_irq_table->async_pool);
+}
+
+int zxdh_pf_irq_table_init(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_irq_table *table = &zxdh_dev->irq_table;
+ struct zxdh_pf_irq_table *priv;
+ int vec_count;
+ int total_vec;
+
+ priv = kvzalloc_obj(*priv, GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+ table->priv = priv;
+
+ if (zxdh_pf_is_vf(zxdh_dev))
+ total_vec = ZXDH_VF_VQS_CHANNELS_NUM +
+ ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
+ else
+ total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
+ ZXDH_RDMA_CHANNELS_NUM;
+
+ vec_count = pci_msix_vec_count(zxdh_dev->pdev);
+ if (vec_count < total_vec) {
+ dev_err(zxdh_dev->device,
+ "device provides %d MSI-X vectors, %d required\n",
+ vec_count, total_vec);
+ return vec_count < 0 ? vec_count : -ENOSPC;
+ }
+
+ total_vec = pci_alloc_irq_vectors(zxdh_dev->pdev, total_vec, total_vec,
+ PCI_IRQ_MSIX);
+ if (total_vec < 0) {
+ dev_err(zxdh_dev->device, "pci_alloc_irq_vectors failed: %d\n",
+ total_vec);
+ return total_vec;
+ }
+
+ return zxdh_pf_irq_pools_init(zxdh_dev);
+}
+
+void zxdh_pf_irq_table_destroy(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_irq_table *table = &zxdh_dev->irq_table;
+
+ if (table->priv)
+ zxdh_pf_irq_pools_destroy(table->priv);
+ kvfree(table->priv);
+ table->priv = NULL;
+ pci_free_irq_vectors(zxdh_dev->pdev);
+}
+
+/* Fetch a vector from the async pool for one async event queue. */
+struct zxdh_irq *zxdh_pf_async_irq_request(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
+
+ return zxdh_get_irq_of_pool(pf_irq_table->async_pool);
+}
+
static int zxdh_pf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct zxdh_core_dev *zxdh_dev;
@@ -533,10 +636,26 @@ static int zxdh_pf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto err_modern_cfg;
}
+ ret = zxdh_pf_irq_table_init(zxdh_dev);
+ if (ret) {
+ dev_err(&pdev->dev, "zxdh_pf_irq_table_init failed: %d\n", ret);
+ goto err_irq_table;
+ }
+
+ ret = zxdh_pf_eq_table_init(zxdh_dev);
+ if (ret) {
+ dev_err(&pdev->dev, "zxdh_pf_eq_table_init failed: %d\n", ret);
+ goto err_eq_table;
+ }
+
devlink_register(devlink);
return 0;
+err_eq_table:
+ zxdh_pf_eq_table_destroy(zxdh_dev);
+err_irq_table:
+ zxdh_pf_irq_table_destroy(zxdh_dev);
err_modern_cfg:
zxdh_pf_modern_cfg_uninit(zxdh_dev);
err_cfg_init:
@@ -554,6 +673,8 @@ static void zxdh_pf_remove(struct pci_dev *pdev)
struct devlink *devlink = priv_to_devlink(zxdh_dev);
devlink_unregister(devlink);
+ zxdh_pf_eq_table_destroy(zxdh_dev);
+ zxdh_pf_irq_table_destroy(zxdh_dev);
zxdh_pf_modern_cfg_uninit(zxdh_dev);
zxdh_pf_pci_close(zxdh_dev);
zxdh_core_free_priv(zxdh_dev);
diff --git a/drivers/net/ethernet/zte/dinghai/zxdh_irq.c b/drivers/net/ethernet/zte/dinghai/zxdh_irq.c
new file mode 100644
index 000000000000..44596319e670
--- /dev/null
+++ b/drivers/net/ethernet/zte/dinghai/zxdh_irq.c
@@ -0,0 +1,401 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * ZTE DingHai Ethernet driver - IRQ pool management
+ * Copyright (c) 2022-2026, ZTE Corporation.
+ * Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * Portions derived from drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c.
+ *
+ * Device vectors are managed in per-purpose pools. An IRQ carries a
+ * refcount so that several event queues can share one vector; on
+ * raise, the interrupt is fanned out through an atomic notifier chain
+ * attached to the IRQ.
+ */
+
+#include <linux/cpumask.h>
+#include <linux/device.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/xarray.h>
+
+#include "en_pf.h"
+#include "zxdh_irq.h"
+
+static void zxdh_cpu_put(struct zxdh_irq_pool *pool, int cpu)
+{
+ pool->irqs_per_cpu[cpu]--;
+}
+
+/* Release callback of the IRQ kref, called with pool->lock held. */
+static void zxdh_irq_release(struct kref *kref)
+{
+ struct zxdh_irq *irq = container_of(kref, struct zxdh_irq, refcount);
+ struct zxdh_irq_pool *pool = irq->pool;
+
+ lockdep_assert_held(&pool->lock);
+ xa_erase(&pool->irqs, irq->index);
+ zxdh_cpu_put(pool, cpumask_first(irq->mask));
+ /* free_irq() requires the affinity hint to be cleared before it is
+ * called; the asymmetry with the set path in zxdh_irq_alloc() is
+ * intentional.
+ */
+ irq_update_affinity_hint(irq->irqn, NULL);
+ free_cpumask_var(irq->mask);
+ free_irq(irq->irqn, irq);
+ kfree(irq);
+}
+
+/* Drop one reference; returns 1 if the IRQ was released. */
+static int zxdh_irq_put(struct zxdh_irq *irq)
+{
+ struct zxdh_irq_pool *pool = irq->pool;
+ int released;
+
+ mutex_lock(&pool->lock);
+ released = kref_put(&irq->refcount, zxdh_irq_release);
+ mutex_unlock(&pool->lock);
+
+ return released;
+}
+
+static int zxdh_irq_get(struct zxdh_irq *irq)
+{
+ return kref_get_unless_zero(&irq->refcount);
+}
+
+static irqreturn_t zxdh_irq_int_handler(int irq, void *data)
+{
+ struct zxdh_irq *zxdh_irq = data;
+
+ atomic_notifier_call_chain(&zxdh_irq->nh, 0, NULL);
+
+ return IRQ_HANDLED;
+}
+
+static struct zxdh_irq *zxdh_irq_alloc(struct zxdh_irq_pool *pool, int vecidx,
+ const struct cpumask *affinity)
+{
+ struct zxdh_core_dev *zxdh_dev = pool->dev;
+ struct zxdh_irq *irq;
+ int err;
+
+ irq = kzalloc_obj(*irq, GFP_KERNEL);
+ if (!irq)
+ return ERR_PTR(-ENOMEM);
+
+ irq->pool = pool;
+ irq->irqn = pci_irq_vector(zxdh_dev->pdev, vecidx);
+ if (irq->irqn < 0) {
+ err = irq->irqn;
+ goto err_irqn;
+ }
+
+ ATOMIC_INIT_NOTIFIER_HEAD(&irq->nh);
+ snprintf(irq->name, ZXDH_MAX_IRQ_NAME, "%s_%d@pci:%s", pool->name,
+ vecidx, pci_name(zxdh_dev->pdev));
+
+ err = request_irq(irq->irqn, zxdh_irq_int_handler, 0, irq->name, irq);
+ if (err) {
+ dev_err(zxdh_dev->device, "request_irq failed: %d\n", err);
+ goto err_irqn;
+ }
+
+ if (!zalloc_cpumask_var(&irq->mask, GFP_KERNEL)) {
+ dev_err(zxdh_dev->device, "zalloc_cpumask_var failed\n");
+ err = -ENOMEM;
+ goto err_cpumask;
+ }
+
+ cpumask_copy(irq->mask, affinity);
+ irq_set_affinity_and_hint(irq->irqn, irq->mask);
+
+ kref_init(&irq->refcount);
+ irq->index = vecidx;
+ err = xa_err(xa_store(&pool->irqs, irq->index, irq, GFP_KERNEL));
+ if (err) {
+ dev_err(zxdh_dev->device, "xa_store failed for irq %u: %d\n",
+ irq->index, err);
+ goto err_xa;
+ }
+
+ return irq;
+
+err_xa:
+ irq_update_affinity_hint(irq->irqn, NULL);
+ free_cpumask_var(irq->mask);
+err_cpumask:
+ free_irq(irq->irqn, irq);
+err_irqn:
+ kfree(irq);
+ return ERR_PTR(err);
+}
+
+int zxdh_irq_attach_nb(struct zxdh_irq *irq, struct notifier_block *nb)
+{
+ int err;
+
+ if (!zxdh_irq_get(irq))
+ return -ENOENT;
+
+ err = atomic_notifier_chain_register(&irq->nh, nb);
+ if (err)
+ zxdh_irq_put(irq);
+
+ return err;
+}
+
+int zxdh_irq_detach_nb(struct zxdh_irq *irq, struct notifier_block *nb)
+{
+ int err;
+
+ err = atomic_notifier_chain_unregister(&irq->nh, nb);
+ zxdh_irq_put(irq);
+
+ return err;
+}
+
+/* Release one or more IRQs back to their pool. */
+void zxdh_irqs_release_vectors(struct zxdh_irq **irqs, int nirqs)
+{
+ int i;
+
+ for (i = 0; i < nirqs; i++) {
+ synchronize_irq(irqs[i]->irqn);
+ zxdh_irq_put(irqs[i]);
+ }
+}
+
+static void zxdh_cpu_get(struct zxdh_irq_pool *pool, int cpu)
+{
+ pool->irqs_per_cpu[cpu]++;
+}
+
+/* Pick the least loaded online CPU within @req_mask and account one
+ * more IRQ on it.
+ */
+static int zxdh_cpu_get_least_loaded(struct zxdh_irq_pool *pool,
+ const struct cpumask *req_mask)
+{
+ int best_cpu = -1;
+ int cpu;
+
+ for_each_cpu_and(cpu, req_mask, cpu_online_mask) {
+ /* This CPU has no IRQs yet, no need to look further. */
+ if (!pool->irqs_per_cpu[cpu]) {
+ best_cpu = cpu;
+ break;
+ }
+ if (best_cpu < 0)
+ best_cpu = cpu;
+ if (pool->irqs_per_cpu[cpu] < pool->irqs_per_cpu[best_cpu])
+ best_cpu = cpu;
+ }
+
+ if (best_cpu < 0) {
+ dev_err(pool->dev->device,
+ "no online CPU in affinity mask (%*pbl)\n",
+ cpumask_pr_args(req_mask));
+ best_cpu = cpumask_first(cpu_online_mask);
+ }
+ pool->irqs_per_cpu[best_cpu]++;
+
+ return best_cpu;
+}
+
+/* Create a new IRQ from the pool and bind it to the requested mask. */
+static struct zxdh_irq *zxdh_irq_pool_request_irq(struct zxdh_irq_pool *pool,
+ const struct cpumask *req_mask)
+{
+ const struct cpumask *affinity = req_mask;
+ cpumask_var_t auto_mask;
+ struct zxdh_irq *irq;
+ u32 irq_index;
+ int err;
+
+ if (!zalloc_cpumask_var(&auto_mask, GFP_KERNEL))
+ return ERR_PTR(-ENOMEM);
+
+ err = xa_alloc(&pool->irqs, &irq_index, NULL, pool->xa_num_irqs,
+ GFP_KERNEL);
+ if (err) {
+ if (err == -EBUSY)
+ err = -EUSERS;
+ goto err_xa;
+ }
+
+ if (cpumask_weight(req_mask) > 1) {
+ /* Bind to the least loaded CPU of the request. */
+ cpumask_set_cpu(zxdh_cpu_get_least_loaded(pool, req_mask),
+ auto_mask);
+ affinity = auto_mask;
+ } else {
+ zxdh_cpu_get(pool, cpumask_first(req_mask));
+ }
+
+ irq = zxdh_irq_alloc(pool, irq_index, affinity);
+ if (IS_ERR(irq))
+ goto err_alloc;
+
+ free_cpumask_var(auto_mask);
+
+ return irq;
+
+err_alloc:
+ /* Undo the per-CPU accounting done above. */
+ zxdh_cpu_put(pool, cpumask_first(affinity));
+ xa_erase(&pool->irqs, irq_index);
+err_xa:
+ free_cpumask_var(auto_mask);
+ return err ? ERR_PTR(err) : irq;
+}
+
+/* Look for the IRQ with the smallest refcount whose affinity mask is a
+ * subset of the requested mask.
+ */
+static struct zxdh_irq *zxdh_irq_pool_find_least_loaded(struct zxdh_irq_pool *pool,
+ const struct cpumask *req_mask)
+{
+ struct zxdh_irq *irq = NULL;
+ struct zxdh_irq *iter;
+ unsigned long index;
+ int iter_refcount;
+
+ lockdep_assert_held(&pool->lock);
+ xa_for_each_range(&pool->irqs, index, iter,
+ pool->xa_num_irqs.min, pool->xa_num_irqs.max) {
+ iter_refcount = refcount_read(&iter->refcount.refcount);
+
+ /* Skip IRQs whose mask is not a subset of the request. */
+ if (!cpumask_subset(iter->mask, req_mask))
+ continue;
+ /* IRQ below the minimum threshold found, take it. */
+ if (iter_refcount < pool->min_threshold)
+ return iter;
+ if (!irq ||
+ iter_refcount < refcount_read(&irq->refcount.refcount))
+ irq = iter;
+ }
+
+ return irq;
+}
+
+/* Request an IRQ for the given mask: share the least loaded matching
+ * IRQ while it is below the pool minimum threshold, otherwise create a
+ * new one. An existing IRQ is only shared again once the pool is
+ * exhausted.
+ */
+static struct zxdh_irq *zxdh_irq_affinity_request(struct zxdh_irq_pool *pool,
+ const struct cpumask *req_mask)
+{
+ struct zxdh_irq *least_loaded_irq;
+ struct zxdh_irq *new_irq;
+
+ mutex_lock(&pool->lock);
+
+ least_loaded_irq = zxdh_irq_pool_find_least_loaded(pool, req_mask);
+ if (least_loaded_irq &&
+ refcount_read(&least_loaded_irq->refcount.refcount) < pool->min_threshold)
+ goto out;
+
+ /* No IRQ below the minimum threshold, try to create a new one. */
+ new_irq = zxdh_irq_pool_request_irq(pool, req_mask);
+ if (IS_ERR(new_irq)) {
+ if (!least_loaded_irq) {
+ mutex_unlock(&pool->lock);
+ return new_irq;
+ }
+ /* Could not create a new IRQ for the requested affinity,
+ * share the existing one.
+ */
+ dev_warn(pool->dev->device,
+ "irq pool %s exhausted, sharing irqs\n",
+ pool->name);
+ goto out;
+ }
+
+ least_loaded_irq = new_irq;
+ goto unlock;
+
+out:
+ /* Holding pool->lock keeps the IRQ alive, so this cannot fail. */
+ zxdh_irq_get(least_loaded_irq);
+ if (refcount_read(&least_loaded_irq->refcount.refcount) > pool->max_threshold)
+ dev_warn(pool->dev->device,
+ "irq %d overloaded, pool %s, %u EQs on this irq\n",
+ least_loaded_irq->irqn,
+ pool->name,
+ refcount_read(&least_loaded_irq->refcount.refcount) /
+ ZXDH_REFS_PER_EQ);
+unlock:
+ mutex_unlock(&pool->lock);
+
+ return least_loaded_irq;
+}
+
+/* Request an IRQ from the pool, spread over the online CPUs. */
+struct zxdh_irq *zxdh_get_irq_of_pool(struct zxdh_irq_pool *pool)
+{
+ cpumask_var_t req_mask;
+ struct zxdh_irq *irq;
+
+ if (!zalloc_cpumask_var(&req_mask, GFP_KERNEL))
+ return ERR_PTR(-ENOMEM);
+ cpumask_copy(req_mask, cpu_online_mask);
+
+ irq = zxdh_irq_affinity_request(pool, req_mask);
+
+ free_cpumask_var(req_mask);
+
+ return irq;
+}
+
+struct zxdh_irq_pool *zxdh_irq_pool_alloc(struct zxdh_core_dev *zxdh_dev,
+ int start, int size, const char *name,
+ u32 min_threshold, u32 max_threshold)
+{
+ struct zxdh_irq_pool *pool;
+ u16 *irqs_per_cpu;
+
+ irqs_per_cpu = kcalloc(nr_cpu_ids, sizeof(*irqs_per_cpu), GFP_KERNEL);
+ if (!irqs_per_cpu)
+ return ERR_PTR(-ENOMEM);
+
+ pool = kvzalloc_obj(*pool, GFP_KERNEL);
+ if (!pool) {
+ kfree(irqs_per_cpu);
+ return ERR_PTR(-ENOMEM);
+ }
+
+ pool->dev = zxdh_dev;
+ pool->irqs_per_cpu = irqs_per_cpu;
+ mutex_init(&pool->lock);
+ xa_init_flags(&pool->irqs, XA_FLAGS_ALLOC);
+ pool->xa_num_irqs.min = start;
+ pool->xa_num_irqs.max = start + size - 1;
+ strscpy(pool->name, name, sizeof(pool->name));
+
+ /* Thresholds are expressed in queue references, two per queue. */
+ pool->min_threshold = min_threshold * ZXDH_REFS_PER_EQ;
+ pool->max_threshold = max_threshold * ZXDH_REFS_PER_EQ;
+
+ return pool;
+}
+
+void zxdh_irq_pool_free(struct zxdh_irq_pool *pool)
+{
+ u32 cpu;
+
+ WARN_ON_ONCE(!xa_empty(&pool->irqs));
+ xa_destroy(&pool->irqs);
+ mutex_destroy(&pool->lock);
+
+ if (pool->irqs_per_cpu) {
+ for_each_online_cpu(cpu)
+ WARN_ON(pool->irqs_per_cpu[cpu]);
+ kfree(pool->irqs_per_cpu);
+ }
+
+ kvfree(pool);
+}
diff --git a/drivers/net/ethernet/zte/dinghai/zxdh_irq.h b/drivers/net/ethernet/zte/dinghai/zxdh_irq.h
new file mode 100644
index 000000000000..fa8da8a036b7
--- /dev/null
+++ b/drivers/net/ethernet/zte/dinghai/zxdh_irq.h
@@ -0,0 +1,77 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * ZTE DingHai Ethernet driver - IRQ pool management
+ * Copyright (c) 2022-2026, ZTE Corporation.
+ */
+
+#ifndef __ZXDH_IRQ_H__
+#define __ZXDH_IRQ_H__
+
+#include <linux/cpumask.h>
+#include <linux/kref.h>
+#include <linux/mutex.h>
+#include <linux/notifier.h>
+#include <linux/types.h>
+#include <linux/xarray.h>
+
+struct zxdh_core_dev;
+
+/* Number of MSI-X vectors per purpose. The layout of the vector space
+ * is a hardware interface:
+ * [0, 8) async event queues
+ * [8, 14) reserved for RDMA (unused for now)
+ * [14, 78) vq rx/tx queue pairs
+ */
+#define ZXDH_ASYNC_CHANNELS_NUM 8
+#define ZXDH_RDMA_CHANNELS_NUM 6
+#define ZXDH_VQS_CHANNELS_NUM 64
+
+/* VFs expose a smaller table: async [0, 6), RDMA [6, 12), vq [12, 20). */
+#define ZXDH_VF_ASYNC_CHANNELS_NUM 6
+#define ZXDH_VF_VQS_CHANNELS_NUM 8
+
+#define ZXDH_MAX_IRQ_NAME 100
+#define ZXDH_MAX_POOL_NAME 16
+#define ZXDH_REFS_PER_EQ 2
+
+/* Reference counted interrupt. Event queues share an IRQ through the
+ * notifier chain, which is fired from hard IRQ context.
+ */
+struct zxdh_irq {
+ struct atomic_notifier_head nh;
+ cpumask_var_t mask; /* interrupt affinity */
+ char name[ZXDH_MAX_IRQ_NAME];
+ struct zxdh_irq_pool *pool;
+ u32 index; /* vector index */
+ int irqn; /* Linux IRQ number */
+ struct kref refcount;
+};
+
+/* Pool of vectors dedicated to one purpose, identified by the
+ * [xa_num_irqs.min, xa_num_irqs.max] vector range.
+ */
+struct zxdh_irq_pool {
+ char name[ZXDH_MAX_POOL_NAME];
+ struct xa_limit xa_num_irqs;
+ struct mutex lock; /* protects every field of this pool */
+ struct xarray irqs;
+ u32 min_threshold; /* in queue references */
+ u32 max_threshold; /* in queue references */
+ u16 *irqs_per_cpu; /* number of IRQs bound per CPU */
+ struct zxdh_core_dev *dev;
+};
+
+struct zxdh_irq_table {
+ void *priv;
+};
+
+struct zxdh_irq *zxdh_get_irq_of_pool(struct zxdh_irq_pool *pool);
+int zxdh_irq_attach_nb(struct zxdh_irq *irq, struct notifier_block *nb);
+int zxdh_irq_detach_nb(struct zxdh_irq *irq, struct notifier_block *nb);
+void zxdh_irqs_release_vectors(struct zxdh_irq **irqs, int nirqs);
+struct zxdh_irq_pool *zxdh_irq_pool_alloc(struct zxdh_core_dev *zxdh_dev,
+ int start, int size, const char *name,
+ u32 min_threshold, u32 max_threshold);
+void zxdh_irq_pool_free(struct zxdh_irq_pool *pool);
+
+#endif /* __ZXDH_IRQ_H__ */
--
2.27.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next v7 2/2] dinghai: add async event queue for firmware notifications
2026-12-02 15:23 [PATCH net-next v7 0/2] dinghai: MSI-X interrupt pools and async event queue han.junyang
2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
@ 2026-12-02 15:29 ` han.junyang
1 sibling, 0 replies; 6+ messages in thread
From: han.junyang @ 2026-12-02 15:29 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, horms
Cc: linux-kernel, netdev, han.junyang, ran.ming, han.chengfei, zhang.yanze
From: Junyang Han <han.junyang@zte.com.cn>
This adds an event queue table and one async event queue that receives
firmware notifications from the RISC-V management core. The queue takes
one MSI-X vector from the async pool, and the PF probe/remove paths
create and tear it down.
The interrupt handler reads the message header from the PF receive
sub-channel of the BAR message area and dispatches the event_id over the
per-event-type notifier chains. A header without the valid bit set does
not carry a new message and is ignored; after a message has been
dispatched the valid bit is cleared so that the firmware can post the
next one.
The BAR message channel handshake that tells the firmware which vectors
to signal comes with the BAR message subsystem in a later series.
Signed-off-by: Junyang Han <han.junyang@zte.com.cn>
---
drivers/net/ethernet/zte/dinghai/zxdh_eq.c | 142 +++++++++++++++++++++
drivers/net/ethernet/zte/dinghai/zxdh_eq.h | 62 +++++++++
2 files changed, 204 insertions(+)
create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_eq.c
create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_eq.h
diff --git a/drivers/net/ethernet/zte/dinghai/zxdh_eq.c b/drivers/net/ethernet/zte/dinghai/zxdh_eq.c
new file mode 100644
index 000000000000..ff18b70b4aef
--- /dev/null
+++ b/drivers/net/ethernet/zte/dinghai/zxdh_eq.c
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * ZTE DingHai Ethernet driver - event queue plumbing
+ * Copyright (c) 2022-2026, ZTE Corporation.
+ *
+ * Async event queues are the delivery path for firmware notifications:
+ * a queue owns one MSI-X vector of the async pool and fans interrupts
+ * out to the per-event-type notifier chains of the event queue table.
+ * The BAR message channel handshake that tells the firmware which
+ * vectors to signal comes with the BAR message subsystem in a later
+ * series; the PF side wired here is live as soon as that channel is
+ * enabled.
+ */
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/notifier.h>
+#include <linux/slab.h>
+
+#include "en_pf.h"
+#include "zxdh_eq.h"
+#include "zxdh_irq.h"
+
+/* PF side of the event queue table: one async EQ fed by the RISC-V
+ * management core.
+ */
+struct zxdh_pf_eq_table {
+ struct zxdh_eq_async riscv_eq;
+};
+
+static u32 zxdh_eq_hdr_get(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_pf_dev *pf_dev = zxdh_dev->priv;
+
+ return ioread32(pf_dev->pci_ioremap_addr[0] + ZXDH_BAR_MSG_SUBCHAN_RECV);
+}
+
+/* Clear the valid bit so that the firmware can post the next message. */
+static void zxdh_eq_hdr_release(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_pf_dev *pf_dev = zxdh_dev->priv;
+ void __iomem *subchan;
+ u32 hdr;
+
+ subchan = pf_dev->pci_ioremap_addr[0] + ZXDH_BAR_MSG_SUBCHAN_RECV;
+ hdr = ioread32(subchan);
+ hdr &= ~ZXDH_BAR_MSG_VALID;
+ iowrite32(hdr, subchan);
+}
+
+static enum zxdh_eq_event_type zxdh_eq_event_type_get(u16 event_id)
+{
+ if (event_id == ZXDH_MSG_MODULE_RISC_READY)
+ return ZXDH_EQ_EVENT_TYPE_RISCV_READY;
+
+ /* Only the RISC-V ready notification is dispatched in this
+ * series; the remaining firmware events arrive with the BAR
+ * message subsystem.
+ */
+ return ZXDH_EQ_EVENT_TYPE_MAX;
+}
+
+static int zxdh_eq_async_riscv_int(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ struct zxdh_eq_async *eq = container_of(nb, struct zxdh_eq_async, irq_nb);
+ struct zxdh_core_dev *zxdh_dev = eq->priv;
+ enum zxdh_eq_event_type event_type;
+ u32 hdr;
+
+ hdr = zxdh_eq_hdr_get(zxdh_dev);
+ if (!(hdr & ZXDH_BAR_MSG_VALID))
+ return NOTIFY_DONE;
+
+ event_type = zxdh_eq_event_type_get(ZXDH_BAR_MSG_EVENT_ID(hdr));
+ if (event_type != ZXDH_EQ_EVENT_TYPE_MAX)
+ atomic_notifier_call_chain(&zxdh_dev->eq_table.nh[event_type],
+ event_type, NULL);
+
+ zxdh_eq_hdr_release(zxdh_dev);
+
+ return NOTIFY_OK;
+}
+
+int zxdh_pf_eq_table_init(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_eq_table *table = &zxdh_dev->eq_table;
+ struct zxdh_pf_eq_table *priv;
+ struct zxdh_eq_async *eq;
+ int err;
+ int i;
+
+ priv = kvzalloc_obj(*priv, GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+ table->priv = priv;
+
+ for (i = 0; i < ZXDH_EQ_EVENT_TYPE_MAX; i++)
+ ATOMIC_INIT_NOTIFIER_HEAD(&table->nh[i]);
+
+ eq = &priv->riscv_eq;
+ eq->priv = zxdh_dev;
+ eq->irq = zxdh_pf_async_irq_request(zxdh_dev);
+ if (IS_ERR(eq->irq)) {
+ err = PTR_ERR(eq->irq);
+ goto err_irq;
+ }
+
+ eq->irq_nb.notifier_call = zxdh_eq_async_riscv_int;
+ err = zxdh_irq_attach_nb(eq->irq, &eq->irq_nb);
+ if (err)
+ goto err_attach;
+
+ return 0;
+
+err_attach:
+ zxdh_irqs_release_vectors(&eq->irq, 1);
+err_irq:
+ eq->irq = NULL;
+ return err;
+}
+
+void zxdh_pf_eq_table_destroy(struct zxdh_core_dev *zxdh_dev)
+{
+ struct zxdh_pf_eq_table *pf_eq_table = zxdh_dev->eq_table.priv;
+ struct zxdh_eq_table *table = &zxdh_dev->eq_table;
+ struct zxdh_eq_async *eq;
+
+ if (!pf_eq_table)
+ return;
+
+ eq = &pf_eq_table->riscv_eq;
+
+ if (eq->irq) {
+ zxdh_irq_detach_nb(eq->irq, &eq->irq_nb);
+ zxdh_irqs_release_vectors(&eq->irq, 1);
+ eq->irq = NULL;
+ }
+
+ kvfree(table->priv);
+ table->priv = NULL;
+}
diff --git a/drivers/net/ethernet/zte/dinghai/zxdh_eq.h b/drivers/net/ethernet/zte/dinghai/zxdh_eq.h
new file mode 100644
index 000000000000..c80c042877c3
--- /dev/null
+++ b/drivers/net/ethernet/zte/dinghai/zxdh_eq.h
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * ZTE DingHai Ethernet driver - event queue abstraction
+ * Copyright (c) 2022-2026, ZTE Corporation.
+ */
+
+#ifndef __ZXDH_EQ_H__
+#define __ZXDH_EQ_H__
+
+#include <linux/bits.h>
+#include <linux/notifier.h>
+
+struct zxdh_core_dev;
+struct zxdh_irq;
+
+/* BAR message area: shared-memory mailbox between the driver and the
+ * firmware, split into sub-channels of 2048 bytes. Notifications from
+ * the RISC-V management core are posted to the PF receive sub-channel,
+ * one interval above the area base.
+ */
+#define ZXDH_BAR_MSG_OFFSET 0x2000
+#define ZXDH_BAR_MSG_SUBCHAN_INTERVAL 2048
+#define ZXDH_BAR_MSG_SUBCHAN_RECV (ZXDH_BAR_MSG_OFFSET + \
+ ZXDH_BAR_MSG_SUBCHAN_INTERVAL)
+
+/* BAR message header: byte 0 carries the channel flags, the event_id
+ * sits at byte offset 2.
+ */
+#define ZXDH_BAR_MSG_VALID BIT(0)
+#define ZXDH_BAR_MSG_EVENT_ID(hdr) ((hdr) >> 16)
+
+/* event_id of the "RISC-V core ready" firmware notification. */
+#define ZXDH_MSG_MODULE_RISC_READY 13
+
+/* Event types the upper layers can subscribe to over the per-type
+ * notifier chains of the event queue table. The full catalogue lives
+ * in the firmware; only the ones dispatched in this series are named.
+ */
+enum zxdh_eq_event_type {
+ ZXDH_EQ_EVENT_TYPE_RISCV_READY = 0,
+ ZXDH_EQ_EVENT_TYPE_MAX,
+};
+
+/* Asynchronous event queue delivering firmware notifications to the
+ * driver without a request/reply handshake.
+ */
+struct zxdh_eq_async {
+ struct zxdh_irq *irq;
+ struct notifier_block irq_nb;
+ void *priv;
+};
+
+struct zxdh_eq_table {
+ /* Notifier chains fanned out by event type. */
+ struct atomic_notifier_head nh[ZXDH_EQ_EVENT_TYPE_MAX];
+ void *priv;
+};
+
+int zxdh_pf_eq_table_init(struct zxdh_core_dev *zxdh_dev);
+void zxdh_pf_eq_table_destroy(struct zxdh_core_dev *zxdh_dev);
+
+#endif /* __ZXDH_EQ_H__ */
--
2.27.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools
2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
@ 2026-12-03 2:38 ` kernel test robot
2026-12-03 2:51 ` kernel test robot
2026-12-03 3:56 ` kernel test robot
2 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-12-03 2:38 UTC (permalink / raw)
To: han.junyang, andrew+netdev, davem, edumazet, kuba, pabeni, horms
Cc: llvm, oe-kbuild-all, linux-kernel, netdev, han.junyang, ran.ming,
han.chengfei, zhang.yanze
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/han-junyang-zte-com-cn/dinghai-add-MSI-X-interrupt-pools/20261202-232629
base: net-next/main
patch link: https://lore.kernel.org/r/20261202232629423IClgIi_V1HMg3FsUgAUla%40zte.com.cn
patch subject: [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20261203/20261203103413.0xeXNirh-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project ed93dc8f7a98c7dfdbf6f203bf72e6e9a82cde3e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261203/20261203103413.0xeXNirh-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261203103413.0xeXNirh-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/net/ethernet/zte/dinghai/en_pf.c:507:10: error: use of undeclared identifier 'ZXDH_VF_ASYNC_CHANNELS_NUM'
507 | return ZXDH_VF_ASYNC_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/zte/dinghai/en_pf.c:509:9: error: use of undeclared identifier 'ZXDH_ASYNC_CHANNELS_NUM'
509 | return ZXDH_ASYNC_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/zte/dinghai/en_pf.c:514:53: error: no member named 'irq_table' in 'struct zxdh_core_dev'
514 | struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
| ~~~~~~~~ ^
>> drivers/net/ethernet/zte/dinghai/en_pf.c:517:9: error: call to undeclared function 'zxdh_irq_pool_alloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
517 | pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
| ^
>> drivers/net/ethernet/zte/dinghai/en_pf.c:517:7: error: incompatible integer to pointer conversion assigning to 'struct zxdh_irq_pool *' from 'int' [-Wint-conversion]
517 | pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
518 | "zxdh_pf_async", ZXDH_PF_ASYNC_IRQ_MIN_COMP,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
519 | ZXDH_PF_ASYNC_IRQ_MAX_COMP);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/zte/dinghai/en_pf.c:531:3: error: call to undeclared function 'zxdh_irq_pool_free'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
531 | zxdh_irq_pool_free(pf_irq_table->async_pool);
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c:536:44: error: no member named 'irq_table' in 'struct zxdh_core_dev'
536 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ~~~~~~~~ ^
>> drivers/net/ethernet/zte/dinghai/en_pf.c:544:7: error: incomplete definition of type 'struct zxdh_irq_table'
544 | table->priv = priv;
| ~~~~~^
drivers/net/ethernet/zte/dinghai/en_pf.c:536:9: note: forward declaration of 'struct zxdh_irq_table'
536 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^
>> drivers/net/ethernet/zte/dinghai/en_pf.c:547:15: error: use of undeclared identifier 'ZXDH_VF_VQS_CHANNELS_NUM'
547 | total_vec = ZXDH_VF_VQS_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:548:8: error: use of undeclared identifier 'ZXDH_VF_ASYNC_CHANNELS_NUM'
548 | ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/zte/dinghai/en_pf.c:548:37: error: use of undeclared identifier 'ZXDH_RDMA_CHANNELS_NUM'
548 | ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/zte/dinghai/en_pf.c:550:15: error: use of undeclared identifier 'ZXDH_VQS_CHANNELS_NUM'
550 | total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:550:39: error: use of undeclared identifier 'ZXDH_ASYNC_CHANNELS_NUM'
550 | total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:551:8: error: use of undeclared identifier 'ZXDH_RDMA_CHANNELS_NUM'
551 | ZXDH_RDMA_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/zte/dinghai/en_pf.c:534:5: warning: no previous prototype for function 'zxdh_pf_irq_table_init' [-Wmissing-prototypes]
534 | int zxdh_pf_irq_table_init(struct zxdh_core_dev *zxdh_dev)
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c:534:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
534 | int zxdh_pf_irq_table_init(struct zxdh_core_dev *zxdh_dev)
| ^
| static
drivers/net/ethernet/zte/dinghai/en_pf.c:574:44: error: no member named 'irq_table' in 'struct zxdh_core_dev'
574 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ~~~~~~~~ ^
drivers/net/ethernet/zte/dinghai/en_pf.c:576:11: error: incomplete definition of type 'struct zxdh_irq_table'
576 | if (table->priv)
| ~~~~~^
drivers/net/ethernet/zte/dinghai/en_pf.c:574:9: note: forward declaration of 'struct zxdh_irq_table'
574 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c:577:34: error: incomplete definition of type 'struct zxdh_irq_table'
577 | zxdh_pf_irq_pools_destroy(table->priv);
| ~~~~~^
drivers/net/ethernet/zte/dinghai/en_pf.c:574:9: note: forward declaration of 'struct zxdh_irq_table'
574 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c:578:14: error: incomplete definition of type 'struct zxdh_irq_table'
578 | kvfree(table->priv);
| ~~~~~^
drivers/net/ethernet/zte/dinghai/en_pf.c:574:9: note: forward declaration of 'struct zxdh_irq_table'
574 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c:579:7: error: incomplete definition of type 'struct zxdh_irq_table'
579 | table->priv = NULL;
| ~~~~~^
drivers/net/ethernet/zte/dinghai/en_pf.c:574:9: note: forward declaration of 'struct zxdh_irq_table'
574 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^
>> drivers/net/ethernet/zte/dinghai/en_pf.c:572:6: warning: no previous prototype for function 'zxdh_pf_irq_table_destroy' [-Wmissing-prototypes]
572 | void zxdh_pf_irq_table_destroy(struct zxdh_core_dev *zxdh_dev)
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c:572:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
572 | void zxdh_pf_irq_table_destroy(struct zxdh_core_dev *zxdh_dev)
| ^
| static
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
vim +/ZXDH_VF_ASYNC_CHANNELS_NUM +507 drivers/net/ethernet/zte/dinghai/en_pf.c
503
504 static int zxdh_pf_async_channels(struct zxdh_core_dev *zxdh_dev)
505 {
506 if (zxdh_pf_is_vf(zxdh_dev))
> 507 return ZXDH_VF_ASYNC_CHANNELS_NUM;
508
> 509 return ZXDH_ASYNC_CHANNELS_NUM;
510 }
511
512 static int zxdh_pf_irq_pools_init(struct zxdh_core_dev *zxdh_dev)
513 {
> 514 struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
515 struct zxdh_irq_pool *pool;
516
> 517 pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
518 "zxdh_pf_async", ZXDH_PF_ASYNC_IRQ_MIN_COMP,
519 ZXDH_PF_ASYNC_IRQ_MAX_COMP);
520 if (IS_ERR(pool))
521 return PTR_ERR(pool);
522
523 pf_irq_table->async_pool = pool;
524
525 return 0;
526 }
527
528 static void zxdh_pf_irq_pools_destroy(struct zxdh_pf_irq_table *pf_irq_table)
529 {
530 if (pf_irq_table->async_pool)
> 531 zxdh_irq_pool_free(pf_irq_table->async_pool);
532 }
533
> 534 int zxdh_pf_irq_table_init(struct zxdh_core_dev *zxdh_dev)
535 {
536 struct zxdh_irq_table *table = &zxdh_dev->irq_table;
537 struct zxdh_pf_irq_table *priv;
538 int vec_count;
539 int total_vec;
540
541 priv = kvzalloc_obj(*priv, GFP_KERNEL);
542 if (!priv)
543 return -ENOMEM;
> 544 table->priv = priv;
545
546 if (zxdh_pf_is_vf(zxdh_dev))
> 547 total_vec = ZXDH_VF_VQS_CHANNELS_NUM +
> 548 ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
549 else
> 550 total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
551 ZXDH_RDMA_CHANNELS_NUM;
552
553 vec_count = pci_msix_vec_count(zxdh_dev->pdev);
554 if (vec_count < total_vec) {
555 dev_err(zxdh_dev->device,
556 "device provides %d MSI-X vectors, %d required\n",
557 vec_count, total_vec);
558 return vec_count < 0 ? vec_count : -ENOSPC;
559 }
560
561 total_vec = pci_alloc_irq_vectors(zxdh_dev->pdev, total_vec, total_vec,
562 PCI_IRQ_MSIX);
563 if (total_vec < 0) {
564 dev_err(zxdh_dev->device, "pci_alloc_irq_vectors failed: %d\n",
565 total_vec);
566 return total_vec;
567 }
568
569 return zxdh_pf_irq_pools_init(zxdh_dev);
570 }
571
> 572 void zxdh_pf_irq_table_destroy(struct zxdh_core_dev *zxdh_dev)
573 {
574 struct zxdh_irq_table *table = &zxdh_dev->irq_table;
575
576 if (table->priv)
577 zxdh_pf_irq_pools_destroy(table->priv);
578 kvfree(table->priv);
579 table->priv = NULL;
580 pci_free_irq_vectors(zxdh_dev->pdev);
581 }
582
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools
2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
2026-12-03 2:38 ` kernel test robot
@ 2026-12-03 2:51 ` kernel test robot
2026-12-03 3:56 ` kernel test robot
2 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-12-03 2:51 UTC (permalink / raw)
To: han.junyang, andrew+netdev, davem, edumazet, kuba, pabeni, horms
Cc: oe-kbuild-all, linux-kernel, netdev, han.junyang, ran.ming,
han.chengfei, zhang.yanze
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/han-junyang-zte-com-cn/dinghai-add-MSI-X-interrupt-pools/20261202-232629
base: net-next/main
patch link: https://lore.kernel.org/r/20261202232629423IClgIi_V1HMg3FsUgAUla%40zte.com.cn
patch subject: [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20261203/20261203104704.ZrYQAe8h-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261203/20261203104704.ZrYQAe8h-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261203104704.ZrYQAe8h-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_async_channels':
drivers/net/ethernet/zte/dinghai/en_pf.c:507:24: error: 'ZXDH_VF_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
507 | return ZXDH_VF_ASYNC_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:507:24: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/zte/dinghai/en_pf.c:509:16: error: 'ZXDH_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
509 | return ZXDH_ASYNC_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_pools_init':
drivers/net/ethernet/zte/dinghai/en_pf.c:514:58: error: 'struct zxdh_core_dev' has no member named 'irq_table'
514 | struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:517:16: error: implicit declaration of function 'zxdh_irq_pool_alloc'; did you mean 'dma_pool_alloc'? [-Wimplicit-function-declaration]
517 | pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
| ^~~~~~~~~~~~~~~~~~~
| dma_pool_alloc
drivers/net/ethernet/zte/dinghai/en_pf.c:517:14: error: assignment to 'struct zxdh_irq_pool *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
517 | pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_pools_destroy':
drivers/net/ethernet/zte/dinghai/en_pf.c:531:17: error: implicit declaration of function 'zxdh_irq_pool_free' [-Wimplicit-function-declaration]
531 | zxdh_irq_pool_free(pf_irq_table->async_pool);
| ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: At top level:
drivers/net/ethernet/zte/dinghai/en_pf.c:534:5: warning: no previous prototype for 'zxdh_pf_irq_table_init' [-Wmissing-prototypes]
534 | int zxdh_pf_irq_table_init(struct zxdh_core_dev *zxdh_dev)
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_table_init':
drivers/net/ethernet/zte/dinghai/en_pf.c:536:49: error: 'struct zxdh_core_dev' has no member named 'irq_table'
536 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:544:14: error: invalid use of undefined type 'struct zxdh_irq_table'
544 | table->priv = priv;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:547:29: error: 'ZXDH_VF_VQS_CHANNELS_NUM' undeclared (first use in this function)
547 | total_vec = ZXDH_VF_VQS_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:548:29: error: 'ZXDH_VF_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
548 | ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:548:58: error: 'ZXDH_RDMA_CHANNELS_NUM' undeclared (first use in this function)
548 | ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:550:29: error: 'ZXDH_VQS_CHANNELS_NUM' undeclared (first use in this function)
550 | total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:550:53: error: 'ZXDH_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
550 | total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: At top level:
drivers/net/ethernet/zte/dinghai/en_pf.c:572:6: warning: no previous prototype for 'zxdh_pf_irq_table_destroy' [-Wmissing-prototypes]
572 | void zxdh_pf_irq_table_destroy(struct zxdh_core_dev *zxdh_dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_table_destroy':
drivers/net/ethernet/zte/dinghai/en_pf.c:574:49: error: 'struct zxdh_core_dev' has no member named 'irq_table'
574 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:576:18: error: invalid use of undefined type 'struct zxdh_irq_table'
576 | if (table->priv)
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:577:48: error: invalid use of undefined type 'struct zxdh_irq_table'
577 | zxdh_pf_irq_pools_destroy(table->priv);
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:578:21: error: invalid use of undefined type 'struct zxdh_irq_table'
578 | kvfree(table->priv);
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:579:14: error: invalid use of undefined type 'struct zxdh_irq_table'
579 | table->priv = NULL;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c: At top level:
drivers/net/ethernet/zte/dinghai/en_pf.c:584:18: warning: no previous prototype for 'zxdh_pf_async_irq_request' [-Wmissing-prototypes]
584 | struct zxdh_irq *zxdh_pf_async_irq_request(struct zxdh_core_dev *zxdh_dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_async_irq_request':
drivers/net/ethernet/zte/dinghai/en_pf.c:586:58: error: 'struct zxdh_core_dev' has no member named 'irq_table'
586 | struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:588:16: error: implicit declaration of function 'zxdh_get_irq_of_pool' [-Wimplicit-function-declaration]
588 | return zxdh_get_irq_of_pool(pf_irq_table->async_pool);
| ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:588:16: error: returning 'int' from a function with return type 'struct zxdh_irq *' makes pointer from integer without a cast [-Wint-conversion]
588 | return zxdh_get_irq_of_pool(pf_irq_table->async_pool);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_probe':
drivers/net/ethernet/zte/dinghai/en_pf.c:645:15: error: implicit declaration of function 'zxdh_pf_eq_table_init'; did you mean 'zxdh_pf_irq_table_init'? [-Wimplicit-function-declaration]
645 | ret = zxdh_pf_eq_table_init(zxdh_dev);
| ^~~~~~~~~~~~~~~~~~~~~
| zxdh_pf_irq_table_init
drivers/net/ethernet/zte/dinghai/en_pf.c:656:9: error: implicit declaration of function 'zxdh_pf_eq_table_destroy'; did you mean 'zxdh_pf_irq_table_destroy'? [-Wimplicit-function-declaration]
656 | zxdh_pf_eq_table_destroy(zxdh_dev);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| zxdh_pf_irq_table_destroy
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_async_channels':
>> drivers/net/ethernet/zte/dinghai/en_pf.c:510:1: warning: control reaches end of non-void function [-Wreturn-type]
510 | }
| ^
vim +510 drivers/net/ethernet/zte/dinghai/en_pf.c
503
504 static int zxdh_pf_async_channels(struct zxdh_core_dev *zxdh_dev)
505 {
506 if (zxdh_pf_is_vf(zxdh_dev))
507 return ZXDH_VF_ASYNC_CHANNELS_NUM;
508
509 return ZXDH_ASYNC_CHANNELS_NUM;
> 510 }
511
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools
2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
2026-12-03 2:38 ` kernel test robot
2026-12-03 2:51 ` kernel test robot
@ 2026-12-03 3:56 ` kernel test robot
2 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-12-03 3:56 UTC (permalink / raw)
To: han.junyang, andrew+netdev, davem, edumazet, kuba, pabeni, horms
Cc: oe-kbuild-all, linux-kernel, netdev, han.junyang, ran.ming,
han.chengfei, zhang.yanze
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/han-junyang-zte-com-cn/dinghai-add-MSI-X-interrupt-pools/20261202-232629
base: net-next/main
patch link: https://lore.kernel.org/r/20261202232629423IClgIi_V1HMg3FsUgAUla%40zte.com.cn
patch subject: [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools
config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20261203/20261203114347.bKDWYQkV-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261203/20261203114347.bKDWYQkV-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261203114347.bKDWYQkV-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_async_channels':
drivers/net/ethernet/zte/dinghai/en_pf.c:507:24: error: 'ZXDH_VF_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
507 | return ZXDH_VF_ASYNC_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:507:24: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/zte/dinghai/en_pf.c:509:16: error: 'ZXDH_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
509 | return ZXDH_ASYNC_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_pools_init':
drivers/net/ethernet/zte/dinghai/en_pf.c:514:58: error: 'struct zxdh_core_dev' has no member named 'irq_table'
514 | struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:517:16: error: implicit declaration of function 'zxdh_irq_pool_alloc'; did you mean 'dma_pool_alloc'? [-Wimplicit-function-declaration]
517 | pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
| ^~~~~~~~~~~~~~~~~~~
| dma_pool_alloc
drivers/net/ethernet/zte/dinghai/en_pf.c:517:14: error: assignment to 'struct zxdh_irq_pool *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
517 | pool = zxdh_irq_pool_alloc(zxdh_dev, 0, zxdh_pf_async_channels(zxdh_dev),
| ^
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_pools_destroy':
drivers/net/ethernet/zte/dinghai/en_pf.c:531:17: error: implicit declaration of function 'zxdh_irq_pool_free' [-Wimplicit-function-declaration]
531 | zxdh_irq_pool_free(pf_irq_table->async_pool);
| ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: At top level:
>> drivers/net/ethernet/zte/dinghai/en_pf.c:534:5: warning: no previous prototype for 'zxdh_pf_irq_table_init' [-Wmissing-prototypes]
534 | int zxdh_pf_irq_table_init(struct zxdh_core_dev *zxdh_dev)
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_table_init':
drivers/net/ethernet/zte/dinghai/en_pf.c:536:49: error: 'struct zxdh_core_dev' has no member named 'irq_table'
536 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:544:14: error: invalid use of undefined type 'struct zxdh_irq_table'
544 | table->priv = priv;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:547:29: error: 'ZXDH_VF_VQS_CHANNELS_NUM' undeclared (first use in this function)
547 | total_vec = ZXDH_VF_VQS_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:548:29: error: 'ZXDH_VF_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
548 | ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:548:58: error: 'ZXDH_RDMA_CHANNELS_NUM' undeclared (first use in this function)
548 | ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:550:29: error: 'ZXDH_VQS_CHANNELS_NUM' undeclared (first use in this function)
550 | total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:550:53: error: 'ZXDH_ASYNC_CHANNELS_NUM' undeclared (first use in this function)
550 | total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: At top level:
>> drivers/net/ethernet/zte/dinghai/en_pf.c:572:6: warning: no previous prototype for 'zxdh_pf_irq_table_destroy' [-Wmissing-prototypes]
572 | void zxdh_pf_irq_table_destroy(struct zxdh_core_dev *zxdh_dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_irq_table_destroy':
drivers/net/ethernet/zte/dinghai/en_pf.c:574:49: error: 'struct zxdh_core_dev' has no member named 'irq_table'
574 | struct zxdh_irq_table *table = &zxdh_dev->irq_table;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:576:18: error: invalid use of undefined type 'struct zxdh_irq_table'
576 | if (table->priv)
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:577:48: error: invalid use of undefined type 'struct zxdh_irq_table'
577 | zxdh_pf_irq_pools_destroy(table->priv);
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:578:21: error: invalid use of undefined type 'struct zxdh_irq_table'
578 | kvfree(table->priv);
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:579:14: error: invalid use of undefined type 'struct zxdh_irq_table'
579 | table->priv = NULL;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c: At top level:
>> drivers/net/ethernet/zte/dinghai/en_pf.c:584:18: warning: no previous prototype for 'zxdh_pf_async_irq_request' [-Wmissing-prototypes]
584 | struct zxdh_irq *zxdh_pf_async_irq_request(struct zxdh_core_dev *zxdh_dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_async_irq_request':
drivers/net/ethernet/zte/dinghai/en_pf.c:586:58: error: 'struct zxdh_core_dev' has no member named 'irq_table'
586 | struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
| ^~
drivers/net/ethernet/zte/dinghai/en_pf.c:588:16: error: implicit declaration of function 'zxdh_get_irq_of_pool' [-Wimplicit-function-declaration]
588 | return zxdh_get_irq_of_pool(pf_irq_table->async_pool);
| ^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c:588:16: error: returning 'int' from a function with return type 'struct zxdh_irq *' makes pointer from integer without a cast [-Wint-conversion]
588 | return zxdh_get_irq_of_pool(pf_irq_table->async_pool);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/zte/dinghai/en_pf.c: In function 'zxdh_pf_probe':
drivers/net/ethernet/zte/dinghai/en_pf.c:645:15: error: implicit declaration of function 'zxdh_pf_eq_table_init'; did you mean 'zxdh_pf_irq_table_init'? [-Wimplicit-function-declaration]
645 | ret = zxdh_pf_eq_table_init(zxdh_dev);
| ^~~~~~~~~~~~~~~~~~~~~
| zxdh_pf_irq_table_init
drivers/net/ethernet/zte/dinghai/en_pf.c:656:9: error: implicit declaration of function 'zxdh_pf_eq_table_destroy'; did you mean 'zxdh_pf_irq_table_destroy'? [-Wimplicit-function-declaration]
656 | zxdh_pf_eq_table_destroy(zxdh_dev);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| zxdh_pf_irq_table_destroy
vim +/zxdh_pf_irq_table_init +534 drivers/net/ethernet/zte/dinghai/en_pf.c
533
> 534 int zxdh_pf_irq_table_init(struct zxdh_core_dev *zxdh_dev)
535 {
536 struct zxdh_irq_table *table = &zxdh_dev->irq_table;
537 struct zxdh_pf_irq_table *priv;
538 int vec_count;
539 int total_vec;
540
541 priv = kvzalloc_obj(*priv, GFP_KERNEL);
542 if (!priv)
543 return -ENOMEM;
544 table->priv = priv;
545
546 if (zxdh_pf_is_vf(zxdh_dev))
547 total_vec = ZXDH_VF_VQS_CHANNELS_NUM +
548 ZXDH_VF_ASYNC_CHANNELS_NUM + ZXDH_RDMA_CHANNELS_NUM;
549 else
550 total_vec = ZXDH_VQS_CHANNELS_NUM + ZXDH_ASYNC_CHANNELS_NUM +
551 ZXDH_RDMA_CHANNELS_NUM;
552
553 vec_count = pci_msix_vec_count(zxdh_dev->pdev);
554 if (vec_count < total_vec) {
555 dev_err(zxdh_dev->device,
556 "device provides %d MSI-X vectors, %d required\n",
557 vec_count, total_vec);
558 return vec_count < 0 ? vec_count : -ENOSPC;
559 }
560
561 total_vec = pci_alloc_irq_vectors(zxdh_dev->pdev, total_vec, total_vec,
562 PCI_IRQ_MSIX);
563 if (total_vec < 0) {
564 dev_err(zxdh_dev->device, "pci_alloc_irq_vectors failed: %d\n",
565 total_vec);
566 return total_vec;
567 }
568
569 return zxdh_pf_irq_pools_init(zxdh_dev);
570 }
571
> 572 void zxdh_pf_irq_table_destroy(struct zxdh_core_dev *zxdh_dev)
573 {
574 struct zxdh_irq_table *table = &zxdh_dev->irq_table;
575
576 if (table->priv)
577 zxdh_pf_irq_pools_destroy(table->priv);
578 kvfree(table->priv);
579 table->priv = NULL;
580 pci_free_irq_vectors(zxdh_dev->pdev);
581 }
582
583 /* Fetch a vector from the async pool for one async event queue. */
> 584 struct zxdh_irq *zxdh_pf_async_irq_request(struct zxdh_core_dev *zxdh_dev)
585 {
586 struct zxdh_pf_irq_table *pf_irq_table = zxdh_dev->irq_table.priv;
587
588 return zxdh_get_irq_of_pool(pf_irq_table->async_pool);
589 }
590
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-03 3:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 15:23 [PATCH net-next v7 0/2] dinghai: MSI-X interrupt pools and async event queue han.junyang
2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
2026-12-03 2:38 ` kernel test robot
2026-12-03 2:51 ` kernel test robot
2026-12-03 3:56 ` kernel test robot
2026-12-02 15:29 ` [PATCH net-next v7 2/2] dinghai: add async event queue for firmware notifications han.junyang
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®