Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Fix a bug that media change may fail. I no...



details:   https://anonhg.NetBSD.org/src/rev/8e32dca5247a
branches:  trunk
changeset: 366487:8e32dca5247a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Aug 29 09:03:14 2018 +0000

description:
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

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r 57a92dbc3461 -r 8e32dca5247a sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 29 06:28:50 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 29 09:03:14 2018 +0000
@@ -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 @@
        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 @@
                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 @@
                        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 */



Home | Main Index | Thread Index | Old Index