Module Name: src Committed By: msaitoh Date: Wed Aug 28 08:54:21 UTC 2019
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c Log Message: An interrupt might not arrive when a module is inserted. When an link status change interrupt occurred and the driver still regard SFP as unplugged, link becomes up and the real media type is unknown. e.g: % ifconfig -m ixg0 (snip) media: Ethernet autoselect (autoselect rxpause,txpause) status: active supported Ethernet media: media none media autoselect (snip) To resolve this problem, when an link status change interrupt occurred and the driver still regard SFP as unplugged, issue the module softint before issuing LSC interrupt. To generate a diff of this commit: cvs rdiff -u -r1.203 -r1.204 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.203 src/sys/dev/pci/ixgbe/ixgbe.c:1.204 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.203 Wed Aug 28 08:23:35 2019 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 28 08:54:21 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.203 2019/08/28 08:23:35 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.204 2019/08/28 08:54:21 msaitoh Exp $ */ /****************************************************************************** @@ -3113,6 +3113,34 @@ ixgbe_msix_link(void *arg) /* Clear interrupt with write */ IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr); + if (ixgbe_is_sfp(hw)) { + /* Pluggable optics-related interrupt */ + if (hw->mac.type >= ixgbe_mac_X540) + eicr_mask = IXGBE_EICR_GPI_SDP0_X540; + else + eicr_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw); + + /* + * An interrupt might not arrive when a module is inserted. + * When an link status change interrupt occurred and the driver + * still regard SFP as unplugged, issue the module softint + * and then issue LSC interrupt. + */ + if ((eicr & eicr_mask) + || ((hw->phy.sfp_type == ixgbe_sfp_type_not_present) + && (eicr & IXGBE_EICR_LSC))) { + IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask); + softint_schedule(adapter->mod_si); + } + + if ((hw->mac.type == ixgbe_mac_82599EB) && + (eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) { + IXGBE_WRITE_REG(hw, IXGBE_EICR, + IXGBE_EICR_GPI_SDP1_BY_MAC(hw)); + softint_schedule(adapter->msf_si); + } + } + /* Link status change */ if (eicr & IXGBE_EICR_LSC) { IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC); @@ -3171,26 +3199,6 @@ ixgbe_msix_link(void *arg) softint_schedule(adapter->mbx_si); } - if (ixgbe_is_sfp(hw)) { - /* Pluggable optics-related interrupt */ - if (hw->mac.type >= ixgbe_mac_X540) - eicr_mask = IXGBE_EICR_GPI_SDP0_X540; - else - eicr_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw); - - if (eicr & eicr_mask) { - IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask); - softint_schedule(adapter->mod_si); - } - - if ((hw->mac.type == ixgbe_mac_82599EB) && - (eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) { - IXGBE_WRITE_REG(hw, IXGBE_EICR, - IXGBE_EICR_GPI_SDP1_BY_MAC(hw)); - softint_schedule(adapter->msf_si); - } - } - /* Check for fan failure */ if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) { ixgbe_check_fan_failure(adapter, eicr, TRUE);