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 An interrupt might not arrive when a modul...



details:   https://anonhg.NetBSD.org/src/rev/e07f5fe48db7
branches:  trunk
changeset: 459164:e07f5fe48db7
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Aug 28 08:54:21 2019 +0000

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

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  50 +++++++++++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 21 deletions(-)

diffs (71 lines):

diff -r 5b611273fdd5 -r e07f5fe48db7 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 28 08:23:35 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 28 08:54:21 2019 +0000
@@ -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 @@
        /* 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 @@
                        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);



Home | Main Index | Thread Index | Old Index