RFC: Proposed modularization of ath12k

Jeff Johnson jeff.johnson at oss.qualcomm.com
Wed Apr 16 08:15:16 PDT 2025


BACKGROUND

Historically, for each generation of Qualcomm Atheros Wi-Fi chipset, there has
been a separate driver, the most recent being ath10k for 802.11ac (Wi-Fi 5),
ath11k for 802.11ax (Wi-Fi 6/6E), and ath12k for 802.11be (Wi-Fi 7). But there
is common functionality and code across these drivers due to firmware and
hardware architecture leverage across generations.

In the existing development model, code leverage is achieved via code
duplication. When a new driver is created from the prior driver, it is first
stripped down to basic features to allow for easier public review, and then,
over time, features are added back to bring the new driver up to parity with
the previous generation driver. So there is a period where existing
functionality in the previous driver is not present in the new driver. In
addition, introduction of new functionality requires porting across the
different generations of drivers.

We are now looking ahead at how to support 802.11bn (Wi-Fi 8). And within
Qualcomm there is consensus that the old way is not the best way forward.
Therefore we are seeking feedback on the following.

PROPOSAL

For better leverage, refactor ath12k into common and generation-specific
modules. The common module will contain the logic that is shared across
multiple architectures, and the generation-specific modules will contain the
logic that is specific for that generation (and specific to the chipsets
supporting that generation). Hence there will be one driver that supports
Wi-Fi 7, Wi-Fi 8, and hopefully all future generations of Wi-Fi. Previous
drivers (ath11k, ath10k, etc) are unchanged.

Firmware interface, core initialization and de-initialization sequences are
usually common across different device families. Hardware register
definitions, Copy engine mappings, MHI config, WMI resource config and
hardware abstractions are usually generation-specific.

Common components includes following
      mac80211 interface: Control path ops are mostly common across different
      generations. Handlers will be shared as much as possible.

      Firmware interface (WMI, HTT, HTC, QMI): Firmware interfacing messages
      and sequence is common and kept backward/forward compatible using TLVs.

      Common Datapath flow: Buffer replenish, Processing of RAW packets,
      delivering frames to mac80211 and similar common path not dependent on
      hardware TLVs and registers.

      core init sequences, reset sequence & recovery sequence in shared code.

Generation specific code includes.
      Some mac80211 handlers that are very close to device like tx will be
      moved to generation specific components.

      Hardware configs: Hardware capabilities, configs, MHI configuration, WMI
      resource configuration, HAL and other architecture specific code.

      Data path flow: specific to hardware and TLV integrations like,
      processing of RX and TX flow that involves hardware register and TLV
      interactions.

It is proposed that ath12k.ko will be the common module. It is proposed that
ath12k_wifi7.ko will be the generation-specific module for Wi-Fi 7 devices.

The current ath12k.ko will be refactored as depicted below.

                                        +-----------------+
                                        |                 |
                                        |   ath12k.ko     |
                                        |    (common)     |
      +---------------+                 |                 |
      |               |                 +-----------------+
      |   ath12k.ko   | ===========>
      |               |                 +------------------+
      +---------------+                 |                  |
                                        | ath12k_wifi7.ko  |
                                        | (wifi7 family)   |
                                        |                  |
                                        +------------------+

Going forward, wifi8 can be added as a new module including all device
specific code and new common functionalities will be added in common ath12k.ko
that can be leveraged. It will look something like below

                    +-----------------+
                    |                 |
                    |   ath12k.ko     |
                    |    (common)     |
                    |                 |
                    +-----------------+

    +------------------+           +------------------+
    |                  |           |                  |
    | ath12k_wifi7.ko  |           | ath12k_wifi8.ko  |
    | (wifi7 family)   |           | (wifi8 family)   |
    |                  |           |                  |
    +------------------+           +------------------+


