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

Commit 5c9b97b

Browse files
agent: backhaul_manager: add READY_FOR_MASTER_DISCOVERY state
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 <vitalii.komisarenko@gmail.com>
1 parent 6c9f9d1 commit 5c9b97b

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ bool backhaul_manager::backhaul_fsm_main(bool &skip_select)
841841
// Ignore 'selected_backhaul' since this case is not covered by certification flows
842842
if (db->device_conf.local_controller && db->device_conf.local_gw) {
843843
LOG(DEBUG) << "local controller && local gw";
844-
FSM_MOVE_STATE(MASTER_DISCOVERY);
844+
FSM_MOVE_STATE(READY_FOR_MASTER_DISCOVERY);
845845
db->backhaul.connection_type = AgentDB::sBackhaul::eConnectionType::Invalid;
846846
db->backhaul.selected_iface_name.clear();
847847
} else { // link establish
@@ -897,13 +897,27 @@ bool backhaul_manager::backhaul_fsm_main(bool &skip_select)
897897
if (db->backhaul.connection_type == AgentDB::sBackhaul::eConnectionType::Wireless) {
898898
FSM_MOVE_STATE(INIT_HAL);
899899
} else { // EType::Wired
900-
FSM_MOVE_STATE(MASTER_DISCOVERY);
900+
FSM_MOVE_STATE(READY_FOR_MASTER_DISCOVERY);
901901
}
902902

903903
skip_select = true;
904904
}
905905
break;
906906
}
907+
case EState::READY_FOR_MASTER_DISCOVERY: {
908+
auto certification_mode = bpl::cfg_get_certification_mode();
909+
if (certification_mode < 0) {
910+
LOG(ERROR) << "Failed reading certification_mode: " << certification_mode;
911+
return false;
912+
}
913+
// In certification mode we want to wait till dev_set_config is received (wired backhaul)
914+
// or start_wps_registration (wireless backhaul).
915+
// Otherwise switch to MASTER_DISCOVERY
916+
if (!certification_mode) {
917+
FSM_MOVE_STATE(MASTER_DISCOVERY);
918+
}
919+
break;
920+
}
907921
case EState::MASTER_DISCOVERY: {
908922

909923
auto db = AgentDB ::get();

agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ class backhaul_manager : public btl::transport_socket_thread {
559559
STATE(WIRELESS_WAIT_FOR_RECONNECT) \
560560
STATE(_WIRELESS_END_) \
561561
\
562+
STATE(READY_FOR_MASTER_DISCOVERY) \
562563
STATE(MASTER_DISCOVERY) \
563564
STATE(SEND_AUTOCONFIG_SEARCH_MESSAGE) \
564565
STATE(WAIT_FOR_AUTOCONFIG_RESPONSE_MESSAGE) \

0 commit comments

Comments
 (0)