NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/52818: The wm driver stops working after large traffic



The following reply was made to PR kern/52818; it has been noted by GNATS.

From: clare%csel.org@localhost
To: gnats-bugs%NetBSD.org@localhost
Cc: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/52818: The wm driver stops working after large traffic
Date: Mon, 18 Dec 2017 23:58:48 +0900

 >  PCIe ASPM is disabled by the BIOS by the default
 >  in the XCY mini PC.
 >  Fixing ASPM flag in EEPROM does not effective.
 
 The buggy BIOS does not disable ASPM against any setup configuration.
 the following patch workarounds the bug of the device, and
 regains network stability of my device.
 
 Index: if_wm.c
 ===================================================================
 RCS file: /export/cvsroot/netbsd/src/sys/dev/pci/if_wm.c,v
 retrieving revision 1.549
 diff -u -r1.549 if_wm.c
 --- if_wm.c     8 Dec 2017 05:22:23 -0000       1.549
 +++ if_wm.c     18 Dec 2017 14:08:56 -0000
 @@ -1851,6 +1851,35 @@
 
         wm_adjust_qnum(sc, pci_msix_count(pa->pa_pc, pa->pa_tag));
 
 +       /*
 +        * XXX this is quick hack, please cleanup before commit.
 +        *
 +        * The 82583 does not support PCIe ASPM.
 +        * We should always disable PCIe ASPM on the device.
 +        */
 +       if (sc->sc_type == WM_T_82583) {
 +               int ok;
 +               int capoff;
 +
 +               ok = pci_get_capability(pc, pa->pa_tag,
 +                   PCI_CAP_PCIEXPRESS, &capoff, NULL);
 +               if (!ok) {
 +                       printf("XXX: I'm not on PCIe bus.\n");
 +                       goto skip_disable_aspm;
 +               }
 +               reg = pci_conf_read(pc, pa->pa_tag, capoff + PCIE_LCAP);
 +               if ((reg & PCIE_LCAP_ASPM) == 0) {
 +                       printf("XXX: ASPM was disabled.\n");
 +                       goto skip_disable_aspm;
 +               }
 +               printf("XXX: disabling ASPM now.\n");
 +               reg = pci_conf_read(pc, pa->pa_tag, capoff + PCIE_LCSR);
 +               reg &= ~PCIE_LCSR_ASPM_L1;
 +               reg &= ~PCIE_LCSR_ASPM_L0S;
 +               pci_conf_write(pc, pa->pa_tag, capoff + PCIE_LCSR, reg);
 +       skip_disable_aspm:;
 +       }
 +
         /* Allocation settings */
         max_type = PCI_INTR_TYPE_MSIX;
         /*
 ===================================================================
 
 the i82583 specification update says ASPM L0s should be disabled
 on some chipset.
 
 the FreeBSD kernel disables ASPM as following case:
 
         switch (adapter->hw.mac.type) {
                 case e1000_82573:
                 case e1000_82574:
                 case e1000_82583:
                         break;
                 default:
                         return;
         }
 
 
 -- 
 Shinichi Doyashiki <clare%csel.org@localhost>
 


Home | Main Index | Thread Index | Old Index