How sneha3821/rdk-wifi-hal works
Purpose and Build Surface
rdk-wifi-hal is a native C/C++ Wi-Fi Hardware Abstraction Layer implementing Wi-Fi control state machines and packet processing, including EasyConnect/DPP and Passpoint/ANQP. Autotools is the primary build integration, rooted at configure.ac, Makefile.am, and src/Makefile.am.
HAL Core and Public/Private Boundary
The central HAL implementation exposes RDK-oriented Wi-Fi operations while maintaining internal state and framework contracts. src/wifi_hal.c is the core implementation; src/wifi_hal_rdk.h and src/wifi_hal_rdk_framework.h define HAL/framework-facing interfaces; src/wifi_hal_priv.h holds internal shared definitions. Platform code is expected to supply hardware-specific behavior beneath this layer.
Platform Adaptation Layer
Per-target platform implementations isolate chipset, OS, and driver differences from the common HAL. Representative targets are platform/broadcom/platform.c, platform/intel/platform.c, and platform/qualcomm/platform_xer5.c; other targets include Banana Pi, Raspberry Pi, an emulator, and XLE. Banana Pi additionally carries OpenWrt kernel patches under platform/banana-pi/kernel-patches_6.6/openwrt/, indicating a kernel/driver dependency for some wireless features.
Linux Wi-Fi Driver and Event Integration
The common HAL communicates with Linux wireless infrastructure through nl80211 and processes asynchronous driver events. src/wifi_hal_nl80211.c handles nl80211 interaction, src/wifi_hal_nl80211_events.c maps received events into HAL behavior, and src/wifi_hal_nl80211_utils.c supplies shared protocol/driver utilities. This is the principal boundary to kernel Wi-Fi drivers and netlink.
Access-Point and Management-Frame Processing
Hostapd integration and management/data receive paths process 802.11 traffic and route it into feature-specific logic. src/wifi_hal_hostapd.c bridges AP daemon behavior, src/wifi_hal_mgmt_rx.c handles management-frame reception, and src/wifi_hal_data_rx.c handles data frames. src/ieee80211.h provides IEEE 802.11 protocol definitions used across these paths.
Wi-Fi Feature State Machines
Specialized modules implement higher-level Wi-Fi protocols on top of received frames, hostapd, and driver state. DPP/EasyConnect is implemented by src/wifi_hal_dpp.c with a separately buildable feature component in feature_dpp/dpp.c. Passpoint-related ANQP processing is in src/wifi_hal_anqp.c; WNM/RRM functionality is in src/wifi_hal_wnm_rrm.c. These modules form protocol-specific control and packet-processing stages rather than platform implementations.
IPC Server Boundary
A HAL IPC server exposes Wi-Fi HAL operations to external local consumers, separating request handling from direct hardware access. hal_ipc/server/server_hal_ipc.c implements server orchestration, hal_ipc/server/hal_ipc_processors.c dispatches/processes requests, and hal_ipc/server/hal_ipc_wifi_wrappers.c adapts IPC operations to Wi-Fi HAL calls. Control flow is client request → IPC processor/wrapper → common HAL → platform/driver layer.
Shared Data and Cryptography
Collection utilities support common in-memory data organization in src/collection.c and util/collection.c. TLV encoding/decoding is centralized in src/wifi_tlv.c, likely supporting protocol or IPC payloads. util_crypto/aes_siv.c provides AES-SIV cryptography, a dependency relevant to secure Wi-Fi protocol processing such as DPP.
Main entry points: wifi_hal.c Wi-Fi HAL core · wifi_hal_nl80211_events.c Driver event mapper · wifi_hal_mgmt_rx.c Management RX · wifi_hal_nl80211.c nl80211 adapter
Components 22
Build
- Autotools build · Build surface rooted in configure.ac and Makefile.am files.
configure.ac
Common HAL
- HAL framework API · Public HAL and RDK framework contracts.
src/wifi_hal_rdk.h - Wi-Fi HAL core · Central RDK Wi-Fi control state and operations.
src/wifi_hal.c - TLV codec
src/wifi_tlv.c
Linux Wi-Fi Integration
- nl80211 adapter
src/wifi_hal_nl80211.c - Driver event mapper
src/wifi_hal_nl80211_events.c - hostapd bridge
src/wifi_hal_hostapd.c - Management RX
src/wifi_hal_mgmt_rx.c - Data RX
src/wifi_hal_data_rx.c - Linux Wi-Fi drivers · Kernel wireless stack reached through netlink and platform code.
Protocol Features
- DPP / EasyConnect
src/wifi_hal_dpp.c - DPP feature component · Separately buildable DPP implementation.
feature_dpp/dpp.c - Passpoint ANQP
src/wifi_hal_anqp.c - WNM / RRM
src/wifi_hal_wnm_rrm.c - AES-SIV crypto
util_crypto/aes_siv.c
Local IPC Server
- IPC server
hal_ipc/server/server_hal_ipc.c - IPC processors
hal_ipc/server/hal_ipc_processors.c - HAL IPC wrappers
hal_ipc/server/hal_ipc_wifi_wrappers.c
Platform Adaptations
- Broadcom platform
platform/broadcom/platform.c - Intel platform
platform/intel/platform.c - Qualcomm XER5 platform
platform/qualcomm/platform_xer5.c - Banana Pi kernel patches · OpenWrt kernel/driver dependency for some wireless features.
Connections 26
- Autotools build → Wi-Fi HAL core: builds
- Autotools build → DPP feature component: builds
- HAL framework API → Wi-Fi HAL core: defines contract for
- Wi-Fi HAL core → nl80211 adapter: uses
- nl80211 adapter → Driver event mapper: receives events through
- nl80211 adapter → Linux Wi-Fi drivers: netlink
- Driver event mapper → Wi-Fi HAL core: updates HAL behavior
- hostapd bridge → Wi-Fi HAL core: bridges AP control
- Driver event mapper → Management RX: routes management frames
- Driver event mapper → Data RX: routes data frames
- Management RX → DPP / EasyConnect: feeds protocol frames
- Management RX → Passpoint ANQP: feeds queries
- Management RX → WNM / RRM: feeds management frames
- DPP / EasyConnect → DPP feature component: uses
- DPP / EasyConnect → AES-SIV crypto: uses
- Wi-Fi HAL core → TLV codec: encodes payloads
- IPC server → IPC processors: forwards requests
- IPC processors → HAL IPC wrappers: dispatches
- HAL IPC wrappers → Wi-Fi HAL core: invokes HAL
- Wi-Fi HAL core → Broadcom platform: delegates platform behavior
- Wi-Fi HAL core → Intel platform: delegates platform behavior
- Wi-Fi HAL core → Qualcomm XER5 platform: delegates platform behavior
- Broadcom platform → Linux Wi-Fi drivers: accesses
- Intel platform → Linux Wi-Fi drivers: accesses
- Qualcomm XER5 platform → Linux Wi-Fi drivers: accesses
- Banana Pi kernel patches → Linux Wi-Fi drivers: patches