Proposed directory structure
Existing                            New
.                                   .
├── acpi.c                          ├── acpi.c
├── acpi.h                          ├── acpi.h
├── ce.c                            ├── ce.c
├── ce.h                            ├── ce.h
├── core.c                          ├── core.c
├── coredump.c                      ├── coredump.c
├── coredump.h                      ├── coredump.h
├── core.h                          ├── core.h
├── dbring.c                        ├── dbring.c
├── dbring.h                        ├── dbring.h
├── debug.c                         ├── debug.c
├── debugfs.c                       ├── debugfs.c
├── debugfs.h                       ├── debugfs.h
├── debugfs_htt_stats.c             ├── debugfs_htt_stats.c
├── debugfs_htt_stats.h             ├── debugfs_htt_stats.h
├── debugfs_sta.c                   ├── debugfs_sta.c
├── debugfs_sta.h                   ├── debugfs_sta.h
├── debug.h                         ├── debug.h
├── dp.c                            ├── dp.c
├── dp.h                            ├── dp_cmn.h
├── dp_mon.c                        ├── dp.h
├── dp_mon.h                        ├── dp_htt.c
├── dp_rx.c                         ├── dp_htt.h
├── dp_rx.h                         ├── dp_mon.c
├── dp_tx.c                         ├── dp_mon.h
├── dp_tx.h                         ├── dp_peer.c
├── fw.c                            ├── dp_peer.h
├── fw.h                            ├── dp_rx.c
├── hal.c                           ├── dp_rx.h
├── hal_desc.h                      ├── dp_tx.c
├── hal.h                           ├── dp_tx.h
├── hal_rx.c                        ├── fw.c
├── hal_rx.h                        ├── fw.h
├── hal_tx.c                        ├── hal.c
├── hal_tx.h                        ├── hal.h
├── hif.h                           ├── hif.h
├── htc.c                           ├── htc.c
├── htc.h                           ├── htc.h
├── hw.c                            ├── hw.h
├── hw.h                            ├── Kconfig
├── Kconfig                         ├── mac.c
├── mac.c                           ├── mac.h
├── mac.h                           ├── Makefile
├── Makefile                        ├── mhi.c
├── mhi.c                           ├── mhi.h
├── mhi.h                           ├── p2p.c
├── p2p.c                           ├── p2p.h
├── p2p.h                           ├── pci.c
├── pci.c                           ├── pci.h
├── pci.h                           ├── peer.c
├── peer.c                          ├── peer.h
├── peer.h                          ├── qmi.c
├── qmi.c                           ├── qmi.h
├── qmi.h                           ├── reg.c
├── reg.c                           ├── reg.h
├── reg.h                           ├── testmode.c
├── rx_desc.h                       ├── testmode.h
├── testmode.c                      ├── trace.c
├── testmode.h                      ├── trace.h
├── trace.c                         ├── wmi.c
├── trace.h                         ├── wmi.h
├── wmi.c                           ├── wow.c
├── wmi.h                           ├── wow.h
├── wow.c                           +── wifi7
+── wow.h                               ├── dp.c
                                        ├── dp.h
                                        ├── dp_rx.c
                                        ├── dp_rx.h
                                        ├── dp_tx.c
                                        ├── dp_tx.h
                                        ├── hal.c
                                        ├── hal_desc.h
                                        ├── hal.h
                                        ├── hal_qcn9274.c
                                        ├── hal_qcn9274.h
                                        ├── hal_rx.c
                                        ├── hal_rx_desc.h
                                        ├── hal_rx.h
                                        ├── hal_tx.c
                                        ├── hal_tx.h
                                        ├── hal_wcn7850.c
                                        ├── hal_wcn7850.h
                                        ├── hw.c
                                        ├── hw.h
                                        ├── Makefile
                                        ├── mhi.c
                                        ├── pci.c
                                        ├── wmi.c
                                        └── wmi.h

A proof-of-concept is already being developed in parallel with the current
ath12k development in the ath12k-ng (Next Generation) branch in our public
ath.git. In order to not interfere with the review of current ath12k
development, we will not be posting ath12k-ng patches on the mailing lists.
However, it will be easy to tell when new patches have been pushed to the
branch since the Intel 0-DAY CI Kernel Test Service will run on this branch
and publish the test result to the ath12k list.

Public branch:
https://web.git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git/log/?h=ath12k-ng

First Intel 0-DAY build result:
https://lore.kernel.org/all/202503300031.2IK6j4IS-lkp@intel.com/

Public comment on this proposal are welcomed.

/jeff



More information about the ath12k mailing list