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 - Add missing IFM_NONE support. If a inte...



details:   https://anonhg.NetBSD.org/src/rev/0d0e786772c2
branches:  trunk
changeset: 360768:0d0e786772c2
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Mar 30 06:44:30 2018 +0000

description:
-  Add missing IFM_NONE support. If a interface support linkdown,
  "ifconfig ixgN media none" drpos link.  Not all interface can do link down.

 Tested:
        82598 AT2 (T)
        92599 SF+(SFI) (X520-DA2)
        X540
        X550-T1
        X550EM_x (X10SDV-8C-TLN4F)
        X550EM_a (A2SDi-H-TP4F port 0, 1 (T))

 Doesn't work:
        X550EM_a (A2SDi-H-TP4F port 2, 3 (SFP+ (KR)))
        X550EM_a (MA10-ST0 port 2, 3 (SFP+ (SFI)))
        (Denverton SFP+ can't force link down because SFP+'s TX_DISABLE pin is
        pull down. Is there a way to shutdown SFP+ cage's power?)
 Not tested:
        82598 fiber.

- Change some functions static.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c        |   6 +++++-
 sys/dev/pci/ixgbe/ixgbe_82599.c  |  15 ++++++++++-----
 sys/dev/pci/ixgbe/ixgbe_common.c |   9 ++++++++-
 sys/dev/pci/ixgbe/ixgbe_common.h |   3 +--
 sys/dev/pci/ixgbe/ixgbe_x550.c   |   8 +++++++-
 sys/dev/pci/ixgbe/ixgbe_x550.h   |   3 ---
 6 files changed, 31 insertions(+), 13 deletions(-)

diffs (155 lines):

diff -r 21291fca8440 -r 0d0e786772c2 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 30 03:58:20 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 30 06:44:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.139 2018/03/30 03:58:20 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.140 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -1378,6 +1378,8 @@
 #define        ADD(mm, dd)                                                     \
        ifmedia_add(&adapter->media, IFM_ETHER | (mm), (dd), NULL);
 
+       ADD(IFM_NONE, 0);
+
        /* Media types with matching NetBSD media defines */
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) {
                ADD(IFM_10G_T | IFM_FDX, 0);
@@ -2829,6 +2831,8 @@
        case IFM_10_T:
                speed |= IXGBE_LINK_SPEED_10_FULL;
                break;
+       case IFM_NONE:
+               break;
        default:
                goto invalid;
        }
diff -r 21291fca8440 -r 0d0e786772c2 sys/dev/pci/ixgbe/ixgbe_82599.c
--- a/sys/dev/pci/ixgbe/ixgbe_82599.c   Fri Mar 30 03:58:20 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_82599.c   Fri Mar 30 06:44:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82599.c,v 1.16 2017/12/06 04:08:50 msaitoh Exp $ */
+/* $NetBSD: ixgbe_82599.c,v 1.17 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -56,6 +56,7 @@
                                   u16 offset, u16 *data);
 static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset,
                                          u16 words, u16 *data);
+static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
 static s32 ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
                                        u8 dev_addr, u8 *data);
 static s32 ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
@@ -914,9 +915,13 @@
 
        speed &= link_capabilities;
 
-       if (speed == IXGBE_LINK_SPEED_UNKNOWN) {
-               status = IXGBE_ERR_LINK_SETUP;
-               goto out;
+       if (speed == 0) {
+               ixgbe_disable_tx_laser(hw); /* For fiber */
+               ixgbe_set_phy_power(hw, false); /* For copper */
+       } else {
+               /* In case previous media setting was none(down) */
+               ixgbe_enable_tx_laser(hw); /* for Fiber */
+               ixgbe_set_phy_power(hw, true); /* For copper */
        }
 
        /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
@@ -2475,7 +2480,7 @@
  * Reset pipeline by asserting Restart_AN together with LMS change to ensure
  * full pipeline reset.  This function assumes the SW/FW lock is held.
  **/
-s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
+static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
 {
        s32 ret_val;
        u32 anlp1_reg = 0;
diff -r 21291fca8440 -r 0d0e786772c2 sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c  Fri Mar 30 03:58:20 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c  Fri Mar 30 06:44:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.19 2018/03/30 03:58:20 knakahara Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.20 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -5427,6 +5427,13 @@
                        goto out;
        }
 
+       if (speed == 0) {
+               /* Disable the Tx laser for media none */
+               ixgbe_disable_tx_laser(hw);
+
+               goto out;
+       }
+       
        /* We didn't get link.  Configure back to the highest speed we tried,
         * (if there was more than one).  We call ourselves back with just the
         * single highest speed that the user requested.
diff -r 21291fca8440 -r 0d0e786772c2 sys/dev/pci/ixgbe/ixgbe_common.h
--- a/sys/dev/pci/ixgbe/ixgbe_common.h  Fri Mar 30 03:58:20 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.h  Fri Mar 30 06:44:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.h,v 1.10 2018/03/15 06:48:51 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.h,v 1.11 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -177,7 +177,6 @@
                             u32 action);
 s32 ixgbe_bypass_rd_eep_generic(struct ixgbe_hw *hw, u32 addr, u8 *value);
 
-extern s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
 extern void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw);
 bool ixgbe_mng_present(struct ixgbe_hw *hw);
 bool ixgbe_mng_enabled(struct ixgbe_hw *hw);
diff -r 21291fca8440 -r 0d0e786772c2 sys/dev/pci/ixgbe/ixgbe_x550.c
--- a/sys/dev/pci/ixgbe/ixgbe_x550.c    Fri Mar 30 03:58:20 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_x550.c    Fri Mar 30 06:44:30 2018 +0000
@@ -41,6 +41,9 @@
 #include <dev/mii/mii.h>
 
 static s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed);
+static s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
+                                   ixgbe_link_speed speed,
+                                   bool autoneg_wait_to_complete);
 static s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
 static void ixgbe_release_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
 static s32 ixgbe_read_mng_if_sel_x550em(struct ixgbe_hw *hw);
@@ -2840,6 +2843,9 @@
        case IXGBE_LINK_SPEED_1GB_FULL:
                reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G;
                break;
+       case 0:
+               /* media none (linkdown) */
+               break;
        default:
                /* Other link speeds are not supported by internal PHY. */
                return IXGBE_ERR_LINK_SETUP;
@@ -2861,7 +2867,7 @@
  *
  *  Configure the the integrated PHY for SFP support.
  **/
-s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
+static s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
                                    ixgbe_link_speed speed,
                                    bool autoneg_wait_to_complete)
 {
diff -r 21291fca8440 -r 0d0e786772c2 sys/dev/pci/ixgbe/ixgbe_x550.h
--- a/sys/dev/pci/ixgbe/ixgbe_x550.h    Fri Mar 30 03:58:20 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_x550.h    Fri Mar 30 06:44:30 2018 +0000
@@ -99,9 +99,6 @@
 s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
                                    ixgbe_link_speed speed,
                                    bool autoneg_wait_to_complete);
-s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
-                                   ixgbe_link_speed speed,
-                                   bool autoneg_wait_to_complete);
 s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
                               u32 device_type, u16 *phy_data);
 s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,



Home | Main Index | Thread Index | Old Index