Module Name: src Committed By: msaitoh Date: Fri Mar 30 06:44:30 UTC 2018
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_82599.c ixgbe_common.c ixgbe_common.h ixgbe_x550.c ixgbe_x550.h Log Message: - 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. To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/ixgbe/ixgbe_82599.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/ixgbe/ixgbe_common.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_common.h cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/ixgbe/ixgbe_x550.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/ixgbe/ixgbe_x550.h 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.139 src/sys/dev/pci/ixgbe/ixgbe.c:1.140 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.139 Fri Mar 30 03:58:20 2018 +++ src/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 30 06:44:30 2018 @@ -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 @@ ixgbe_add_media_types(struct adapter *ad #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 @@ ixgbe_media_change(struct ifnet *ifp) case IFM_10_T: speed |= IXGBE_LINK_SPEED_10_FULL; break; + case IFM_NONE: + break; default: goto invalid; } Index: src/sys/dev/pci/ixgbe/ixgbe_82599.c diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.16 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.17 --- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.16 Wed Dec 6 04:08:50 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_82599.c Fri Mar 30 06:44:30 2018 @@ -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 @@ static s32 ixgbe_read_eeprom_82599(struc 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 @@ s32 ixgbe_setup_mac_link_82599(struct ix 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 @@ static s32 ixgbe_read_eeprom_82599(struc * 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; Index: src/sys/dev/pci/ixgbe/ixgbe_common.c diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.19 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.20 --- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.19 Fri Mar 30 03:58:20 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_common.c Fri Mar 30 06:44:30 2018 @@ -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 @@ s32 ixgbe_setup_mac_link_multispeed_fibe 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. Index: src/sys/dev/pci/ixgbe/ixgbe_common.h diff -u src/sys/dev/pci/ixgbe/ixgbe_common.h:1.10 src/sys/dev/pci/ixgbe/ixgbe_common.h:1.11 --- src/sys/dev/pci/ixgbe/ixgbe_common.h:1.10 Thu Mar 15 06:48:51 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_common.h Fri Mar 30 06:44:30 2018 @@ -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 @@ s32 ixgbe_bypass_set_generic(struct ixgb 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); Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.9 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.10 --- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.9 Fri Mar 16 07:54:08 2018 +++ src/sys/dev/pci/ixgbe/ixgbe_x550.c Fri Mar 30 06:44:30 2018 @@ -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 @@ static s32 ixgbe_setup_sfi_x550a(struct 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 @@ static s32 ixgbe_setup_sfi_x550a(struct * * 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) { Index: src/sys/dev/pci/ixgbe/ixgbe_x550.h diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.h:1.3 src/sys/dev/pci/ixgbe/ixgbe_x550.h:1.4 --- src/sys/dev/pci/ixgbe/ixgbe_x550.h:1.3 Wed Aug 30 08:49:18 2017 +++ src/sys/dev/pci/ixgbe/ixgbe_x550.h Fri Mar 30 06:44:30 2018 @@ -99,9 +99,6 @@ s32 ixgbe_setup_fc_X550em(struct ixgbe_h 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,