* [PATCH net v3 0/2] eth: fbnic: Queue and channel count fixes
@ 2026-10-02 12:56 Björn Töpel
2026-10-02 12:56 ` [PATCH net v3 1/2] eth: fbnic: Preserve channels across resume Björn Töpel
2026-10-02 12:56 ` [PATCH net v3 2/2] eth: fbnic: Publish real queue counts Björn Töpel
0 siblings, 2 replies; 3+ messages in thread
From: Björn Töpel @ 2026-10-02 12:56 UTC (permalink / raw)
To: Alexander Duyck, Jakub Kicinski, reviewer:META ETHERNET DRIVERS,
Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Russell King, netdev, linux-kernel
Cc: Björn Töpel, Mike Marciniszyn (Meta), Mina Almasry
Two fixes for what fbnic tells the core about its queues.
Patch 1 keeps the channel layout across suspend. Resume rebuilt it
from the queue counts, turning standalone channels into combined ones
or dropping combined queues, even with an unchanged IRQ count.
Patch 2 publishes the real queue counts at probe and on "ethtool -L"
while down, instead of at the next open.
Resume with fewer IRQs than the layout needs now fails instead of
shrinking the layout. That case is left for a separate change.
Changes in v3:
- Split into two patches, one per bug, each blaming the commit that
introduced it.
- Keep num_napi across suspend instead of a separate num_napi_cfg.
- Drop the -ENOSPC check on resume, so an interface that is down no
longer fails resume. (Breno, Sashiko)
- Skip ndo_stop when no NAPI vectors are allocated.
- Drop Breno's Reviewed-by, since the resume path changed.
Changes in v2:
- Keep the configured NAPI count and restore it on resume. v1
recomputed it from the queue counts, which changed dedicated rx and
tx layouts even when the vector count was unchanged. (Breno,
Sashiko)
- Fail resume with -ENOSPC when fewer vectors come back than the
configured layout needs. (Sashiko)
- Fix the comment and commit message that did not match the code.
(Breno, Sashiko)
- Keep the RSS indirection reset in fbnic_netdev_alloc().
- Drop Breno's Reviewed-by, since the resume path changed.
v2: https://lore.kernel.org/netdev/20260924191817.1843726-1-bjorn@kernel.org/
v1: https://lore.kernel.org/netdev/20260915180859.4157646-1-bjorn@kernel.org/
Björn Töpel (2):
eth: fbnic: Preserve channels across resume
eth: fbnic: Publish real queue counts
.../net/ethernet/meta/fbnic/fbnic_ethtool.c | 7 ++++
.../net/ethernet/meta/fbnic/fbnic_netdev.c | 36 ++++++++++++++-----
.../net/ethernet/meta/fbnic/fbnic_netdev.h | 3 --
drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 9 -----
4 files changed, 34 insertions(+), 21 deletions(-)
base-commit: 71a77ab76e74131a101f4d2d2afb0dcbf81b4e3c
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net v3 1/2] eth: fbnic: Preserve channels across resume
2026-10-02 12:56 [PATCH net v3 0/2] eth: fbnic: Queue and channel count fixes Björn Töpel
@ 2026-10-02 12:56 ` Björn Töpel
2026-10-02 12:56 ` [PATCH net v3 2/2] eth: fbnic: Publish real queue counts Björn Töpel
1 sibling, 0 replies; 3+ messages in thread
From: Björn Töpel @ 2026-10-02 12:56 UTC (permalink / raw)
To: Alexander Duyck, Jakub Kicinski, reviewer:META ETHERNET DRIVERS,
Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Russell King, netdev, linux-kernel
Cc: Björn Töpel, Mike Marciniszyn (Meta), Mina Almasry
Suspend clears the configured NAPI count. Resume then reconstructs the
channel layout from queue counts, changing standalone channels into
combined ones or dropping combined queues despite unchanged IRQs.
Keep the selected NAPI count across suspend and reuse the layout on
resume. A failed recovery leaves no live NAPI vectors, so skip a
redundant stop rather than dereferencing them.
If fewer IRQs return, reopening still fails. Handle that separately.
Found by code inspection while reviewing the queue-count fix. The
layout change has not been reproduced on fbnic hardware.
Fixes: 3a481cc72673 ("eth: fbnic: support ring channel get and set while down")
Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 11 +++++++++--
drivers/net/ethernet/meta/fbnic/fbnic_netdev.h | 3 ---
drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 9 ---------
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index 10bf99be3f24..d1ed29312d54 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -86,6 +86,13 @@ static int fbnic_stop(struct net_device *netdev)
{
struct fbnic_net *fbn = netdev_priv(netdev);
+ /* Suspend frees NAPI vectors but keeps num_napi for resume.
+ * If recovery fails, netif_running() remains set; a later stop
+ * must not walk the freed vectors again.
+ */
+ if (!fbn->napi[0])
+ return 0;
+
fbnic_mac_free_irq(fbn->fbd);
phylink_suspend(fbn->phylink, fbnic_bmc_present(fbn->fbd));
@@ -702,8 +709,8 @@ static const struct netdev_stat_ops fbnic_stat_ops = {
.get_base_stats = fbnic_get_base_stats,
};
-void fbnic_reset_queues(struct fbnic_net *fbn,
- unsigned int tx, unsigned int rx)
+static void fbnic_reset_queues(struct fbnic_net *fbn,
+ unsigned int tx, unsigned int rx)
{
struct fbnic_dev *fbd = fbn->fbd;
unsigned int max_napis;
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
index eded20b0e9e4..ddf1b674737a 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
@@ -86,9 +86,6 @@ struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd);
void fbnic_netdev_free(struct fbnic_dev *fbd);
int fbnic_netdev_register(struct net_device *netdev);
void fbnic_netdev_unregister(struct net_device *netdev);
-void fbnic_reset_queues(struct fbnic_net *fbn,
- unsigned int tx, unsigned int rx);
-
void fbnic_set_ethtool_ops(struct net_device *dev);
int fbnic_ptp_setup(struct fbnic_dev *fbd);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
index c6698e3002a1..ec916c9f7faa 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
@@ -434,7 +434,6 @@ static int fbnic_pm_suspend(struct device *dev)
{
struct fbnic_dev *fbd = dev_get_drvdata(dev);
struct net_device *netdev = fbd->netdev;
- struct fbnic_net *fbn;
if (fbnic_init_failure(fbd))
goto null_uc_addr;
@@ -442,16 +441,11 @@ static int fbnic_pm_suspend(struct device *dev)
rtnl_lock();
netdev_lock(netdev);
- fbn = netdev_priv(netdev);
-
netif_device_detach(netdev);
if (netif_running(netdev))
netdev->netdev_ops->ndo_stop(netdev);
- /* The IRQs are about to be freed, so drop the napi vector count */
- fbn->num_napi = 0;
-
netdev_unlock(netdev);
rtnl_unlock();
@@ -519,9 +513,6 @@ static int __fbnic_pm_resume(struct device *dev)
fbn = netdev_priv(netdev);
- /* Reset the queues if needed */
- fbnic_reset_queues(fbn, fbn->num_tx_queues, fbn->num_rx_queues);
-
if (netif_running(netdev)) {
err = __fbnic_open(fbn);
/* On failure the vectors are freed, so drop the count */
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net v3 2/2] eth: fbnic: Publish real queue counts
2026-10-02 12:56 [PATCH net v3 0/2] eth: fbnic: Queue and channel count fixes Björn Töpel
2026-10-02 12:56 ` [PATCH net v3 1/2] eth: fbnic: Preserve channels across resume Björn Töpel
@ 2026-10-02 12:56 ` Björn Töpel
1 sibling, 0 replies; 3+ messages in thread
From: Björn Töpel @ 2026-10-02 12:56 UTC (permalink / raw)
To: Alexander Duyck, Jakub Kicinski, reviewer:META ETHERNET DRIVERS,
Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Russell King, netdev, linux-kernel
Cc: Björn Töpel, Mike Marciniszyn (Meta), Mina Almasry, Sashiko
fbnic exposes more queues than it configures until open, including
after ethtool -L while down. A memory provider can bind to an
unconfigured queue.
Publish the selected counts at probe and on offline channel changes.
Sashiko flagged the mismatch by code inspection; it was not reproduced
on physical hardware. Tested with fbnic QEMU on Debian sid: offline
ethtool -L changed RX/TX queues from 2 to 1 to 3. Reopening passed
DHCP and ping. Network selftests were not run.
Fixes: da43127a8edc ("eth: fbnic: support queue ops / zero-copy Rx")
Reported-by: Sashiko <netdev-bot+sashiko@kernel.org>
Link: https://lore.kernel.org/netdev/178915061000.219967.7726187707862333281@kernel.org/
Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
.../net/ethernet/meta/fbnic/fbnic_ethtool.c | 7 +++++
.../net/ethernet/meta/fbnic/fbnic_netdev.c | 29 +++++++++++++------
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
index 76e9a545bb16..b96354e56517 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
@@ -1631,6 +1631,13 @@ static int fbnic_set_channels(struct net_device *netdev,
return -EINVAL;
if (!netif_running(netdev)) {
+ unsigned int rxq = ch->rx_count + ch->combined_count;
+ unsigned int txq = ch->tx_count + ch->combined_count;
+
+ err = netif_set_real_num_queues(netdev, txq, rxq);
+ if (err)
+ return err;
+
fbnic_set_queues(fbn, ch, max_napis);
fbnic_reset_indir_tbl(fbn);
return 0;
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index d1ed29312d54..1e16e10f3505 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -709,11 +709,12 @@ static const struct netdev_stat_ops fbnic_stat_ops = {
.get_base_stats = fbnic_get_base_stats,
};
-static void fbnic_reset_queues(struct fbnic_net *fbn,
- unsigned int tx, unsigned int rx)
+static int fbnic_reset_queues(struct fbnic_net *fbn,
+ unsigned int tx, unsigned int rx)
{
struct fbnic_dev *fbd = fbn->fbd;
unsigned int max_napis;
+ int err;
max_napis = fbd->num_irqs - FBNIC_NON_NAPI_VECTORS;
@@ -724,6 +725,14 @@ static void fbnic_reset_queues(struct fbnic_net *fbn,
fbn->num_rx_queues = rx;
fbn->num_napi = max(tx, rx);
+
+ err = netif_set_real_num_queues(fbn->netdev, tx, rx);
+ if (err)
+ return err;
+
+ fbnic_reset_indir_tbl(fbn);
+
+ return 0;
}
/**
@@ -792,9 +801,9 @@ struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd)
if (default_queues > fbd->max_num_queues)
default_queues = fbd->max_num_queues;
- fbnic_reset_queues(fbn, default_queues, default_queues);
+ if (fbnic_reset_queues(fbn, default_queues, default_queues))
+ goto err_free_netdev;
- fbnic_reset_indir_tbl(fbn);
fbnic_rss_key_fill(fbn->rss_key);
fbnic_rss_init_en_mask(fbn);
@@ -839,13 +848,15 @@ struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd)
netif_tx_stop_all_queues(netdev);
- if (fbnic_phylink_create(netdev)) {
- free_netdev(netdev);
- fbd->netdev = NULL;
- return NULL;
- }
+ if (fbnic_phylink_create(netdev))
+ goto err_free_netdev;
return netdev;
+
+err_free_netdev:
+ free_netdev(netdev);
+ fbd->netdev = NULL;
+ return NULL;
}
static int fbnic_dsn_to_mac_addr(u64 dsn, char *addr)
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-02 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-02 12:56 [PATCH net v3 0/2] eth: fbnic: Queue and channel count fixes Björn Töpel
2026-10-02 12:56 ` [PATCH net v3 1/2] eth: fbnic: Preserve channels across resume Björn Töpel
2026-10-02 12:56 ` [PATCH net v3 2/2] eth: fbnic: Publish real queue counts Björn Töpel
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®