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 "ifconfig ixgN down up" for...



details:   https://anonhg.NetBSD.org/src/rev/1d3b7ae932f2
branches:  trunk
changeset: 831524:1d3b7ae932f2
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Apr 04 06:30:09 2018 +0000

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

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c      |  12 ++++++++++--
 sys/dev/pci/ixgbe/ixgbe_x550.c |   7 +++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r 8a991ea0f274 -r 1d3b7ae932f2 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Apr 04 04:43:46 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Apr 04 06:30:09 2018 +0000
@@ -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 @@
                        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)
diff -r 8a991ea0f274 -r 1d3b7ae932f2 sys/dev/pci/ixgbe/ixgbe_x550.c
--- a/sys/dev/pci/ixgbe/ixgbe_x550.c    Wed Apr 04 04:43:46 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_x550.c    Wed Apr 04 06:30:09 2018 +0000
@@ -569,8 +569,15 @@
                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;



Home | Main Index | Thread Index | Old Index