From: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org
Subject: [PATCH iwl-net v2 2/4] ixgbe: Fix FCoE refcount taking for unsupported adapters
Date: Tue, 22 Sep 2026 11:35:56 +0000 [thread overview]
Message-ID: <20260922113558.2288111-3-sergey.temerkhanov@intel.com> (raw)
In-Reply-To: <20260922113558.2288111-1-sergey.temerkhanov@intel.com>
ixgbe_fcoe_enable() increments the FCoE reference count before
checking whether the device supports FCoE. The unsupported adapters
shall not take a reference while the ones which have FCoE already
enabled only need to skip hardware initialization.
Fixes: 27ab76065c0c ("ixgbe: add a refcnt when turning on/off FCoE offload capability")
Signed-off-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index 54d8b079ada4..6585af527743 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -838,15 +838,21 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
struct ixgbe_fcoe *fcoe = &adapter->fcoe;
bool running;
+ /* Unsupported adapters do not take a reference */
+ if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
+ return -EINVAL;
+
/* libfcoe calls ndo_fcoe_disable() even when this callback fails. */
atomic_inc(&fcoe->refcnt);
if (!netif_device_present(netdev))
return -ENETDOWN;
- if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
- return -EINVAL;
-
+ /* If offload is enabled, only skip HW init, but keep the reference.
+ * ixgbe_fcoe_disable() decreases the refcount for this case and only
+ * disables the offload when the refcount reaches 0. This handles the case
+ * where multiple offload interfaces are enabled on the same PF (e.g. VLANs)
+ */
if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
return -EINVAL;
@@ -892,6 +898,9 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
bool running;
+ if (!(adapter->flags & IXGBE_FLAG_FCOE_CAPABLE))
+ return -EINVAL;
+
if (!atomic_dec_and_test(&adapter->fcoe.refcnt))
return -EINVAL;
--
2.53.0
next prev parent reply other threads:[~2026-09-22 11:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 11:35 [PATCH iwl-net v2 0/4] ixgbe: fix FCoE/XDP issues and PCI reset handling Sergey Temerkhanov
2026-09-22 11:35 ` [PATCH iwl-net v2 1/4] ixgbe: Refactor device operations to check whether netdev is available Sergey Temerkhanov
2026-09-25 17:22 ` Simon Horman
2026-09-22 11:35 ` Sergey Temerkhanov [this message]
2026-09-25 17:23 ` [PATCH iwl-net v2 2/4] ixgbe: Fix FCoE refcount taking for unsupported adapters Simon Horman
2026-09-22 11:35 ` [PATCH iwl-net v2 3/4] ixgbe: Restore previous XDP program on ixgbe_setup_tc() failure Sergey Temerkhanov
2026-09-25 17:23 ` Simon Horman
2026-09-22 11:35 ` [PATCH iwl-net v2 4/4] ixgbe: Implement PCI reset handler Sergey Temerkhanov
2026-09-25 17:24 ` Simon Horman
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=20260922113558.2288111-3-sergey.temerkhanov@intel.com \
--to=sergey.temerkhanov@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
/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