Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Dunfell
  2. Kirkstone(supported from rdkb2023q4 official release)

High level architecture:

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 

  • Core thread: this thread is the fundamental engine of the process that is responsible for all configuration of WiFi parameters, command/control/status response and WiFi state indications. The core thread is also responsible for steering related activities.
  • DML thread: this thread handles the TR-181 set/get handlers. 
  • Apps thread: this thread is responsible for supporting all WiFi related application/features such as harvester, motion sensing, blaster, single client measurements etc.

The software architecture of working of each thread is detailed below.


OneWiFi Thread Management, Inter Thread Communication and Data Handling

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

Image Added

Core Functional Blocks/Subsystem

Image Added


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

  1. South bound messages received from WebConfig Agent or Ovsdb Managervia RBUS callback.
  2. South bound messages received from DML thread because of TR-181 set handler invocation
  3. North bound asynchronous Wi-Fi events from HAL or driver isuch as
    1. Client associations/disassociations
    2. VAP or interface Up/Down
    3. Registered 802.11mgmt frame reception
    4. Band Steering events

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.


Core Thread Software Architecture

Image Added


Some of the components described are as follows:

  • Config Tracker - serves as an internal database for all Radio and VAP attributes. To be consumed by OneWifi internals, eg. stats policies, steering policies, configuration applicator, etc. Intended to be acting as a south bound interface and called by adapters to integrate them into specific systems, eg. rbus+webconfig.
  • State Tracker - serves as a layer to shield OneWifi business logic modules from HAL API which is intended to not be fully object oriented.and to simplify its implementation, eg. event buffer overrun recovery handling, event order sanitization (sometimes implementations source events from multiple streams and their processing ordering is undefined).
  • Configuration Applicator - uses inputs: Config Tracker and other mutators (coming from, eg. Stats or Steering policies) to generate configuration command(s) and submit them only if the assembled configuration command is out-of-sync with what State Tracker is reporting. Configuration Applicator is triggered for recompute by either Config Tracker, State Tracker or any of the registered mutators.
  • Steering/Stats/Other policies - multiple entities implementing specific actions. Mostly interact with State Tracker, Configuration Applicator (as mutators), HAL wrapper (to perform world-visible actions) or between each other modules (Steering modules using some Stats).
  • Rbus-webconfig adapter - adaptation logic which feeds Config Tracker based on Webconfig blobs. Essentially a translator to abstract Webconfig away from core logic. Foo thread / foo adapter - approach recommended on integrating other existing, or thread-heavy tasks. The OneWifi core is a single thread expecting no other threads interacting directly with its data structures or control flows, so adapters and their dispatch handlers are expected to be the entry/exit points between threads to simplify locking.
  • HAL wrapper - virtually a HAL API that allows multiple backing implementations: Wifi HAL, Target API or other in the future. Intended to be mostly stateless and simple "pass through" - allowing out-of-order event delivery, etc. This allows simpler implementation for vendors. The task of sanitizing is handed to State Tracker for actual business logic consumers. The HAL wrapper API is highly aggregated (big blob call for configuration, singular calls for adequate actions like WPS PBC) with hints on which attributes are out-of-sync allowing implementations to optimize if desired. The wrapper is also capable of supporting multiple backing implementations at the same time (without requiring business logic implementation to be aware of any of that) to accommodate mixed vendor chips (on non-Wifi-Hal platforms) such as Broadcom + Quantenna.

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.

Image Added


Operational Modes

OneWifi can operate in two modes, router and extender. 

Router Mode

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. 

Extender Mode

TBD


Flow Diagram/Pseudo Code

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


Epic details:

  • Jira
    serverJIRA - 2
    serverId11deff04-0380-3a3d-a916-0849d4e573f7
    keyREFPLTB-2020

...