[PATCH 00/19] wifi: rtw88: preparations for RTL8723B/RTL8723BS

luka.gejak@linux.dev posted 19 patches an hour ago
drivers/net/wireless/realtek/rtw88/coex.c     | 223 +++++++
drivers/net/wireless/realtek/rtw88/coex.h     |   3 +
drivers/net/wireless/realtek/rtw88/fw.c       | 166 +++++-
drivers/net/wireless/realtek/rtw88/fw.h       |  17 +
drivers/net/wireless/realtek/rtw88/mac80211.c | 542 +++++++++++++++++-
drivers/net/wireless/realtek/rtw88/main.c     | 186 +++++-
drivers/net/wireless/realtek/rtw88/main.h     |  35 ++
drivers/net/wireless/realtek/rtw88/reg.h      |   2 +
drivers/net/wireless/realtek/rtw88/rx.c       |   8 +-
drivers/net/wireless/realtek/rtw88/sdio.c     | 460 +++++++++++++--
drivers/net/wireless/realtek/rtw88/sdio.h     |  20 +-
drivers/net/wireless/realtek/rtw88/sec.h      |   1 +
drivers/net/wireless/realtek/rtw88/tx.c       |   5 +-
13 files changed, 1596 insertions(+), 72 deletions(-)
[PATCH 00/19] wifi: rtw88: preparations for RTL8723B/RTL8723BS
Posted by luka.gejak@linux.dev an hour ago
From: Luka Gejak <luka.gejak@linux.dev>

This is the first of two series adding support for the Realtek RTL8723B
802.11n chipset and its RTL8723BS SDIO variant to rtw88. It contains
only the changes to the shared rtw88 core that the chip driver depends
on. The chip itself, the build glue and the MAINTAINERS entry follow in
a second series.

Sending it this way was suggested during review of v2, where all of this
arrived as a single large patch. Splitting it per change should make it
reviewable; the trade-off is that nothing here does anything on its own,
since every change is gated on a chip that only exists once the second
series is applied.

Why so many changes are needed
==============================

RTL8723BS predates rtw88 and there is no rtw88-style firmware for it.
The only firmware available is the Realtek vendor blob (version 41), and
its H2C/C2H protocol, its association behaviour and its SDIO transfer
contract all differ from the firmware the existing rtw88 8723 family
devices use. The chip driver cannot paper over that on its own, because
the differences sit in code that lives in the core: the firmware command
encoders, the C2H dispatch, the coexistence antenna handling, the
association path in mac80211.c and the SDIO transfer path.

Each patch here is one such difference. They fall into five groups:

  - firmware (patches 4 to 8): the vendor C2H report events, the vendor
    byte layouts for rate adaptation, RSSI and media status, the four
    commands rtw88 does not implement, and the reserved page handshake;
  - coexistence (9, 10): the PTA antenna path has to be programmed
    directly during scan and reasserted when associating;
  - SDIO (11 to 14): software free-page and OQT accounting, the fixed
    management descriptor offset, RX aggregation and interrupt
    acknowledgment, and TX back-pressure with a retry on page
    starvation;
  - association (15, 16): the vendor join sequence, which programs the
    BSS parameters directly and waits for a beacon from the target
    before authenticating;
  - PHY and capabilities (17 to 19): calibrate once at power on, restore
    the per-rate TX AGC, defer the connect report, gate LPS on
    throughput, and advertise the correct HT capability.

Patches 1 to 3 are the chip type and helper plus two one-line fixes that
have no better home.

Scope
=====

Everything is gated on rtw_is_8723bs(), which is false for every chip
currently supported, so behaviour for existing devices is unchanged.
There are two deliberate exceptions, both called out in their commit
messages:

  - patch 2 extends an existing RTL8703B zero-length-packet check to
    cover the RTL8723B as well;
  - patch 13 changes the SDIO interrupt acknowledgment to write back
    only defined status bits instead of the raw status word. That
    applies to the other SDIO parts too. It is done this way because
    masking per-chip would leave the shared path inconsistent, but if
    you would rather it were scoped to the new chip only, say so and I
    will respin it.

Testing
=======

Tested on RTL8723BS hardware together with the second series: scan,
authentication, association, WPA2 handshake, DHCP, bidirectional
traffic, reconnects and module reloads. Throughput on one AP at strong
signal (-32 dBm), 2.4 GHz HT40, is roughly 40 Mbit/s down and 18 Mbit/s
up, with no "failed to get tx report" warnings and a clean log.

Every patch builds with W=1 with no warnings on its own, and sparse and
smatch are clean at the tip. checkpatch --strict is clean across the
series. The other rtw88 bus and chip modules continue to build.

The implementation is based on the initial RTL8723B work by Michael
Straube <straube.linux@gmail.com>:

  https://github.com/mistraube/rtw88/tree/rtl8723bs

Based on the rtw-next branch from pkshih/rtw.

Luka Gejak (19):
  wifi: rtw88: add the RTL8723B chip type and SDIO helper
  wifi: rtw88: rx: mark zero length packets on RTL8723B
  wifi: rtw88: tx: extend the TX report purge timeout to RTL8723BS
  wifi: rtw88: fw: handle the RTL8723BS management TX reports
  wifi: rtw88: fw: send rate adaptation and RSSI info in the vendor
    layout
  wifi: rtw88: fw: send the media status report in the vendor layout
  wifi: rtw88: fw: add the vendor firmware commands used by RTL8723BS
  wifi: rtw88: fw: fix the reserved page upload on RTL8723BS
  wifi: rtw88: coex: add the RTL8723BS scan antenna workaround
  wifi: rtw88: coex: reassert the antenna path when associating
  wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS
  wifi: rtw88: sdio: handle the RTL8723BS management TX path
  wifi: rtw88: sdio: set up RX aggregation and interrupts for RTL8723BS
  wifi: rtw88: sdio: add TX back-pressure and retry on page starvation
  wifi: rtw88: record beacons from the target BSSID before
    authenticating
  wifi: rtw88: run the RTL8723BS association register sequence
  wifi: rtw88: calibrate and tune the PHY for RTL8723BS
  wifi: rtw88: match the RTL8723BS firmware connect and power save
    behaviour
  wifi: rtw88: advertise the correct receive capabilities on RTL8723BS

 drivers/net/wireless/realtek/rtw88/coex.c     | 223 +++++++
 drivers/net/wireless/realtek/rtw88/coex.h     |   3 +
 drivers/net/wireless/realtek/rtw88/fw.c       | 166 +++++-
 drivers/net/wireless/realtek/rtw88/fw.h       |  17 +
 drivers/net/wireless/realtek/rtw88/mac80211.c | 542 +++++++++++++++++-
 drivers/net/wireless/realtek/rtw88/main.c     | 186 +++++-
 drivers/net/wireless/realtek/rtw88/main.h     |  35 ++
 drivers/net/wireless/realtek/rtw88/reg.h      |   2 +
 drivers/net/wireless/realtek/rtw88/rx.c       |   8 +-
 drivers/net/wireless/realtek/rtw88/sdio.c     | 460 +++++++++++++--
 drivers/net/wireless/realtek/rtw88/sdio.h     |  20 +-
 drivers/net/wireless/realtek/rtw88/sec.h      |   1 +
 drivers/net/wireless/realtek/rtw88/tx.c       |   5 +-
 13 files changed, 1596 insertions(+), 72 deletions(-)

-- 
2.55.0