From: "Björn Töpel" <bjorn@kernel.org>
To: Alexander Duyck <alexanderduyck@fb.com>,
Jakub Kicinski <kuba@kernel.org>,
kernel-team@meta.com (reviewer:META ETHERNET DRIVERS),
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Björn Töpel" <bjorn@kernel.org>,
"Mike Marciniszyn (Meta)" <mike.marciniszyn@gmail.com>,
"Mina Almasry" <almasrymina@google.com>
Subject: [PATCH net v3 1/2] eth: fbnic: Preserve channels across resume
Date: Fri, 2 Oct 2026 14:56:14 +0200 [thread overview]
Message-ID: <20261002125617.409447-2-bjorn@kernel.org> (raw)
In-Reply-To: <20261002125617.409447-1-bjorn@kernel.org>
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
next prev parent reply other threads:[~2026-10-02 12:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-10-02 12:56 ` [PATCH net v3 2/2] eth: fbnic: Publish real queue counts Björn Töpel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261002125617.409447-2-bjorn@kernel.org \
--to=bjorn@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mike.marciniszyn@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®