summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-06-02 18:28:39 -0700
committerJakub Kicinski <kuba@kernel.org>2026-06-04 14:04:56 -0700
commitaf1737dab07c861c3de4576f19dcfbd8f2329eb8 (patch)
treec247d47962bd555673e46f5495e3f84e57ae8b6b
parentea8ea212d4154f8e445cf282e246c47649a18a59 (diff)
downloadlinux-af1737dab07c861c3de4576f19dcfbd8f2329eb8.tar.gz
linux-af1737dab07c861c3de4576f19dcfbd8f2329eb8.zip
scsi: fcoe: don't recurse on the netdev's ops lock
fcoe_link_speed_update() calls __ethtool_get_link_ksettings() on the lport's netdev, which will soon take the dev's ops lock. Some notifier callers already arrive with this lock held. Switch to netif_get_link_ksettings() and adjust the explicit call sites to take the netdev lock explicitly. Within fcoe_device_notification() try to only query the link speed from notifiers which announce link state change (UP / CHANGE), DOWN / GOING_DOWN notifiers are slightly sketchy when it comes to ops locking right now, and the code already special-cases those by maintaining the local link_possible variable. Also take the lock in bnx2fc_net_config(), even though I think that bnx2fc call sites are largely irrelevant since it's not an ops-locked driver. Link: https://patch.msgid.link/20260603012840.2254293-11-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c3
-rw-r--r--drivers/scsi/fcoe/fcoe.c6
-rw-r--r--drivers/scsi/fcoe/fcoe_transport.c4
3 files changed, 10 insertions, 3 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 26e0ff380860..c95b084cad69 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -17,6 +17,7 @@
#include "bnx2fc.h"
#include <linux/ethtool.h>
+#include <net/netdev_lock.h>
static struct list_head adapter_list;
static struct list_head if_list;
@@ -815,7 +816,9 @@ static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev)
port->fcoe_pending_queue_active = 0;
timer_setup(&port->timer, fcoe_queue_timer, 0);
+ netdev_lock_ops(netdev);
fcoe_link_speed_update(lport);
+ netdev_unlock_ops(netdev);
if (!lport->vport) {
if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN))
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 534596c6d76c..438ac7c3a9e3 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -25,6 +25,7 @@
#include <scsi/scsicam.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
+#include <net/netdev_lock.h>
#include <net/rtnetlink.h>
#include <scsi/fc/fc_encaps.h>
@@ -737,7 +738,9 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
port->fcoe_pending_queue_active = 0;
timer_setup(&port->timer, fcoe_queue_timer, 0);
+ netdev_lock_ops(netdev);
fcoe_link_speed_update(lport);
+ netdev_unlock_ops(netdev);
if (!lport->vport) {
if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN))
@@ -1841,6 +1844,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
break;
case NETDEV_UP:
case NETDEV_CHANGE:
+ fcoe_link_speed_update(lport);
break;
case NETDEV_CHANGEMTU:
if (netdev->fcoe_mtu)
@@ -1871,8 +1875,6 @@ static int fcoe_device_notification(struct notifier_block *notifier,
"from netdev netlink\n", event);
}
- fcoe_link_speed_update(lport);
-
cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
if (link_possible && !fcoe_link_ok(lport)) {
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index 88d85fc9a52a..2bbb9a38e61d 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -111,6 +111,8 @@ static inline u32 eth2fc_speed(u32 eth_port_speed)
* fcoe_link_speed_update() - Update the supported and actual link speeds
* @lport: The local port to update speeds for
*
+ * Caller must hold the netdev's ops lock.
+ *
* Returns: 0 if the ethtool query was successful
* -1 if the ethtool query failed
*/
@@ -119,7 +121,7 @@ int fcoe_link_speed_update(struct fc_lport *lport)
struct net_device *netdev = fcoe_get_netdev(lport);
struct ethtool_link_ksettings ecmd;
- if (!__ethtool_get_link_ksettings(netdev, &ecmd)) {
+ if (!netif_get_link_ksettings(netdev, &ecmd)) {
lport->link_supported_speeds &= ~(FC_PORTSPEED_1GBIT |
FC_PORTSPEED_10GBIT |
FC_PORTSPEED_20GBIT |