1. 18 Oct, 2021 2 commits
    • Jonas Dreßler's avatar
      mwifiex: Try waking the firmware until we get an interrupt · 8e3e59c3
      Jonas Dreßler authored
      It seems that the PCIe+USB firmware (latest version 15.68.19.p21) of the
      88W8897 card sometimes ignores or misses when we try to wake it up by
      writing to the firmware status register. This leads to the firmware
      wakeup timeout expiring and the driver resetting the card because we
      assume the firmware has hung up or crashed.
      
      Turns out that the firmware actually didn't hang up, but simply "missed"
      our wakeup request and didn't send us an interrupt with an AWAKE event.
      
      Trying again to read the firmware status register after a short timeout
      usually makes the firmware wake up as expected, so add a small retry
      loop to mwifiex_pm_wakeup_card() that looks at the interrupt status to
      check whether the card woke up.
      
      The number of tries and timeout lengths for this were determined
      experimentally: The firmware usually takes about 500 us to wake up
      after we attempt to read the status register. In some cases where the
      firmware is very busy (for example while doing a bluetooth scan) it
      might even miss our requests for multiple milliseconds, which is why
      after 15 tries the waiting time gets increased to 10 ms. The maximum
      number of tries it took to wake the firmware when testing this was
      around 20, so a maximum number of 50 tries should give us plenty of
      safety margin.
      
      Here's a reproducer for those firmware wakeup failures I've found:
      
      1) Make sure wifi powersaving is enabled (iw dev wlp1s0 set power_save on)
      2) Connect to any wifi network (makes firmware go into wifi powersaving
      mode, not deep sleep)
      3) Make sure bluetooth is turned off (to ensure the firmware actually
      enters powersave mode and doesn't keep the radio active doing bluetooth
      stuff)
      4) To confirm that wifi powersaving is entered ping a device on the LAN,
      pings should be a few ms higher than without powersaving
      5) Run "while true; do iwconfig; sleep 0.0001; done", this wakes and
      suspends the firmware extremely often
      6) Wait until things explode, for me it consistently takes <5 minutes
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=109681
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJonas Dreßler <verdre@v0yd.nl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20211011133224.15561-3-verdre@v0yd.nl
      8e3e59c3
    • Jonas Dreßler's avatar
      mwifiex: Read a PCI register after writing the TX ring write pointer · e5f4eb82
      Jonas Dreßler authored
      On the 88W8897 PCIe+USB card the firmware randomly crashes after setting
      the TX ring write pointer. The issue is present in the latest firmware
      version 15.68.19.p21 of the PCIe+USB card.
      
      Those firmware crashes can be worked around by reading any PCI register
      of the card after setting that register, so read the PCI_VENDOR_ID
      register here. The reason this works is probably because we keep the bus
      from entering an ASPM state for a bit longer, because that's what causes
      the cards firmware to crash.
      
      This fixes a bug where during RX/TX traffic and with ASPM L1 substates
      enabled (the specific substates where the issue happens appear to be
      platform dependent), the firmware crashes and eventually a command
      timeout appears in the logs.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=109681
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJonas Dreßler <verdre@v0yd.nl>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/20211011133224.15561-2-verdre@v0yd.nl
      e5f4eb82
  2. 13 Oct, 2021 4 commits
  3. 11 Oct, 2021 2 commits
  4. 10 Oct, 2021 22 commits
  5. 09 Oct, 2021 9 commits
  6. 08 Oct, 2021 1 commit