# tomaspinho/rtl8821ce architecture

> Architecture diagram of the GitHub repository tomaspinho/rtl8821ce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tomaspinho/rtl8821ce
- Repository: https://github.com/tomaspinho/rtl8821ce

## Overview

This is a Linux kernel driver for Realtek RTL8821CE Wi-Fi hardware, with related Bluetooth coexistence support. The principal workflow is kernel/network configuration entering the driver, association and packet handling in its wireless core, then chip-specific control and PCIe transmission to the device. The tree also contains PHY/radio management, eFuse configuration, mesh/P2P, and coexistence features. The README documents the product and operational capabilities, but most call paths are not shown in the supplied excerpts; dashed edges mark architectural relationships that remain unverified here.

Main entry points: [`core/rtw_mlme_ext.c`](https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_mlme_ext.c) (Connection management), [`hal/rtl8821c/pci/rtl8821ce_xmit.c`](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/rtl8821c/pci/rtl8821ce_xmit.c) (PCIe transport), [`hal/rtl8821c/rtl8821c_ops.c`](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/rtl8821c/rtl8821c_ops.c) (RTL8821C operations), [`hal/hal_com.c`](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/hal_com.c) (Common hardware control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_linux["Linux integration"]
  node_cfg80211["cfg80211 interface<br/>[ioctl_cfg80211.c]"]
  node_legacy_ioctl["Wireless ioctls<br/>[ioctl_linux.c]"]
end

subgraph group_wireless["Wireless services"]
  node_mlme["Connection management<br/>[rtw_mlme_ext.c]"]
  node_tx["Transmit processing<br/>[rtw_xmit.c]"]
  node_rx["Receive processing<br/>[rtw_recv.c]"]
end

subgraph group_hardware["Chip and transport"]
  node_efuse["eFuse configuration<br/>[rtw_efuse.c]"]
  node_hal["Common hardware control<br/>[hal_com.c]"]
  node_halmac["HALMAC interface<br/>[hal_halmac.h]"]
  node_chip["RTL8821C operations<br/>[rtl8821c_ops.c]"]
  node_pcie["PCIe transport<br/>[rtl8821ce_xmit.c]"]
  node_halmac_core["HALMAC chip support"]
  node_halmac_api["HALMAC API and registers<br/>[halmac_api.h]"]
end

subgraph group_radio["Radio management"]
  node_phy["PHY and radio control<br/>[phydm_precomp.h]"]
  node_rf_tables["RTL8821C RF tables<br/>[halhwimg8821c_rf.c]"]
end

subgraph group_extras["Additional features"]
  node_mesh["Mesh networking<br/>[rtw_mesh.c]"]
  node_p2p["Wi-Fi Direct<br/>[rtw_p2p.c]"]
  node_coex["Bluetooth coexistence<br/>[halbtc8822b1ant.c]"]
end

node_user(("Network manager"))
node_kernel(("Linux kernel"))
node_wifi["RTL8821CE device"]

node_user -.->|"configures Wi-Fi"| node_cfg80211
node_kernel -.->|"exposes interface"| node_cfg80211
node_kernel -.->|"exposes ioctls"| node_legacy_ioctl
node_cfg80211 -.->|"requests connection"| node_mlme
node_legacy_ioctl -.->|"requests connection"| node_mlme
node_mlme -.->|"controls link"| node_hal
node_tx -.->|"submits frames"| node_pcie
node_pcie -.->|"transfers frames"| node_wifi
node_wifi -.->|"delivers received frames"| node_pcie
node_pcie -.->|"passes received frames"| node_rx
node_hal -.->|"uses interface"| node_halmac
node_chip -.->|"uses API"| node_halmac_api
node_halmac_core -.->|"implements chip support"| node_halmac_api
node_chip -.->|"configures transport"| node_pcie
node_chip -.->|"loads eFuse data"| node_efuse
node_chip -.->|"configures radio"| node_phy
node_phy -.->|"applies RF settings"| node_rf_tables
node_mlme -.->|"supports mesh mode"| node_mesh
node_mlme -.->|"supports peer discovery"| node_p2p
node_hal -.->|"coordinates radio use"| node_coex
node_kernel -->|"loads driver for"| node_wifi

click node_cfg80211 "https://github.com/tomaspinho/rtl8821ce/blob/master/os_dep/linux/ioctl_cfg80211.c"
click node_legacy_ioctl "https://github.com/tomaspinho/rtl8821ce/blob/master/os_dep/linux/ioctl_linux.c"
click node_mlme "https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_mlme_ext.c"
click node_tx "https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_xmit.c"
click node_rx "https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_recv.c"
click node_mesh "https://github.com/tomaspinho/rtl8821ce/blob/master/core/mesh/rtw_mesh.c"
click node_p2p "https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_p2p.c"
click node_efuse "https://github.com/tomaspinho/rtl8821ce/blob/master/core/efuse/rtw_efuse.c"
click node_hal "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/hal_com.c"
click node_halmac "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/hal_halmac.h"
click node_chip "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/rtl8821c/rtl8821c_ops.c"
click node_pcie "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/rtl8821c/pci/rtl8821ce_xmit.c"
click node_phy "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/phydm/phydm_precomp.h"
click node_rf_tables "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/phydm/rtl8821c/halhwimg8821c_rf.c"
click node_coex "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/btc/halbtc8822b1ant.c"
click node_halmac_core "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/halmac/halmac_88xx/halmac_8821c/halmac_init_8821c.c"
click node_halmac_api "https://github.com/tomaspinho/rtl8821ce/blob/master/hal/halmac/halmac_api.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cfg80211,node_legacy_ioctl toneBlue
class node_mlme,node_tx,node_rx toneAmber
class node_efuse,node_hal,node_halmac,node_chip,node_pcie,node_halmac_core,node_halmac_api toneMint
class node_phy,node_rf_tables toneRose
class node_mesh,node_p2p,node_coex,node_user,node_kernel,node_wifi toneIndigo
```

## Components

### Linux integration

- [cfg80211 interface](https://github.com/tomaspinho/rtl8821ce/blob/master/os_dep/linux/ioctl_cfg80211.c): `os_dep/linux/ioctl_cfg80211.c`
- [Wireless ioctls](https://github.com/tomaspinho/rtl8821ce/blob/master/os_dep/linux/ioctl_linux.c): `os_dep/linux/ioctl_linux.c`

### Wireless services

- [Connection management](https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_mlme_ext.c): `core/rtw_mlme_ext.c`
- [Transmit processing](https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_xmit.c): `core/rtw_xmit.c`
- [Receive processing](https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_recv.c): `core/rtw_recv.c`

### Chip and transport

- [eFuse configuration](https://github.com/tomaspinho/rtl8821ce/blob/master/core/efuse/rtw_efuse.c): `core/efuse/rtw_efuse.c`
- [Common hardware control](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/hal_com.c): `hal/hal_com.c`
- [HALMAC interface](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/hal_halmac.h): `hal/hal_halmac.h`
- [RTL8821C operations](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/rtl8821c/rtl8821c_ops.c): `hal/rtl8821c/rtl8821c_ops.c`
- [PCIe transport](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/rtl8821c/pci/rtl8821ce_xmit.c): `hal/rtl8821c/pci/rtl8821ce_xmit.c`
- [HALMAC chip support](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/halmac/halmac_88xx/halmac_8821c/halmac_init_8821c.c): `hal/halmac/halmac_88xx/halmac_8821c/halmac_init_8821c.c`
- [HALMAC API and registers](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/halmac/halmac_api.h): `hal/halmac/halmac_api.h`

### Radio management

- [PHY and radio control](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/phydm/phydm_precomp.h): `hal/phydm/phydm_precomp.h`
- [RTL8821C RF tables](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/phydm/rtl8821c/halhwimg8821c_rf.c): `hal/phydm/rtl8821c/halhwimg8821c_rf.c`

### Additional features

- [Mesh networking](https://github.com/tomaspinho/rtl8821ce/blob/master/core/mesh/rtw_mesh.c): `core/mesh/rtw_mesh.c`
- [Wi-Fi Direct](https://github.com/tomaspinho/rtl8821ce/blob/master/core/rtw_p2p.c): `core/rtw_p2p.c`
- [Bluetooth coexistence](https://github.com/tomaspinho/rtl8821ce/blob/master/hal/btc/halbtc8822b1ant.c): `hal/btc/halbtc8822b1ant.c`

### Other components

- **Network manager**
- **Linux kernel**
- **RTL8821CE device**

## Connections

- Network manager → cfg80211 interface: configures Wi-Fi
- Linux kernel → cfg80211 interface: exposes interface
- Linux kernel → Wireless ioctls: exposes ioctls
- cfg80211 interface → Connection management: requests connection
- Wireless ioctls → Connection management: requests connection
- Connection management → Common hardware control: controls link
- Transmit processing → PCIe transport: submits frames
- PCIe transport → RTL8821CE device: transfers frames
- RTL8821CE device → PCIe transport: delivers received frames
- PCIe transport → Receive processing: passes received frames
- Common hardware control → HALMAC interface: uses interface (evidence: `hal/hal_com.c`)
- RTL8821C operations → HALMAC API and registers: uses API
- HALMAC chip support → HALMAC API and registers: implements chip support
- RTL8821C operations → PCIe transport: configures transport
- RTL8821C operations → eFuse configuration: loads eFuse data
- RTL8821C operations → PHY and radio control: configures radio
- PHY and radio control → RTL8821C RF tables: applies RF settings (evidence: `hal/phydm/rtl8821c/halhwimg8821c_rf.c`)
- Connection management → Mesh networking: supports mesh mode
- Connection management → Wi-Fi Direct: supports peer discovery
- Common hardware control → Bluetooth coexistence: coordinates radio use
- Linux kernel → RTL8821CE device: loads driver for
