0% found this document useful (0 votes)
201 views23 pages

Prplmesh Infra Common

Uploaded by

何德威
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views23 pages

Prplmesh Infra Common

Uploaded by

何德威
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

PRPL mesh

Open Source Common


Foundation
Agenda
Infrastructure
• BTLVF (Beerocks Vendor specific TLVs library)
• BCL (Beerocks Common Library)
• BTL (Beerocks Transport Library)
• BWL (Beerocks WLAN Library)

Slide
2
BTLVF - Overview
● A set of YAML files for all beerocks messages / structs
● Relies on Framework’s TLVF python script and base classes
● History – Beerocks agent and controller used to communicate over UDS sockets for inter-node
(IPC) communication and TCP for intra-node communication

Code location:
https://github.com/prplfoundation/prplMesh/tree/master/common/beerocks/tlvf/
BTLVF
● Defines all Intel non-MultiAP messages

● Used in all Intel proprietary flows not yet converted to MultiAP flows

● Example – Slave Join == Autoconfig M1

Code location:
https://github.com/prplfoundation/prplMesh/tree/master/common/beerocks/tlvf/
BTLVF
● Single vendor specific TLV
○ Intel OUI followed by ACTION_HEADER
○ Action Header includes action and action op
■ action – internal destination of the message (son_slave, AP manager, etc.)
■ action op – operation requested
■ for internal routing and holds the message data

type length oui data

vendor specific Intel

action action op id data

action header
BTLVF
son slave main VS cmdu handler
switch (beerocks_header->action()) {
case beerocks_message::ACTION_CONTROL: {
return handle_cmdu_control_message(sd, beerocks_header, cmdu_rx);
} break;
case beerocks_message::ACTION_BACKHAUL: {
return handle_cmdu_backhaul_manager_message(sd, beerocks_header, cmdu_rx);
} break;
case beerocks_message::ACTION_PLATFORM: {
return handle_cmdu_platform_manager_message(sd, beerocks_header, cmdu_rx);
} break;
case beerocks_message::ACTION_APMANAGER: {
return handle_cmdu_ap_manager_message(sd, beerocks_header, cmdu_rx);
} break;
case beerocks_message::ACTION_MONITOR: {
return handle_cmdu_monitor_message(sd, beerocks_header, cmdu_rx);
} break;
default: {
LOG(ERROR) << "Unknown message, action: " << int(beerocks_header->action());
}
BTLVF
backhaul manager thread VS cmdu handling
// Handle messages
switch (beerocks_header->action_op()) {
case beerocks_message::ACTION_BACKHAUL_REGISTER_REQUEST: {
auto request = cmdu_rx.addClass<beerocks_message::cACTION_BACKHAUL_REGISTER_REQUEST>();
...
case beerocks_message::ACTION_BACKHAUL_ENABLE: {
auto request = cmdu_rx.addClass<beerocks_message::cACTION_BACKHAUL_ENABLE>();
...
}
BCL - Overview
● Beerocks Common Library

● Set of utilities and base classes which are used by both agent and controller.

● Examples
○ Network utils & structs – sIPv4Addr, sMacAddr, mac_to_string(), etc.
○ Socket abstraction classes and utilities
○ Configuration file parser class
○ Beerocks definitions
○ Versioning
○ FSM abstract class
○ Synchronization utilities and classes
○ Scripts (beerocks_utils.sh, beerocks_watchdog.sh, etc.)

Code location:
https://github.com/prplfoundation/prplMesh/tree/master/common/beerocks/bcl/
BCL – thread_base
●Abstract class for implementing work based threads
●single std::thread worker
BCL – socket_thread

● Abstract class for implementing select based threads

● All Main threads derive from socket_thread

○ AP Manager, son_slave_thread, AP Monitor, etc.

○ But not the backhaul manager and mrouter…

● Work function orchestrating select loop mechanism

○ Accepting new connections (server socket)

○ Detecting closed connections

○ CMDU handling
BCL – socket_thread

● Hooking mechanism for derived classes -

○ before_select – keep alives, fsm, timeouts handling, etc.

○ after_select – none-CMDUs handling

● Supports any Linux fds

● Mainly used for IPC using UDS sockets

● No support for intra-node communication using the local bus

○ BTL’s transport_socket_thread to the rescue…


BCL – socket_thread API

● init() – socket thread initilization


○ Creates server socket and adds it to the select
● work() – main thread loop
○ Sleeps on select and iterates on received sockets
○ Calls
■ before_select() – thread logic (e.g. FSM)
■ after_select() – non-CMDU handling (e.g. hostapd
events)
■ socket_connected() – new connected socket
handling
■ handle_cmdu() – pure virtual
■ socket_disconnected() - pure virtual
BCL - Socket Thread – Select loop
BTL- Overview
● Beerocks Transport Library, defines the transport_socket_thread class
● Derives from socket_thread
● Provides additional APIs to communicate over the local bus
○ Sending CMDUs via the transport service
● UDS Mode (build flag) – use UDS instead of local bus
○ Mainly for debug

PRPL mesh Controller PRPL mesh Agent


BTL BTL

Multi-AP Framework

Local Message Bus(XSub-XPub )

Code location:
https://github.com/prplfoundation/prplMesh/tree/master/common/beerocks/btl
BTL- Transport Socket Thread
● Work() – overridden to use LocalBusInterface and Poller
○ Replacement for select based loop
● Server Socket remains for accepting connections over UDS
● UDS header
○ Used for CMDUs internal routing
○ Source and Destination MAC  CmduMessageRx’s metadata
○ Destination MAC == AL MAC - controller  agent communication
○ Destination MAC == empty - internal messaging

dst src length swap_needed

AL MAC AL MAC

● Endianness conversion - controller  agent (intra-node) communication only


DWPAL - Overview
● Dynamic WLAN Platform Abstraction Layer (shared library)
● Includes:

○ wpa control interface abstraction for hostapd / wpa_supplicant

■ sending hostapd/wpa_supplicant commands

■ Receiving events / responses

○ netlink interface for interacting with the wireless driver

○ Parser for hostapd & wpa_supplicant events / responses


BWL- Overview
● Beerocks WLAN Library

● hostapd / wpa_supplicant abstraction

○ send commands, receive responses / events (via DWPAL)

● Components

○ ap_wlan_hal – AP (hostapd) management APIs

○ sta_wlan_hal – STA (wpa_supplicant) management APIs

○ mon_wlan_hal – Monitoring (hostapd) APIs

Code Location
https://github.com/prplfoundation/prplMesh/tree/master/common/beerocks/bwl
BWL
● Initialization – Attach FSM
○ Opens socket to hostapd/supplicant (via DWPAL)
○ Reads radio info (Intel GET_RADIO_INFO patch)
○ Succeeds once hostapd state reach expected state
■ ACS_DONE for ACS mode (Intel patch)
■ ENABLED for static channel
■ STA/Monitor – on GET_RADIO_INFO success
BWL
● ACS_DONE – hostapd patch
○ hostapd.conf setting - acs_scan_mode=1
○ hostapd stops after SCAN
○ No beaconing before autoconfiguration (MultiAP requirement)
○ Can be implemented with start_disabled=1 (in progress)
BWL- Attach FSM
● Example attach FSM for AP with auto channel (acs) and ACS_DONE
enabled

● Attach event is fired repeatedly by the attach API method called by the
upper layer - ap_wlan_hal->attach()
BWL-
Example flow
BWL- Class Diagram
Thank
you
Open Source
Foundation

You might also like