Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
agent: backhaul_manager: add READY_FOR_MASTER_DISCOVERY state
Browse files Browse the repository at this point in the history
https://jira.prplfoundation.org/browse/PPM-143

Add READY_FOR_MASTER_DISCOVERY state to backhaul_manager state machine.
In certification mode the agent state machine should stop before the MASTER_DISCOVERY state
and wait for dev_set_config (wired backhaul) or start_wps_registration (wireless backhaul).

In non-certification mode this state has no meaning,
the state will change to MASTER_DISCOVERY on the next tick of backhaul_manager_thread.

Signed-off-by: Vitalii Komisarenko <[email protected]>
  • Loading branch information
vitalii-komisarenko committed Jul 28, 2020
1 parent 6c9f9d1 commit f99aec2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ bool backhaul_manager::backhaul_fsm_main(bool &skip_select)
// Ignore 'selected_backhaul' since this case is not covered by certification flows
if (db->device_conf.local_controller && db->device_conf.local_gw) {
LOG(DEBUG) << "local controller && local gw";
FSM_MOVE_STATE(MASTER_DISCOVERY);
FSM_MOVE_STATE(READY_FOR_MASTER_DISCOVERY);
db->backhaul.connection_type = AgentDB::sBackhaul::eConnectionType::Invalid;
db->backhaul.selected_iface_name.clear();
} else { // link establish
Expand Down Expand Up @@ -897,13 +897,27 @@ bool backhaul_manager::backhaul_fsm_main(bool &skip_select)
if (db->backhaul.connection_type == AgentDB::sBackhaul::eConnectionType::Wireless) {
FSM_MOVE_STATE(INIT_HAL);
} else { // EType::Wired
FSM_MOVE_STATE(MASTER_DISCOVERY);
FSM_MOVE_STATE(READY_FOR_MASTER_DISCOVERY);
}

skip_select = true;
}
break;
}
case EState::READY_FOR_MASTER_DISCOVERY: {
auto certification_mode = bpl::cfg_get_certification_mode();
if (certification_mode < 0) {
LOG(ERROR) << "Failed reading certification_mode: " << certification_mode;
return false;
}
// In certification mode we want to wait till dev_set_config is received (wired backhaul)
// or start_wps_registration (wireless backhaul).
// Otherwise switch to MASTER_DISCOVERY
if (!certification_mode) {
FSM_MOVE_STATE(MASTER_DISCOVERY);
}
break;
}
case EState::MASTER_DISCOVERY: {

auto db = AgentDB ::get();
Expand Down Expand Up @@ -3729,7 +3743,7 @@ bool backhaul_manager::hal_event_handler(bwl::base_wlan_hal::hal_event_ptr_t eve
}
if (FSM_IS_IN_STATE(WAIT_WPS)) {
db->backhaul.selected_iface_name = iface;
FSM_MOVE_STATE(MASTER_DISCOVERY);
FSM_MOVE_STATE(READY_FOR_MASTER_DISCOVERY);
}
if (FSM_IS_IN_STATE(WIRELESS_ASSOCIATE_4ADDR_WAIT)) {
LOG(DEBUG) << "successful connect on iface=" << iface;
Expand Down Expand Up @@ -3780,7 +3794,7 @@ bool backhaul_manager::hal_event_handler(bwl::base_wlan_hal::hal_event_ptr_t eve
// Send slaves to enable the AP's
send_slaves_enable();

FSM_MOVE_STATE(MASTER_DISCOVERY);
FSM_MOVE_STATE(READY_FOR_MASTER_DISCOVERY);
} else if (FSM_IS_IN_STATE(WIRELESS_WAIT_FOR_RECONNECT)) {
LOG(DEBUG) << "reconnected successfully, continuing";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ class backhaul_manager : public btl::transport_socket_thread {
STATE(WIRELESS_WAIT_FOR_RECONNECT) \
STATE(_WIRELESS_END_) \
\
STATE(READY_FOR_MASTER_DISCOVERY) \
STATE(MASTER_DISCOVERY) \
STATE(SEND_AUTOCONFIG_SEARCH_MESSAGE) \
STATE(WAIT_FOR_AUTOCONFIG_RESPONSE_MESSAGE) \
Expand Down

0 comments on commit f99aec2

Please sign in to comment.