Module Name:    src
Committed By:   msaitoh
Date:           Wed Apr  4 06:30:09 UTC 2018

Modified Files:
        src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_x550.c

Log Message:
Fix a bug that "ifconfig ixgN down up" forgot IFM_NONE setting.
 - Don't assume autoneg == 0 is the first call of ixgbe_config_link().
   Check ifm_media, too.
 - Don't override autoneg_advertised in ixgbe_get_phy_id_fw() to not to
   be inconsistent with if_media value.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_x550.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.142 src/sys/dev/pci/ixgbe/ixgbe.c:1.143
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.142	Mon Apr  2 10:51:35 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Apr  4 06:30:09 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.142 2018/04/02 10:51:35 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.143 2018/04/04 06:30:09 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -1511,13 +1511,21 @@ ixgbe_config_link(struct adapter *adapte
 			kpreempt_enable();
 		}
 	} else {
+		struct ifmedia  *ifm = &adapter->media;
+
 		if (hw->mac.ops.check_link)
 			err = ixgbe_check_link(hw, &adapter->link_speed,
 			    &adapter->link_up, FALSE);
 		if (err)
 			goto out;
+
+		/*
+		 * Check if it's the first call. If it's the first call,
+		 * get value for auto negotiation.
+		 */
 		autoneg = hw->phy.autoneg_advertised;
-		if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
+		if ((IFM_SUBTYPE(ifm->ifm_cur->ifm_media) != IFM_NONE)
+		    && ((!autoneg) && (hw->mac.ops.get_link_capabilities)))
                 	err = hw->mac.ops.get_link_capabilities(hw, &autoneg,
 			    &negotiate);
 		if (err)

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.10 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.11
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.10	Fri Mar 30 06:44:30 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Wed Apr  4 06:30:09 2018
@@ -569,8 +569,15 @@ static s32 ixgbe_get_phy_id_fw(struct ix
 		if (phy_speeds & ixgbe_fw_map[i].fw_speed)
 			hw->phy.speeds_supported |= ixgbe_fw_map[i].phy_speed;
 	}
+
+#if 0
+	/*
+	 *  Don't set autoneg_advertised here to not to be inconsistent with
+	 * if_media value.
+	 */
 	if (!hw->phy.autoneg_advertised)
 		hw->phy.autoneg_advertised = hw->phy.speeds_supported;
+#endif
 
 	hw->phy.id = info[0] & FW_PHY_INFO_ID_HI_MASK;
 	phy_id_lo = info[1] & FW_PHY_INFO_ID_LO_MASK;

Reply via email to