RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
Info |
---|
Work In Progress |
Table of Contents |
---|
This This guide will help RDK-B community to port OneWifi on their platforms
RDK-B Software Architects and Engineers
TBD
...
The internal functional entities of the OneWifi process are as shown in the above diagram. OneWifi software architecture is essentially a multi-threaded software architecture, the three main threads are
The software architecture of working of each thread is detailed below.
The diagram below depicts thread management and inter thread communication and data transfer in OneWifi. Threads essentially wait for condition and timeouts. If data needs to be processed, the data is posted into queue and the thread is signaled. The thread retrieves the data from the queue and processes the data
The core thread waits for events or messages, if there are events or messages in the FIFO queue, the thread retrieves the events or messages one after another and takes appropriate action. Three kinds of messages or events can be enqueued in the Core thread queue
All south bound messages are decoded, parsed and validated by core thread. In case, the messages are successfully validated, the core thread uses Wi-Fi HAL function to configure Wi-Fi driver or baseband accordingly. if successful, core thread is also resonsible for updating the persistent database so that in case of reboot or power failure, the Wi-Fi subsystem of the CPE device maintain previous operating configuration. Core thread also handles Wi-Fi or Factory reset commands that may be triggered by messages enqueued by DML thread or during initialization sequence.
All north bound events are translated to state update in ovddb state tables using WebConfig encoded messages sent by core to ovsdb manager.
Some of the components described are as follows:
All components are intended to schedule most of the actual work through separate dispatch handlers per object entities. This allows easy batching (to debounce and reduce ping-pong), time occupancy (to provide insight into possible stalls, or aid scheduling), forces idempotency (avoids some ab/ba logic issues, provides failure recovery procedures without additional explicit logic) and makes sure memory resource allocation is bound.
OneWifi can operate in two modes, router and extender.
In router mode, the stack broadcasts front haul virtual access points that client devices may connect with. Total of seven such virtual access points are created on each radio and provide different kinds of services.
TBD
Core Thread Pseudo Code
PlantUML Macro |
---|
@startuml
skinparam defaultTextAlignment center
!pragma useVerticalIf on
start
:core_thread_start_function;
:rbus_register\n(rbus_message_cb)|
:read_wifi_ps_db|
:wifi_hal_init|
:wifi_hal_events_register\n(wifi_hal_cb)|
repeat :for_each_radio
:wifi_hal_setRadioOperatingParams|
:wifi_hal_createVAP|
repeat while()
repeat :event_queue_wait;
split
:rbus_event\n(web_config_message)<
:decode_message|
if (msg eq webconfig_msg) then (yes)
if (validate_msg() eq SUCCESS) then (yes)
:rbus_send_to_webconfig(ACK)>
else (no)
:rbus_send_to_webconfig(NACK)>
stop
endif
if (wifi_hal_func() eq SUCCESS\n(HAL Wrapper)) then (yes)
:write_wifi_ps_db|
:rbus_send_to_webconfig(SUCCESS)>
else (no)
:rbus_send_to_webconfig(FAILURE)>
endif
elseif (msg eq ovdsbmgr_msg) then (yes)
if (validate_msg() eq SUCCESS) then (yes)
:rbus_send_to_ovsdbmgr(ACK)>
else (no)
:rbus_send_to_ovsdbmgr(NACK)>
stop
endif
if (wifi_hal_func() eq SUCCESS\n(HAL Wrapper)) then (yes)
:write_wifi_ps_db|
:rbus_send_to_ovsdbmgr(SUCCESS)>
else (no)
:rbus_send_to_ovsdbmgr(FAILURE)>
endif
endif
split again
:dml_event\n(web_config_message)<
:decode_message|
if (validate_msg() eq SUCCESS) then (yes)
if (wifi_hal_func() eq SUCCESS) then (yes)
:write_wifi_ps_db|
endif
endif
split again
:hal_event\n(hal_cb_event)<
if (event eq assoc_event) then (yes)
:create_ovsdb_state_blob)|
:rbus_send_to_ovsdbmgr(json_blob)>
elseif (event eq disassoc_event) then (yes)
:create_ovsdb_state_blob)|
:rbus_send_to_ovsdbmgr(json_blob)>
elseif (event eq vap_up_event) then (yes)
:create_ovsdb_state_blob)|
:rbus_send_to_ovsdbmgr(json_blob)>
elseif (event eq vap_down_event) then (yes)
:create_ovsdb_state_blob)|
:rbus_send_to_ovsdbmgr(json_blob)>
elseif (event eq bsal_event) then (yes)
if (bsal_event eq bsal_event_probe_req) then (yes)
:handle_bm_probe|
elseif (bsal_event eq bsal_event_client_connect) then (yes)
:handle_bm_client_connect|
elseif (bsal_event eq bsal_event_client_disconnect) then (yes)
:handle_bm_client_disconnect|
elseif (bsal_event eq bsal_event_rssi_xing) then (yes)
:handle_bm_rssi_xing|
endif
endif
split again
:timeout<
:stats_collection|
end split
repeat while()
:core_thread_end;
stop
start
:rbus_message_cb;
:create_rbus_event|
:event_queue_push(rbus_event)>
stop
start
:wifi_hal_cb;
:create_hal_event|
:event_queue_push(hal_event)>
stop
@enduml |
Initialization
PlantUML Macro |
---|
@startuml
hide footbox
skinparam SequenceMessageAlign center
participant AGENT as "Core Thread"
participant HAL as "WiFi HAL Wrapper"
participant HOSTAP as "hostap"
participant DRIVER as "WiFi Driver"
participant LINUX as "Linux System"
group ctrl-plane
AGENT -> HAL: wifi_init
group Interfaces Enumeration
HAL -> LINUX: nl_80211cmd(NL80211_CMD_GET_WIPHY, NLM_F_DUMP, wiphy_dump_handler)
LINUX -> HAL: wiphy_dump_handler(NL80211_ATTR_WIPHY = 0, NL80211_ATTR_WIPHY_NAME, NL80211_ATTR_SUPPORTED_COMMANDS)
LINUX -> HAL: wiphy_dump_handler(NL80211_ATTR_WIPHY = 1, NL80211_ATTR_WIPHY_NAME, NL80211_ATTR_SUPPORTED_COMMANDS)
LINUX -> HAL: wiphy_dump_handler(NL80211_ATTR_WIPHY = 2, NL80211_ATTR_WIPHY_NAME, NL80211_ATTR_SUPPORTED_COMMANDS)
end
group for each Interface
HAL -> LINUX: HAL -> LINUX: nl_80211cmd(NL80211_CMD_GET_WIPHY, NL80211_ATTR_WIPHY = i, wiphy_get_info_handler)
LINUX -> HAL: wiphy_get_info_handler(NL80211_ATTR_CIPHER_SUITES, NL80211_ATTR_WIPHY_BANDS)
group for each band in NL80211_ATTR_WIPHY_BANDS
HAL -> HAL: phy_info_frequencies
HAL -> HAL: phy_info_ht_capa
HAL -> HAL: phy_info_vht_capa
HAL -> HAL: phy_info_rates
end group
end
HAL -> HOSTAP: eloop_init
HAL -> HOSTAP: eap_server_register_methods
HAL --> AGENT: Success
AGENT -> HAL: wifi_getHalCapability
HAL <-> DRIVER: get phy device capabilities
HAL --> AGENT: Success
group for each Radio
AGENT -> HAL: wifi_setRadioOperatingParameters(index, radio_param)
HAL <-> DRIVER: set radio parameters
HAL -> HOSTAP: update_hostap_config_params (update struct hostapd_config for this radio)
HAL --> AGENT: Success
AGENT -> HAL: wifi_createVAP(radio, vap_map)
group for each VAP
HAL --> LINUX: create interface
group vap_mode_ap
HAL -> LINUX: nl80211_cmd(NL80211_CMD_SET_INTERFACE, NL80211_IFTYPE_AP)
HAL -> HOSTAP: update_hostap_data (update struct hostapd_data for this interface)
HAL -> HOSTAP: update_hostap_bss (update struct hostapd_bss_config for this interface)
HAL -> HOSTAP: update_hostap_iface (update struct hostapd_iface for this interface)
HAL -> HOSTAP: setup_driver(wpa_drv_ops)
HAL -> HOSTAP: drv_init
HAL -> HOSTAP: hostapd_setup_bss(hostapd_data)
HOSTAP -> HAL: flush
HAL -> DRIVER: wifi_drv_flush
HOSTAP -> HAL: sta_deauth
HAL -> DRIVER: wifi_drv_sta_deauth
HOSTAP -> HAL: set_key
HAL -> DRIVER: wifi_drv_set_key
HOSTAP -> HAL: set_ap
HAL -> DRIVER: wifi_drv_set_ap
HOSTAP -> HAL: set_operstate
HAL -> DRIVER: nl80211_register_mgmt_frames(NL80211_CMD_FRAME, process_mgmt_frame)
HAL -> LINUX: bridge_rx(raw socket listen)
end
group vap_mode_sta
HAL -> LINUX: nl80211_cmd(NL80211_CMD_SET_INTERFACE, NL80211_IFTYPE_STA)
HAL -> LINUX: nl80211_start_scan(NL80211_CMD_TRIGGER_SCAN)
HAL -> LINUX: interface_rx(raw socket listen)
end
end
HAL --> AGENT: Success
end
AGENT -> HAL: wifi_run
HAL -> HOSTAP: eloop_run
HOSTAP -> HOSTAP: eloop
end
@enduml |
Client Authentication
PlantUML Macro |
---|
@startuml
hide footbox
skinparam SequenceMessageAlign center
participant HAL as "WiFi HAL Wrapper"
participant HOSTAP as "hostap"
participant DRIVER as "WiFi Driver"
participant LINUX as "Linux System"
participant STA as "Client Device"
group client authentication (WPA2 and WPA3 handshakes)
group mlme
STA -> DRIVER: Auth Frame
DRIVER -> HAL: process_mgmt_frame(NL80211_ATTR_FRAME, frame = auth)
HAL -> HOSTAP: wpa_supplicant_event(EVENT_RX_MGMT, event.frame = frame)
HOSTAP -> HAL: send_mlme(auth)
HAL -> DRIVER: wifi_drv_send_mlme(auth)
DRIVER -> STA: Auth Frame
STA -> DRIVER: Assoc Req Frame
DRIVER -> HAL: process_mgmt_frame(NL80211_ATTR_FRAME, frame = assoc req)
HAL -> HOSTAP: wpa_supplicant_event(EVENT_RX_MGMT, event.frame = assoc req)
HOSTAP -> HAL: send_mlme(assoc resp)
HAL -> DRIVER: wifi_drv_send_mlme(assoc resp)
DRIVER -> STA: Assoc Resp Frame
DRIVER -> HAL: nl80211_event(NL80211_CMD_FRAME_TX_STATUS)
HAL -> HOSTAP: wpa_supplicant_event(EVENT_TX_STATUS)
end
group non-mlme
STA -> DRIVER: Auth Frame
DRIVER -> STA: Auth Frame
STA -> DRIVER: Assoc Req Frame
DRIVER -> STA: Assoc Resp Frame
DRIVER -> HAL: nl80211_event(NL80211_CMD_NEW_STATION)
HAL -> HOSTAP: wpa_supplicant_event(EVENT_TX_ASSOC)
end
note over HOSTAP
start 802.1x authentication
end note
HOSTAP -> HAL: hapd_send_eapol(EAPOL 1/4)
HAL -> DRIVER: bridge_tx(EAPOL 1/4)
DRIVER -> STA: EAPOL 1/4
STA -> DRIVER: EAPOL 2/4
DRIVER -> HAL: bridge_rx (EAPOL 2/4)
HAL -> HOSTAP: wpa_supplicant_event(EVENT_EAPOL_RX, event.frame = eapol)
HOSTAP -> HAL: hapd_send_eapol(EAPOL 3/4)
HAL -> DRIVER: bridge_tx(EAPOL 3/4)
DRIVER -> STA: EAPOL 3/4
STA -> DRIVER: EAPOL 4/4
DRIVER -> HAL: bridge_rx (EAPOL 4/4)
HAL -> HOSTAP: wpa_supplicant_event(EVENT_EAPOL_RX, event.frame = eapol)
HOSTAP -> HAL: set_key
HAL -> DRIVER: wifi_drv_set_key
HOSTAP -> HAL: set_sta_flags
HAL -> DRIVER: wifi_drv_set_sta_flags
end
@enduml |
Jira | ||||||
---|---|---|---|---|---|---|
|
...
draw.io Diagram | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Integration segments:
draw.io Diagram border true diagramName integration possibilities simpleViewer false width links auto tbstyle top lbox true diagramWidth 402 revision 1
Dependencies to build OneWifiDependencies to build ccsp-one-wifi
draw.io Diagram border true diagramName onewifidependency simpleViewer false width links auto tbstyle top lbox true diagramWidth 15611551 revision 11
Recipe location:
14
...
1.meta-raspberrypi ( Or )meta-cmf-soc-<soc name> ------- Firmware/drivers/kernel to be available
2.
...
meta-rdk-broadband/recipes-ccsp/ccsp/ccsp-one-wifi.bbappend
meta-cmf-raspberrypi
...
(Or) meta-cmf-<platformname> --------- RDK-B changes to specific to SOC platform
3.meta-cmf-broadband ----------- RDK-B changes which are common for all RDK-B community members
wifi_hal_sendDataFrame |
wifi_hal_newApAssociatedDevice_callback_register |
wifi_hal_apDeAuthEvent_callback_register |
wifi_hal_apDisassociatedDevice_callback_register |
wifi_hal_register_frame_hook |
wifi_hal_disassoc |
wifi_hal_send_mgmt_frame_response |
wifi_hal_init |
wifi_hal_getHalCapability |
wifi_hal_setRadioOperatingParameters |
wifi_hal_createVAP |
wifi_hal_startScan |
wifi_hal_connect |
wifi_hal_get_default_country_code |
wifi_hal_get_default_ssid |
wifi_hal_get_default_keypassphrase |
wifi_hal_get_default_wps_pin |
wifi_hal_get_default_ssid |
wifi_hal_get_default_radius_key |
wifi_hal_setRadioOperatingParameters |
wifi_hal_staConnectionStatus_callback_register |
wifi_hal_scanResults_callback_register |
wifi_hal_mgmt_frame_callbacks_register |
wifi_hal_getRadioVapInfoMap |
wifi_hal_delApAclDevice |
wifi_hal_addApAclDevice |
wifi_hal_kickAssociatedDevice |
wifi_hal_setApWpsButtonPush |
wifi_hal_setApWpsPin |
wifi_hal_disconnect |
wifi_hal_getRadioOperatingParameters |
wifi_hal_getScanResults |
Jira | ||||||
---|---|---|---|---|---|---|
|
rdkb-wifi.db
Code Block |
---|
dmcli eRT setv Device.WiFi.Radio.2.X_CISCO_COM_ApplySetting bool true
dmcli eRT setv Device.WiFi.Radio.1.X_CISCO_COM_ApplySetting bool true |
Code Block |
---|
#Any dmcli commands specific to SSID and AccessPoint execute the Below Access Point Related apply settings
dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true
#Any dmcli executions specific to Radio level use the below Radio apply settings command
dmcli eRT setv Device.WiFi.ApplyRadioSettings bool true |
Below are the list of logs present in /rdklogs/logs for Debugging OneWiFi Issues.
For Additional in-depth Debugging one should enable below commands ,
check for the respective logs in /tmp,
tail -f wifiDb &
Initial Headers: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/halinterface/+/490e08dc0edc9180a18c60eb4d6d3b0c85a1ebe3
Below things will be supported by Onewifi as part of Wi-Fi 7 which includes changes in onewifi ,rdk-wifi-hal & libhostap(for Wi-Fi 7 we use libhostap 2.11 version )
...