Module Name:    src
Committed By:   martin
Date:           Wed Sep  5 08:42:22 UTC 2018

Modified Files:
        src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1006):

        sys/dev/pci/ixgbe/ixgbe.c: revision 1.164

  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.88.2.22 -r1.88.2.23 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.88.2.22 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.23
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.22	Tue Aug  7 13:33:23 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Sep  5 08:42:22 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.22 2018/08/07 13:33:23 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.23 2018/09/05 08:42:22 martin Exp $ */
 
 /******************************************************************************
 
@@ -2841,6 +2841,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
@@ -2853,6 +2854,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;
@@ -2913,10 +2915,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 */

Reply via email to