Module Name: src
Committed By: msaitoh
Date: Wed Aug 29 09:03:15 UTC 2018
Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c
Log Message:
Fix a bug that media change may fail. I noticed that ifconfig ixgN media XXX
took a 10 or more seconds on a Denverton machie. I occurred by trying take a
lock and timed out. The reason was that ixgbe_media_change() didn't take
CORE_LOCK. Do it.
This problem was from FreeBSD's pre-iflib ixgbe (I don't know whether this
problem really occurs on FreeBSD or not). Post-iflib ixgbe has no problem
because iflib_media_change() takes a lock.
XXX pullup-8
To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/ixgbe/ixgbe.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.163 src/sys/dev/pci/ixgbe/ixgbe.c:1.164
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.163 Fri Jul 6 02:36:35 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 29 09:03:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.163 2018/07/06 02:36:35 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.164 2018/08/29 09:03:14 msaitoh Exp $ */
/******************************************************************************
@@ -2843,6 +2843,7 @@ ixgbe_media_change(struct ifnet *ifp)
if (hw->phy.media_type == ixgbe_media_type_backplane)
return (EPERM);
+ IXGBE_CORE_LOCK(adapter);
/*
* We don't actually need to check against the supported
* media types of the adapter; ifmedia will take care of
@@ -2855,6 +2856,7 @@ ixgbe_media_change(struct ifnet *ifp)
if (err != IXGBE_SUCCESS) {
device_printf(adapter->dev, "Unable to determine "
"supported advertise speeds\n");
+ IXGBE_CORE_UNLOCK(adapter);
return (ENODEV);
}
speed |= link_caps;
@@ -2915,10 +2917,12 @@ ixgbe_media_change(struct ifnet *ifp)
adapter->advertise |= 1 << 5;
}
+ IXGBE_CORE_UNLOCK(adapter);
return (0);
invalid:
device_printf(adapter->dev, "Invalid media type!\n");
+ IXGBE_CORE_UNLOCK(adapter);
return (EINVAL);
} /* ixgbe_media_change */