wifi: rtw89: pci: correct TX resource checking for PCI DMA channel of firmware command
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 10 Apr 2024 01:13:16 +0000 (09:13 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Thu, 18 Apr 2024 00:52:20 +0000 (08:52 +0800)
commitc6330b129786e267b14129335a08fa7c331c308d
treea5a9dba3e2a6c008f5a9ee9a19dae59758070cbd
parenta35b36e6ee5dcf323d846ec3881159e4af90c9b4
wifi: rtw89: pci: correct TX resource checking for PCI DMA channel of firmware command

The DMA channel of firmware command doesn't use TX WD (WiFi descriptor), so
don't need to consider number of TX WD as factor of TX resource. Otherwise,
during pause state (a transient state to switch to/from low power mode)
firmware commands could be dropped and driver throws warnings suddenly:

   rtw89_8852ce 0000:04:00.0: no tx fwcmd resource
   rtw89_8852ce 0000:04:00.0: failed to send h2c

The case we met is that driver sends RSSI strength of firmware command at
RX path that could be running concurrently with switching low power mode.
The missing of this firmware command doesn't affect user experiences,
because the RSSI strength will be updated again after a while.

The DMA descriptors of normal packets has three layers like:

  +-------+
  | TX BD | (*n elements)
  +-------+
      |
      |   +-------+
      +-> | TX WD | (*m elements)
          +-------+
              |
              |   +--------+
              +-> |   SKB  |
                  +--------+

And, firmware command queue (TXCH 12) is a special queue that has only
two layers:

  +-------+
  | TX BD | (*n elements)
  +-------+
      |
      |   +------------------+
      +-> | firmware command |
          +------------------+

Fixes: 4a29213cd775 ("wifi: rtw89: pci: correct TX resource checking in low power mode")
Cc: stable@vger.kernel.org
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240410011316.9906-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/pci.c