From b324a9419642c668d436c3a3c085584309173f82 Mon Sep 17 00:00:00 2001 From: Itay Elenzweig Date: Mon, 20 Apr 2020 20:51:12 +0000 Subject: [PATCH 1/7] beerocks_defines: Change SUPPORTED_CHANNELS_LENGTH to RADIO_CHANNELS_LENGTH The SUPPORTED_CHANNELS_LENGTH is used throughout the code-base. It is used to set the maximum number of channels in the preferred and supported channel list. Since the SUPPORTED_CHANNELS_LENGTH isn't used only for the supported_channels but is used for all radio channel the current name is incorrect. Rename the SUPPORTED_CHANNELS_LENGTH to RADIO_CHANNELS_LENGTH. Increase the value to 128 to allow for the full size of the available channels. Signed-off-by: Itay Elenzweig --- .../src/beerocks/slave/ap_manager_thread.cpp | 2 +- .../backhaul_manager_thread.cpp | 2 +- .../backhaul_manager_thread.h | 2 +- agent/src/beerocks/slave/son_slave_thread.cpp | 10 ++++---- agent/src/beerocks/slave/tlvf_utils.cpp | 2 +- agent/src/beerocks/slave/tlvf_utils.h | 2 +- .../bcl/include/bcl/beerocks_defines.h | 2 +- .../bcl/source/son/son_wireless_utils.cpp | 8 +++---- .../bwl/include/bwl/base_wlan_hal_types.h | 2 +- .../beerocks/tlvf/beerocks_message_common.h | 10 ++++---- .../tlvf/beerocks_message_apmanager.cpp | 24 +++++++++---------- .../tlvf/beerocks_message_backhaul.cpp | 12 +++++----- .../tlvf/beerocks_message_control.cpp | 12 +++++----- .../tlvf/beerocks_message_apmanager.yaml | 4 ++-- .../tlvf/beerocks_message_backhaul.yaml | 2 +- .../tlvf/beerocks_message_common.yaml | 6 ++--- .../tlvf/beerocks_message_control.yaml | 2 +- .../src/beerocks/master/son_master_thread.cpp | 8 +++---- .../master/tasks/channel_selection_task.cpp | 2 +- .../master/tasks/channel_selection_task.h | 4 ++-- .../tasks/dynamic_channel_selection_task.cpp | 2 +- 21 files changed, 60 insertions(+), 60 deletions(-) diff --git a/agent/src/beerocks/slave/ap_manager_thread.cpp b/agent/src/beerocks/slave/ap_manager_thread.cpp index 99cbe63904..6ed3feca87 100644 --- a/agent/src/beerocks/slave/ap_manager_thread.cpp +++ b/agent/src/beerocks/slave/ap_manager_thread.cpp @@ -39,7 +39,7 @@ static void copy_radio_supported_channels(std::shared_ptr &ap_ auto radio_channels = ap_wlan_hal->get_radio_info().supported_channels; // Copy the channels - for (uint i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH && i < radio_channels.size(); + for (uint i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH && i < radio_channels.size(); i++) { supported_channels[i].channel = radio_channels[i].channel; diff --git a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp index ed056089ec..98a66cb390 100644 --- a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp +++ b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp @@ -1784,7 +1784,7 @@ bool backhaul_manager::handle_slave_backhaul_message(std::shared_ptr auto channels = &std::get<1>(tuple_supported_channels); - std::copy_n(channels, beerocks::message::SUPPORTED_CHANNELS_LENGTH, + std::copy_n(channels, beerocks::message::RADIO_CHANNELS_LENGTH, soc->supported_channels.begin()); soc->radio_mac = request->iface_mac(); diff --git a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.h b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.h index 9b2941d7eb..334524d629 100644 --- a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.h +++ b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.h @@ -273,7 +273,7 @@ class backhaul_manager : public btl::transport_socket_thread { vht_mcs_set; /**< 32-byte attribute containing the MCS set as defined in 802.11ac */ bool he_supported = false; /**< Is HE supported flag */ beerocks_message::sVapsList vaps_list; /**< List of VAPs in radio. */ - std::array + std::array supported_channels; /**< Array of supported channels in radio. */ std::unordered_map associated_clients_map; /**< Associated clients grouped by BSSID. */ diff --git a/agent/src/beerocks/slave/son_slave_thread.cpp b/agent/src/beerocks/slave/son_slave_thread.cpp index d3cb262035..c05eb02e3d 100644 --- a/agent/src/beerocks/slave/son_slave_thread.cpp +++ b/agent/src/beerocks/slave/son_slave_thread.cpp @@ -1789,7 +1789,7 @@ bool slave_thread::handle_cmdu_ap_manager_message(Socket *sd, notification_out->cs_params() = notification_in->cs_params(); auto tuple_in_supported_channels = notification_in->supported_channels_list(0); auto tuple_out_supported_channels = notification_out->supported_channels(0); - std::copy_n(&std::get<1>(tuple_in_supported_channels), message::SUPPORTED_CHANNELS_LENGTH, + std::copy_n(&std::get<1>(tuple_in_supported_channels), message::RADIO_CHANNELS_LENGTH, &std::get<1>(tuple_out_supported_channels)); send_cmdu_to_controller(cmdu_tx); send_operating_channel_report(); @@ -2239,7 +2239,7 @@ bool slave_thread::handle_cmdu_ap_manager_message(Socket *sd, } auto tuple_supported_channels = response->supported_channels_list(0); - std::copy_n(&std::get<1>(tuple_supported_channels), message::SUPPORTED_CHANNELS_LENGTH, + std::copy_n(&std::get<1>(tuple_supported_channels), message::RADIO_CHANNELS_LENGTH, hostap_params.supported_channels); // build channel preference report @@ -3258,7 +3258,7 @@ bool slave_thread::slave_fsm(bool &call_slave_select) break; } - std::copy_n(hostap_params.supported_channels, message::SUPPORTED_CHANNELS_LENGTH, + std::copy_n(hostap_params.supported_channels, message::RADIO_CHANNELS_LENGTH, &std::get<1>(tuple_supported_channels)); // Send the message @@ -3383,7 +3383,7 @@ bool slave_thread::slave_fsm(bool &call_slave_select) return false; } - std::array + std::array supported_channels; std::copy_n(std::begin(hostap_params.supported_channels), supported_channels.size(), supported_channels.begin()); @@ -4500,7 +4500,7 @@ beerocks::message::sWifiChannel slave_thread::channel_selection_select_channel() if (preference.channels.empty()) { continue; } - for (uint8_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { + for (uint8_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { const auto &channel = hostap_params.supported_channels[i]; auto operating_class = wireless_utils::get_operating_class_by_channel(channel); diff --git a/agent/src/beerocks/slave/tlvf_utils.cpp b/agent/src/beerocks/slave/tlvf_utils.cpp index 8e1a0a8c61..7bf369f074 100644 --- a/agent/src/beerocks/slave/tlvf_utils.cpp +++ b/agent/src/beerocks/slave/tlvf_utils.cpp @@ -17,7 +17,7 @@ using namespace beerocks; bool tlvf_utils::add_ap_radio_basic_capabilities( ieee1905_1::CmduMessageTx &cmdu_tx, const sMacAddr &ruid, - const std::array + const std::array &supported_channels) { std::vector operating_classes; diff --git a/agent/src/beerocks/slave/tlvf_utils.h b/agent/src/beerocks/slave/tlvf_utils.h index 3d75bc80dc..6f63f9d258 100644 --- a/agent/src/beerocks/slave/tlvf_utils.h +++ b/agent/src/beerocks/slave/tlvf_utils.h @@ -29,7 +29,7 @@ class tlvf_utils { static bool add_ap_radio_basic_capabilities( ieee1905_1::CmduMessageTx &cmdu_tx, const sMacAddr &ruid, const std::array &supported_channels); + beerocks::message::RADIO_CHANNELS_LENGTH> &supported_channels); }; } // namespace beerocks diff --git a/common/beerocks/bcl/include/bcl/beerocks_defines.h b/common/beerocks/bcl/include/bcl/beerocks_defines.h index e00eb1ead2..49c2e03166 100644 --- a/common/beerocks/bcl/include/bcl/beerocks_defines.h +++ b/common/beerocks/bcl/include/bcl/beerocks_defines.h @@ -43,7 +43,7 @@ enum eStructsConsts { VERSION_LENGTH = 16, NODE_NAME_LENGTH = 32, IFACE_NAME_LENGTH = 32 + 4, //need extra 1 byte for null termination + alignment - SUPPORTED_CHANNELS_LENGTH = 64, //support upto # channels, every channel item is 32-bit + RADIO_CHANNELS_LENGTH = 128, //support upto # channels, every channel item is 32-bit HOSTAP_ERR_MSG_LENGTH = 64, WIFI_DRIVER_VER_LENGTH = 32 + 4, WIFI_SSID_MAX_LENGTH = 32 + 1 + 3, //need extra 1 byte for null termination + alignment diff --git a/common/beerocks/bcl/source/son/son_wireless_utils.cpp b/common/beerocks/bcl/source/son/son_wireless_utils.cpp index da554b5060..06a643ea5e 100644 --- a/common/beerocks/bcl/source/son/son_wireless_utils.cpp +++ b/common/beerocks/bcl/source/son/son_wireless_utils.cpp @@ -638,7 +638,7 @@ wireless_utils::get_channel_preferences(const beerocks::message::sWifiChannel su for (auto oper_class : operating_classes_list) { std::vector radar_affected_channels; - for (uint8_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { + for (uint8_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { if (has_operating_class_channel(oper_class.second, supported_channels[i]) && supported_channels[i].radar_affected) { radar_affected_channels.push_back(supported_channels[i]); @@ -667,7 +667,7 @@ std::vector wireless_utils::get_supported_operating_classes( std::vector operating_classes; //TODO handle regulatory domain operating classes for (auto oper_class : operating_classes_list) { - for (uint8_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { + for (uint8_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { if (has_operating_class_channel(oper_class.second, supported_channels[i])) { operating_classes.push_back(oper_class.first); break; @@ -691,7 +691,7 @@ uint8_t wireless_utils::get_operating_class_max_tx_power( uint8_t max_tx_power = 0; auto oper_class = operating_classes_list.at(operating_class); - for (uint8_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { + for (uint8_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { if (has_operating_class_channel(oper_class, supported_channels[i])) { max_tx_power = std::max(max_tx_power, supported_channels[i].tx_pow); } @@ -750,7 +750,7 @@ std::vector wireless_utils::get_operating_class_non_oper_channels( for (auto op_class_channel : oper_class.channels) { uint8_t found = 0; - for (uint8_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { + for (uint8_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { if (op_class_channel == supported_channels[i].channel && oper_class.band == supported_channels[i].channel_bandwidth) { found = 1; diff --git a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h index 860755eb76..5aec7ee1f6 100644 --- a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h +++ b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h @@ -264,7 +264,7 @@ typedef struct { #define SSID_MAX_SIZE beerocks::message::WIFI_SSID_MAX_LENGTH #define MAC_ADDR_SIZE 18 -#define MAX_SUPPORTED_20M_CHANNELS beerocks::message::SUPPORTED_CHANNELS_LENGTH +#define MAX_SUPPORTED_20M_CHANNELS beerocks::message::RADIO_CHANNELS_LENGTH #define MAX_SUPPORTED_CHANNELS \ (MAX_SUPPORTED_20M_CHANNELS * 4) //max 64 channels, each with BW 20/40/80/160 } // namespace bwl diff --git a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h index 91d0a2f858..2bffac1c2d 100644 --- a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h +++ b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h @@ -378,20 +378,20 @@ typedef struct sNodeHostap { uint32_t vht_capability; uint8_t vht_mcs_set[beerocks::message::VHT_MCS_SET_SIZE]; char driver_version[beerocks::message::WIFI_DRIVER_VER_LENGTH]; - beerocks::message::sWifiChannel supported_channels[beerocks::message::SUPPORTED_CHANNELS_LENGTH]; + beerocks::message::sWifiChannel supported_channels[beerocks::message::RADIO_CHANNELS_LENGTH]; void struct_swap(){ iface_mac.struct_swap(); tlvf_swap(8*sizeof(beerocks::eFreqType), reinterpret_cast(&frequency_band)); tlvf_swap(8*sizeof(beerocks::eWiFiBandwidth), reinterpret_cast(&max_bandwidth)); tlvf_swap(16, reinterpret_cast(&ht_capability)); tlvf_swap(32, reinterpret_cast(&vht_capability)); - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++){ + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ (supported_channels[i]).struct_swap(); } } void struct_init(){ iface_mac.struct_init(); - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { (supported_channels[i]).struct_init(); } } @@ -1219,7 +1219,7 @@ typedef struct sTriggerChannelScanParams { //size of provided channel_pool uint8_t channel_pool_size; //pool of channels to be scaned - uint8_t channel_pool[beerocks::message::SUPPORTED_CHANNELS_LENGTH]; + uint8_t channel_pool[beerocks::message::RADIO_CHANNELS_LENGTH]; void struct_swap(){ radio_mac.struct_swap(); tlvf_swap(32, reinterpret_cast(&dwell_time_ms)); @@ -1238,7 +1238,7 @@ typedef struct sChannelScanRequestParams { int32_t interval_time_sec; //an invalid (-1) value indicates this value is not requested int8_t channel_pool_size; - uint8_t channel_pool[beerocks::message::SUPPORTED_CHANNELS_LENGTH]; + uint8_t channel_pool[beerocks::message::RADIO_CHANNELS_LENGTH]; void struct_swap(){ tlvf_swap(32, reinterpret_cast(&dwell_time_ms)); tlvf_swap(32, reinterpret_cast(&interval_time_sec)); diff --git a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp index 2b71f90e20..cba63d6b36 100644 --- a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp +++ b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp @@ -1193,7 +1193,7 @@ void cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::class_swap() { tlvf_swap(8*sizeof(eActionOp_APMANAGER), reinterpret_cast(m_action_op)); m_cs_params->struct_swap(); - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++){ + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ m_supported_channels_list[i].struct_swap(); } } @@ -1229,7 +1229,7 @@ size_t cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::get_initial_size() { size_t class_size = 0; class_size += sizeof(sApChannelSwitch); // cs_params - class_size += beerocks::message::SUPPORTED_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list return class_size; } @@ -1246,13 +1246,13 @@ bool cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::init() } if (!m_parse__) { m_cs_params->struct_init(); } m_supported_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; - if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH))) { - LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH) << ") Failed!"; + if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { + LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_list_idx__ = beerocks::message::SUPPORTED_CHANNELS_LENGTH; + m_supported_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } } if (m_parse__) { class_swap(); } return true; @@ -3237,7 +3237,7 @@ std::tuple cACTION_APMANAGER_READ_ACS_RE void cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::class_swap() { tlvf_swap(8*sizeof(eActionOp_APMANAGER), reinterpret_cast(m_action_op)); - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++){ + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ m_supported_channels_list[i].struct_swap(); } } @@ -3272,7 +3272,7 @@ bool cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::finalize() size_t cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::get_initial_size() { size_t class_size = 0; - class_size += beerocks::message::SUPPORTED_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list return class_size; } @@ -3283,13 +3283,13 @@ bool cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::init() return false; } m_supported_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; - if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH))) { - LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH) << ") Failed!"; + if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { + LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_list_idx__ = beerocks::message::SUPPORTED_CHANNELS_LENGTH; + m_supported_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } } if (m_parse__) { class_swap(); } return true; diff --git a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp index 31b5f19aee..25c2386ab2 100644 --- a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp +++ b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp @@ -546,7 +546,7 @@ void cACTION_BACKHAUL_ENABLE::class_swap() tlvf_swap(8*sizeof(beerocks::eWiFiBandwidth), reinterpret_cast(m_max_bandwidth)); tlvf_swap(16, reinterpret_cast(m_ht_capability)); tlvf_swap(32, reinterpret_cast(m_vht_capability)); - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++){ + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ m_supported_channels_list[i].struct_swap(); } } @@ -600,7 +600,7 @@ size_t cACTION_BACKHAUL_ENABLE::get_initial_size() class_size += sizeof(uint8_t); // vht_supported class_size += sizeof(uint32_t); // vht_capability class_size += beerocks::message::VHT_MCS_SET_SIZE * sizeof(uint8_t); // vht_mcs_set - class_size += beerocks::message::SUPPORTED_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list return class_size; } @@ -714,13 +714,13 @@ bool cACTION_BACKHAUL_ENABLE::init() } m_vht_mcs_set_idx__ = beerocks::message::VHT_MCS_SET_SIZE; m_supported_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; - if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH))) { - LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH) << ") Failed!"; + if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { + LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_list_idx__ = beerocks::message::SUPPORTED_CHANNELS_LENGTH; + m_supported_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } } if (m_parse__) { class_swap(); } return true; diff --git a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp index 32b8ab501b..283b88128f 100644 --- a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp +++ b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp @@ -1892,7 +1892,7 @@ void cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::class_swap() { tlvf_swap(8*sizeof(eActionOp_CONTROL), reinterpret_cast(m_action_op)); m_cs_params->struct_swap(); - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++){ + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ m_supported_channels[i].struct_swap(); } } @@ -1928,7 +1928,7 @@ size_t cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::get_initial_size() { size_t class_size = 0; class_size += sizeof(sApChannelSwitch); // cs_params - class_size += beerocks::message::SUPPORTED_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels return class_size; } @@ -1945,13 +1945,13 @@ bool cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::init() } if (!m_parse__) { m_cs_params->struct_init(); } m_supported_channels = (beerocks::message::sWifiChannel*)m_buff_ptr__; - if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH))) { - LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::SUPPORTED_CHANNELS_LENGTH) << ") Failed!"; + if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { + LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_idx__ = beerocks::message::SUPPORTED_CHANNELS_LENGTH; + m_supported_channels_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::SUPPORTED_CHANNELS_LENGTH; i++) { m_supported_channels->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels->struct_init(); } } if (m_parse__) { class_swap(); } return true; diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml index 72aeb0b684..5f5fe56842 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml @@ -91,7 +91,7 @@ cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION: cs_params: sApChannelSwitch supported_channels_list: _type: beerocks::message::sWifiChannel - _length: [ "beerocks::message::SUPPORTED_CHANNELS_LENGTH" ] + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] cACTION_APMANAGER_HOSTAP_DFS_CAC_COMPLETED_NOTIFICATION: _type: class @@ -211,5 +211,5 @@ cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE: _type: class supported_channels_list: _type: beerocks::message::sWifiChannel - _length: [ "beerocks::message::SUPPORTED_CHANNELS_LENGTH" ] + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml index 25c555f40f..e1786e5a9d 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml @@ -68,7 +68,7 @@ cACTION_BACKHAUL_ENABLE: _length: [ "beerocks::message::VHT_MCS_SET_SIZE" ] supported_channels_list: _type: beerocks::message::sWifiChannel - _length: [ "beerocks::message::SUPPORTED_CHANNELS_LENGTH" ] + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] cACTION_BACKHAUL_CONNECTED_NOTIFICATION: _type: class diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml index 3b13f7c4d1..a0545f5078 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml @@ -282,7 +282,7 @@ sNodeHostap: _length: [ "beerocks::message::WIFI_DRIVER_VER_LENGTH" ] supported_channels: _type: beerocks::message::sWifiChannel - _length: [ "beerocks::message::SUPPORTED_CHANNELS_LENGTH" ] + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] sVapsList: _type: struct @@ -847,7 +847,7 @@ sTriggerChannelScanParams: _comment: size of provided channel_pool channel_pool: _type: uint8_t - _length: [ "beerocks::message::SUPPORTED_CHANNELS_LENGTH" ] + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] _comment: pool of channels to be scaned sChannelScanRequestParams: @@ -866,7 +866,7 @@ sChannelScanRequestParams: _comment: an invalid (-1) value indicates this value is not requested channel_pool: _type: uint8_t - _length: [ "beerocks::message::SUPPORTED_CHANNELS_LENGTH" ] + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] eChannelScanResultMode: _type: enum diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml index b86dd2caf3..cb7b7c5a99 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml @@ -142,7 +142,7 @@ cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION: cs_params: sApChannelSwitch supported_channels: _type: beerocks::message::sWifiChannel - _length: [ "beerocks::message::SUPPORTED_CHANNELS_LENGTH" ] + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] cACTION_CONTROL_HOSTAP_DFS_CAC_COMPLETED_NOTIFICATION: _type: class diff --git a/controller/src/beerocks/master/son_master_thread.cpp b/controller/src/beerocks/master/son_master_thread.cpp index b73d457c09..18d001cdb7 100644 --- a/controller/src/beerocks/master/son_master_thread.cpp +++ b/controller/src/beerocks/master/son_master_thread.cpp @@ -2102,7 +2102,7 @@ bool master_thread::handle_intel_slave_join( database.set_node_manufacturer(radio_mac, "Intel"); database.set_hostap_supported_channels(radio_mac, notification->hostap().supported_channels, - message::SUPPORTED_CHANNELS_LENGTH); + message::RADIO_CHANNELS_LENGTH); if (database.get_node_5ghz_support(radio_mac)) { if (notification->low_pass_filter_on()) { @@ -2239,9 +2239,9 @@ bool master_thread::autoconfig_wsc_parse_radio_caps( { // read all operating class list auto operating_classes_list_length = radio_caps->operating_classes_info_list_length(); - if (operating_classes_list_length > beerocks::message::SUPPORTED_CHANNELS_LENGTH) { + if (operating_classes_list_length > beerocks::message::RADIO_CHANNELS_LENGTH) { LOG(WARNING) << "operating class info list larger then maximum supported channels"; - operating_classes_list_length = beerocks::message::SUPPORTED_CHANNELS_LENGTH; + operating_classes_list_length = beerocks::message::RADIO_CHANNELS_LENGTH; } for (int oc_idx = 0; oc_idx < operating_classes_list_length; oc_idx++) { std::stringstream ss; @@ -2560,7 +2560,7 @@ bool master_thread::handle_cmdu_control_message(const std::string &src_mac, new_event->hostap_mac = network_utils::mac_from_string(hostap_mac); new_event->cs_params = notification->cs_params(); auto tuple_supported_channels = notification->supported_channels(0); - std::copy_n(&std::get<1>(tuple_supported_channels), message::SUPPORTED_CHANNELS_LENGTH, + std::copy_n(&std::get<1>(tuple_supported_channels), message::RADIO_CHANNELS_LENGTH, new_event->supported_channels); tasks.push_event(database.get_channel_selection_task_id(), (int)channel_selection_task::eEvent::ACS_RESPONSE_EVENT, diff --git a/controller/src/beerocks/master/tasks/channel_selection_task.cpp b/controller/src/beerocks/master/tasks/channel_selection_task.cpp index 0ceb7d6478..e44c5e3e66 100644 --- a/controller/src/beerocks/master/tasks/channel_selection_task.cpp +++ b/controller/src/beerocks/master/tasks/channel_selection_task.cpp @@ -695,7 +695,7 @@ void channel_selection_task::work() break; } case eState::ON_ACS_RESPONSE: { - //database.set_hostap_supported_channels(hostap_mac, acs_response_event->supported_channels, message::SUPPORTED_CHANNELS_LENGTH); + //database.set_hostap_supported_channels(hostap_mac, acs_response_event->supported_channels, message::RADIO_CHANNELS_LENGTH); cs_wait_for_event(eEvent::CSA_EVENT); set_events_timeout(CSA_NOTIFICATION_RESPONSE_WAIT_TIME); diff --git a/controller/src/beerocks/master/tasks/channel_selection_task.h b/controller/src/beerocks/master/tasks/channel_selection_task.h index 9690d8fb41..dc6e76a9a6 100644 --- a/controller/src/beerocks/master/tasks/channel_selection_task.h +++ b/controller/src/beerocks/master/tasks/channel_selection_task.h @@ -60,7 +60,7 @@ class channel_selection_task : public task, public std::enable_shared_from_this< beerocks_message::sApChannelSwitch cs_params; beerocks::message::sWifiChannel - supported_channels[beerocks::message::SUPPORTED_CHANNELS_LENGTH]; + supported_channels[beerocks::message::RADIO_CHANNELS_LENGTH]; } sAcsResponse_event; typedef struct { @@ -71,7 +71,7 @@ class channel_selection_task : public task, public std::enable_shared_from_this< uint8_t channel; beerocks_message::sApChannelSwitch cs_params; beerocks::message::sWifiChannel - supported_channels[beerocks::message::SUPPORTED_CHANNELS_LENGTH]; + supported_channels[beerocks::message::RADIO_CHANNELS_LENGTH]; beerocks::net::sScanResult backhaul_scan_measurement_list[beerocks::message::BACKHAUL_SCAN_MEASUREMENT_MAX_LENGTH]; } sSlaveJoined_event; diff --git a/controller/src/beerocks/master/tasks/dynamic_channel_selection_task.cpp b/controller/src/beerocks/master/tasks/dynamic_channel_selection_task.cpp index d3393b6fd2..aaaadacd47 100644 --- a/controller/src/beerocks/master/tasks/dynamic_channel_selection_task.cpp +++ b/controller/src/beerocks/master/tasks/dynamic_channel_selection_task.cpp @@ -73,7 +73,7 @@ beerocks::eChannelScanErrCode dynamic_channel_selection_task::dcs_request_scan_t return beerocks::eChannelScanErrCode::CHANNEL_SCAN_INVALID_PARAMS; } - if (curr_channel_pool.size() > beerocks::message::SUPPORTED_CHANNELS_LENGTH) { + if (curr_channel_pool.size() > beerocks::message::RADIO_CHANNELS_LENGTH) { LOG(ERROR) << "channel_pool is too big"; return beerocks::eChannelScanErrCode::CHANNEL_SCAN_POOL_TOO_BIG; } From 21157c8dfef1268e43d721fe974a3b3b1233efb1 Mon Sep 17 00:00:00 2001 From: Itay Elenzweig Date: Mon, 20 Apr 2020 20:52:04 +0000 Subject: [PATCH 2/7] ap_manager_thread: Update the radio channels helper functions In ap_manager_thread there are two helper functions, copy_radio_supported_channels and get_radio_supported_channels_string They only work on the ap_wlan_hal's supported_channels. Change the functions to take the supported_channels vector to make them usable for other radio channel lists. Signed-off-by: Itay Elenzweig --- .../src/beerocks/slave/ap_manager_thread.cpp | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/agent/src/beerocks/slave/ap_manager_thread.cpp b/agent/src/beerocks/slave/ap_manager_thread.cpp index 6ed3feca87..b341285013 100644 --- a/agent/src/beerocks/slave/ap_manager_thread.cpp +++ b/agent/src/beerocks/slave/ap_manager_thread.cpp @@ -33,30 +33,28 @@ using namespace beerocks::net; /////////////////////////// Local Module Functions /////////////////////////// ////////////////////////////////////////////////////////////////////////////// -static void copy_radio_supported_channels(std::shared_ptr &ap_wlan_hal, - beerocks::message::sWifiChannel supported_channels[]) +static void copy_radio_channels(std::vector radio_channels, + beerocks::message::sWifiChannel dest_channels[]) { - auto radio_channels = ap_wlan_hal->get_radio_info().supported_channels; // Copy the channels for (uint i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH && i < radio_channels.size(); i++) { - supported_channels[i].channel = radio_channels[i].channel; - supported_channels[i].noise = radio_channels[i].noise; - supported_channels[i].tx_pow = radio_channels[i].tx_pow; - supported_channels[i].bss_overlap = radio_channels[i].bss_overlap; - supported_channels[i].is_dfs_channel = radio_channels[i].is_dfs; - supported_channels[i].channel_bandwidth = + dest_channels[i].channel = radio_channels[i].channel; + dest_channels[i].noise = radio_channels[i].noise; + dest_channels[i].tx_pow = radio_channels[i].tx_pow; + dest_channels[i].bss_overlap = radio_channels[i].bss_overlap; + dest_channels[i].is_dfs_channel = radio_channels[i].is_dfs; + dest_channels[i].channel_bandwidth = uint8_t(beerocks::utils::convert_bandwidth_to_enum(radio_channels[i].bandwidth)); } } -static std::string -get_radio_supported_channels_string(std::shared_ptr &ap_wlan_hal) +static std::string get_radio_channels_string(std::vector radio_channels) { std::ostringstream os; - for (auto val : ap_wlan_hal->get_radio_info().supported_channels) { + for (auto val : radio_channels) { if (val.channel > 0) { os << " ch = " << int(val.channel) << " | dfs = " << int(val.tx_pow) << " | tx_pow = " << int(val.is_dfs) << " | noise = " << int(val.noise) @@ -787,7 +785,8 @@ bool ap_manager_thread::handle_cmdu(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_ return false; } auto tuple_supported_channels = response->supported_channels_list(0); - copy_radio_supported_channels(ap_wlan_hal, &std::get<1>(tuple_supported_channels)); + copy_radio_channels(ap_wlan_hal->get_radio_info().supported_channels, + &std::get<1>(tuple_supported_channels)); message_com::send_cmdu(slave_socket, cmdu_tx); break; @@ -1112,7 +1111,8 @@ bool ap_manager_thread::hal_event_handler(bwl::base_wlan_hal::hal_event_ptr_t ev return false; } auto tuple_supported_channels = notification->supported_channels_list(0); - copy_radio_supported_channels(ap_wlan_hal, &std::get<1>(tuple_supported_channels)); + copy_radio_channels(ap_wlan_hal->get_radio_info().supported_channels, + &std::get<1>(tuple_supported_channels)); fill_cs_params(notification->cs_params()); acs_completed_vap_update = true; } else { @@ -1567,7 +1567,8 @@ void ap_manager_thread::handle_hostapd_attached() beerocks::message::VHT_MCS_SET_SIZE, notification->params().vht_mcs_set); // Copy the channels supported by the AP - copy_radio_supported_channels(ap_wlan_hal, notification->params().supported_channels); + copy_radio_channels(ap_wlan_hal->get_radio_info().supported_channels, + notification->params().supported_channels); LOG(INFO) << "send ACTION_APMANAGER_JOINED_NOTIFICATION"; LOG(INFO) << " iface = " << ap_wlan_hal->get_iface_name(); @@ -1584,7 +1585,7 @@ void ap_manager_thread::handle_hostapd_attached() LOG(INFO) << " vht_supported = " << ap_wlan_hal->get_radio_info().vht_supported; LOG(INFO) << " vht_capability = " << std::hex << ap_wlan_hal->get_radio_info().vht_capability; LOG(INFO) << " supported_channels = " << std::endl - << get_radio_supported_channels_string(ap_wlan_hal); + << get_radio_channels_string(ap_wlan_hal->get_radio_info().supported_channels); // Send CMDU message_com::send_cmdu(slave_socket, cmdu_tx); From 769919494bee42acfcfb9065992d0701a9662a4b Mon Sep 17 00:00:00 2001 From: Itay Elenzweig Date: Mon, 20 Apr 2020 20:57:58 +0000 Subject: [PATCH 3/7] treewide: Change supported_channels to preferred_channels Currently the preferred channels are used in the code-base under the wrong name "supported_channels". Change supported_channels to preferred_channels Change the container type to std::array Signed-off-by: Itay Elenzweig --- .../src/beerocks/slave/ap_manager_thread.cpp | 28 ++++++++------- .../backhaul_manager_thread.cpp | 6 ++-- agent/src/beerocks/slave/son_slave_thread.cpp | 34 +++++++++---------- common/beerocks/bwl/common/base_wlan_hal.cpp | 2 +- .../beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp | 32 ++++++++--------- .../beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp | 21 +++++------- .../bwl/econet/ap_wlan_hal_econet.cpp | 32 ++++++++--------- .../bwl/include/bwl/base_wlan_hal_types.h | 2 +- .../bwl/nl80211/ap_wlan_hal_nl80211.cpp | 5 +-- .../tlvf/beerocks_message_apmanager.h | 12 +++---- .../beerocks/tlvf/beerocks_message_backhaul.h | 6 ++-- .../beerocks/tlvf/beerocks_message_common.h | 6 ++-- .../beerocks/tlvf/beerocks_message_control.h | 6 ++-- .../tlvf/beerocks_message_apmanager.cpp | 32 ++++++++--------- .../tlvf/beerocks_message_backhaul.cpp | 16 ++++----- .../tlvf/beerocks_message_control.cpp | 16 ++++----- .../tlvf/beerocks_message_apmanager.yaml | 4 +-- .../tlvf/beerocks_message_backhaul.yaml | 2 +- .../tlvf/beerocks_message_common.yaml | 2 +- .../tlvf/beerocks_message_control.yaml | 2 +- .../src/beerocks/master/son_master_thread.cpp | 12 +++---- 21 files changed, 137 insertions(+), 141 deletions(-) diff --git a/agent/src/beerocks/slave/ap_manager_thread.cpp b/agent/src/beerocks/slave/ap_manager_thread.cpp index b341285013..76441a4c04 100644 --- a/agent/src/beerocks/slave/ap_manager_thread.cpp +++ b/agent/src/beerocks/slave/ap_manager_thread.cpp @@ -33,8 +33,9 @@ using namespace beerocks::net; /////////////////////////// Local Module Functions /////////////////////////// ////////////////////////////////////////////////////////////////////////////// -static void copy_radio_channels(std::vector radio_channels, - beerocks::message::sWifiChannel dest_channels[]) +static void copy_radio_channels( + std::array radio_channels, + beerocks::message::sWifiChannel dest_channels[]) { // Copy the channels @@ -51,7 +52,8 @@ static void copy_radio_channels(std::vector radio_channels, } } -static std::string get_radio_channels_string(std::vector radio_channels) +static std::string get_radio_channels_string( + std::array radio_channels) { std::ostringstream os; for (auto val : radio_channels) { @@ -784,9 +786,9 @@ bool ap_manager_thread::handle_cmdu(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_ LOG(ERROR) << "Failed building message!"; return false; } - auto tuple_supported_channels = response->supported_channels_list(0); - copy_radio_channels(ap_wlan_hal->get_radio_info().supported_channels, - &std::get<1>(tuple_supported_channels)); + auto tuple_preferred_channels = response->preferred_channels_list(0); + copy_radio_channels(ap_wlan_hal->get_radio_info().preferred_channels, + &std::get<1>(tuple_preferred_channels)); message_com::send_cmdu(slave_socket, cmdu_tx); break; @@ -1110,9 +1112,9 @@ bool ap_manager_thread::hal_event_handler(bwl::base_wlan_hal::hal_event_ptr_t ev LOG(ERROR) << "Failed building message!"; return false; } - auto tuple_supported_channels = notification->supported_channels_list(0); - copy_radio_channels(ap_wlan_hal->get_radio_info().supported_channels, - &std::get<1>(tuple_supported_channels)); + auto tuple_preferred_channels = notification->preferred_channels_list(0); + copy_radio_channels(ap_wlan_hal->get_radio_info().preferred_channels, + &std::get<1>(tuple_preferred_channels)); fill_cs_params(notification->cs_params()); acs_completed_vap_update = true; } else { @@ -1567,8 +1569,8 @@ void ap_manager_thread::handle_hostapd_attached() beerocks::message::VHT_MCS_SET_SIZE, notification->params().vht_mcs_set); // Copy the channels supported by the AP - copy_radio_channels(ap_wlan_hal->get_radio_info().supported_channels, - notification->params().supported_channels); + copy_radio_channels(ap_wlan_hal->get_radio_info().preferred_channels, + notification->params().preferred_channels); LOG(INFO) << "send ACTION_APMANAGER_JOINED_NOTIFICATION"; LOG(INFO) << " iface = " << ap_wlan_hal->get_iface_name(); @@ -1584,8 +1586,8 @@ void ap_manager_thread::handle_hostapd_attached() LOG(INFO) << " ht_capability = " << std::hex << ap_wlan_hal->get_radio_info().ht_capability; LOG(INFO) << " vht_supported = " << ap_wlan_hal->get_radio_info().vht_supported; LOG(INFO) << " vht_capability = " << std::hex << ap_wlan_hal->get_radio_info().vht_capability; - LOG(INFO) << " supported_channels = " << std::endl - << get_radio_channels_string(ap_wlan_hal->get_radio_info().supported_channels); + LOG(INFO) << " preferred_channels = " << std::endl + << get_radio_channels_string(ap_wlan_hal->get_radio_info().preferred_channels); // Send CMDU message_com::send_cmdu(slave_socket, cmdu_tx); diff --git a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp index 98a66cb390..46248f7d24 100644 --- a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp +++ b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp @@ -1776,13 +1776,13 @@ bool backhaul_manager::handle_slave_backhaul_message(std::shared_ptr return false; } - auto tuple_supported_channels = request->supported_channels_list(0); - if (!std::get<0>(tuple_supported_channels)) { + auto tuple_preferred_channels = request->preferred_channels_list(0); + if (!std::get<0>(tuple_preferred_channels)) { LOG(ERROR) << "access to supported channels list failed!"; return false; } - auto channels = &std::get<1>(tuple_supported_channels); + auto channels = &std::get<1>(tuple_preferred_channels); std::copy_n(channels, beerocks::message::RADIO_CHANNELS_LENGTH, soc->supported_channels.begin()); diff --git a/agent/src/beerocks/slave/son_slave_thread.cpp b/agent/src/beerocks/slave/son_slave_thread.cpp index c05eb02e3d..d77ddde20c 100644 --- a/agent/src/beerocks/slave/son_slave_thread.cpp +++ b/agent/src/beerocks/slave/son_slave_thread.cpp @@ -1787,10 +1787,10 @@ bool slave_thread::handle_cmdu_ap_manager_message(Socket *sd, return false; } notification_out->cs_params() = notification_in->cs_params(); - auto tuple_in_supported_channels = notification_in->supported_channels_list(0); - auto tuple_out_supported_channels = notification_out->supported_channels(0); - std::copy_n(&std::get<1>(tuple_in_supported_channels), message::RADIO_CHANNELS_LENGTH, - &std::get<1>(tuple_out_supported_channels)); + auto tuple_in_preferred_channels = notification_in->preferred_channels_list(0); + auto tuple_out_preferred_channels = notification_out->preferred_channels(0); + std::copy_n(&std::get<1>(tuple_in_preferred_channels), message::RADIO_CHANNELS_LENGTH, + &std::get<1>(tuple_out_preferred_channels)); send_cmdu_to_controller(cmdu_tx); send_operating_channel_report(); break; @@ -2238,9 +2238,9 @@ bool slave_thread::handle_cmdu_ap_manager_message(Socket *sd, return false; } - auto tuple_supported_channels = response->supported_channels_list(0); - std::copy_n(&std::get<1>(tuple_supported_channels), message::RADIO_CHANNELS_LENGTH, - hostap_params.supported_channels); + auto tuple_preferred_channels = response->preferred_channels_list(0); + std::copy_n(&std::get<1>(tuple_preferred_channels), message::RADIO_CHANNELS_LENGTH, + hostap_params.preferred_channels); // build channel preference report auto cmdu_tx_header = cmdu_tx.create( @@ -2252,7 +2252,7 @@ bool slave_thread::handle_cmdu_ap_manager_message(Socket *sd, } auto preferences = - wireless_utils::get_channel_preferences(hostap_params.supported_channels); + wireless_utils::get_channel_preferences(hostap_params.preferred_channels); auto channel_preference_tlv = cmdu_tx.addClass(); if (!channel_preference_tlv) { @@ -3252,14 +3252,14 @@ bool slave_thread::slave_fsm(bool &call_slave_select) std::copy_n(hostap_params.vht_mcs_set, beerocks::message::VHT_MCS_SET_SIZE, bh_enable->vht_mcs_set()); - auto tuple_supported_channels = bh_enable->supported_channels_list(0); - if (!std::get<0>(tuple_supported_channels)) { + auto tuple_preferred_channels = bh_enable->preferred_channels_list(0); + if (!std::get<0>(tuple_preferred_channels)) { LOG(ERROR) << "getting supported channels has failed!"; break; } - std::copy_n(hostap_params.supported_channels, message::RADIO_CHANNELS_LENGTH, - &std::get<1>(tuple_supported_channels)); + std::copy_n(hostap_params.preferred_channels, message::RADIO_CHANNELS_LENGTH, + &std::get<1>(tuple_preferred_channels)); // Send the message LOG(DEBUG) << "send ACTION_BACKHAUL_ENABLE for mac " << bh_enable->iface_mac(); @@ -3384,12 +3384,12 @@ bool slave_thread::slave_fsm(bool &call_slave_select) } std::array - supported_channels; - std::copy_n(std::begin(hostap_params.supported_channels), supported_channels.size(), - supported_channels.begin()); + preferred_channels; + std::copy_n(std::begin(hostap_params.preferred_channels), preferred_channels.size(), + preferred_channels.begin()); if (!tlvf_utils::add_ap_radio_basic_capabilities(cmdu_tx, hostap_params.iface_mac, - supported_channels)) { + preferred_channels)) { LOG(ERROR) << "Failed adding AP Radio Basic Capabilities TLV"; return false; } @@ -4501,7 +4501,7 @@ beerocks::message::sWifiChannel slave_thread::channel_selection_select_channel() continue; } for (uint8_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { - const auto &channel = hostap_params.supported_channels[i]; + const auto &channel = hostap_params.preferred_channels[i]; auto operating_class = wireless_utils::get_operating_class_by_channel(channel); // Skip DFS channels diff --git a/common/beerocks/bwl/common/base_wlan_hal.cpp b/common/beerocks/bwl/common/base_wlan_hal.cpp index f5c653549e..9f7832da76 100644 --- a/common/beerocks/bwl/common/base_wlan_hal.cpp +++ b/common/beerocks/bwl/common/base_wlan_hal.cpp @@ -31,7 +31,7 @@ base_wlan_hal::base_wlan_hal(HALType type, std::string iface_name, IfaceType ifa } // Initialize complex containers of the radio_info structure - m_radio_info.supported_channels.resize(128 /* TODO: Get real value */); + m_radio_info.preferred_channels.fill({}); } base_wlan_hal::~base_wlan_hal() diff --git a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp index 239b0b19cd..efa8cfcbf8 100644 --- a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp +++ b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp @@ -282,10 +282,10 @@ bool ap_wlan_hal_dummy::read_acs_report() m_radio_info.channel = 1; // 2.4G simulated report for (uint16_t ch = 1; ch <= 11; ch++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20; - m_radio_info.supported_channels[idx].bss_overlap = 10; - m_radio_info.supported_channels[idx].is_dfs = 0; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10; + m_radio_info.preferred_channels[idx].is_dfs = 0; idx++; } } else { @@ -293,28 +293,28 @@ bool ap_wlan_hal_dummy::read_acs_report() m_radio_info.channel = 149; for (uint16_t ch = 36; ch <= 64; ch += 4) { for (uint16_t step = 0; step < 3; step++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; - m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; - m_radio_info.supported_channels[idx].is_dfs = (ch > 48) ? 1 : 0; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.preferred_channels[idx].is_dfs = (ch > 48) ? 1 : 0; idx++; } } for (uint16_t ch = 100; ch <= 144; ch += 4) { for (uint16_t step = 0; step < 3; step++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; - m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; - m_radio_info.supported_channels[idx].is_dfs = 1; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.preferred_channels[idx].is_dfs = 1; idx++; } } for (uint16_t ch = 149; ch <= 165; ch += 4) { for (uint16_t step = 0; step < 3; step++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; - m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; - m_radio_info.supported_channels[idx].is_dfs = 0; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.preferred_channels[idx].is_dfs = 0; idx++; } } diff --git a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp index 331b5244b3..c751f2985d 100644 --- a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp +++ b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp @@ -1459,13 +1459,13 @@ bool ap_wlan_hal_dwpal::read_acs_report() m_radio_info.is_5ghz = false; // Resize the supported channels vector - if (MAX_SUPPORTED_20M_CHANNELS >= m_radio_info.supported_channels.size()) { + if (MAX_SUPPORTED_20M_CHANNELS >= m_radio_info.preferred_channels.size()) { LOG(DEBUG) << "Increasing supported channels vector to: " << MAX_SUPPORTED_20M_CHANNELS; - m_radio_info.supported_channels.resize(MAX_SUPPORTED_20M_CHANNELS); + m_radio_info.preferred_channels.resize(MAX_SUPPORTED_20M_CHANNELS); } // Clear the supported channels vector - for (auto &chan : m_radio_info.supported_channels) { + for (auto &chan : m_radio_info.preferred_channels) { memset(&chan, 0, sizeof(chan)); } @@ -1503,16 +1503,16 @@ bool ap_wlan_hal_dwpal::read_acs_report() << " DFS=" << acs_report[i].DFS << " bss=" << acs_report[i].bss; if (acs_report[i].BW == 20) { - m_radio_info.supported_channels[channel_idx].bandwidth = acs_report[i].BW; - m_radio_info.supported_channels[channel_idx].channel = acs_report[i].Ch; + m_radio_info.preferred_channels[channel_idx].bandwidth = acs_report[i].BW; + m_radio_info.preferred_channels[channel_idx].channel = acs_report[i].Ch; // Check if channel is 5GHz if (son::wireless_utils::which_freq( - m_radio_info.supported_channels[channel_idx].channel) == + m_radio_info.preferred_channels[channel_idx].channel) == beerocks::eFreqType::FREQ_5G) { m_radio_info.is_5ghz = true; } - m_radio_info.supported_channels[channel_idx].bss_overlap = acs_report[i].bss; - m_radio_info.supported_channels[channel_idx].is_dfs = acs_report[i].DFS; + m_radio_info.preferred_channels[channel_idx].bss_overlap = acs_report[i].bss; + m_radio_info.preferred_channels[channel_idx].is_dfs = acs_report[i].DFS; channel_idx++; if (channel_idx == MAX_SUPPORTED_20M_CHANNELS) { @@ -1551,10 +1551,7 @@ bool ap_wlan_hal_dwpal::read_supported_channels() } } - // Clear the supported channels vector - m_radio_info.supported_channels.clear(); - // Resize the supported channels vector - m_radio_info.supported_channels.insert(m_radio_info.supported_channels.begin(), + m_radio_info.preferred_channels.insert(m_radio_info.preferred_channels.begin(), supported_channels.begin(), supported_channels.end()); return true; } diff --git a/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp b/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp index 68398a3f36..5e05b3142d 100644 --- a/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp +++ b/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp @@ -279,10 +279,10 @@ bool ap_wlan_hal_dummy::read_acs_report() m_radio_info.channel = 1; // 2.4G simulated report for (uint16_t ch = 1; ch <= 11; ch++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20; - m_radio_info.supported_channels[idx].bss_overlap = 10; - m_radio_info.supported_channels[idx].is_dfs = 0; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10; + m_radio_info.preferred_channels[idx].is_dfs = 0; idx++; } } else { @@ -290,28 +290,28 @@ bool ap_wlan_hal_dummy::read_acs_report() m_radio_info.channel = 149; for (uint16_t ch = 36; ch <= 64; ch += 4) { for (uint16_t step = 0; step < 3; step++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; - m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; - m_radio_info.supported_channels[idx].is_dfs = (ch > 48) ? 1 : 0; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.preferred_channels[idx].is_dfs = (ch > 48) ? 1 : 0; idx++; } } for (uint16_t ch = 100; ch <= 144; ch += 4) { for (uint16_t step = 0; step < 3; step++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; - m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; - m_radio_info.supported_channels[idx].is_dfs = 1; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.preferred_channels[idx].is_dfs = 1; idx++; } } for (uint16_t ch = 149; ch <= 165; ch += 4) { for (uint16_t step = 0; step < 3; step++) { - m_radio_info.supported_channels[idx].channel = ch; - m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; - m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; - m_radio_info.supported_channels[idx].is_dfs = 0; + m_radio_info.preferred_channels[idx].channel = ch; + m_radio_info.preferred_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.preferred_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.preferred_channels[idx].is_dfs = 0; idx++; } } diff --git a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h index 5aec7ee1f6..90df30d926 100644 --- a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h +++ b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h @@ -101,7 +101,7 @@ struct RadioInfo { std::basic_string vht_mcs_set; /**< 32-byte attribute containing the MCS set as defined in 802.11ac */ ChanSwReason last_csa_sw_reason = ChanSwReason::Unknown; - std::vector supported_channels; + std::array preferred_channels; std::unordered_map available_vaps; // key = vap_id }; diff --git a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp index 89c822a007..329065e322 100644 --- a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp +++ b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp @@ -469,10 +469,7 @@ bool ap_wlan_hal_nl80211::read_supported_channels() } } - // Clear the supported channels vector - m_radio_info.supported_channels.clear(); - // Resize the supported channels vector - m_radio_info.supported_channels.insert(m_radio_info.supported_channels.begin(), + m_radio_info.preferred_channels.insert(m_radio_info.preferred_channels.begin(), supported_channels.begin(), supported_channels.end()); return true; } diff --git a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h index 23ed050d74..53274cae51 100644 --- a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h +++ b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h @@ -383,7 +383,7 @@ class cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION : public BaseClass return (eActionOp_APMANAGER)(ACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION); } sApChannelSwitch& cs_params(); - std::tuple supported_channels_list(size_t idx); + std::tuple preferred_channels_list(size_t idx); void class_swap() override; bool finalize() override; static size_t get_initial_size(); @@ -392,8 +392,8 @@ class cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION : public BaseClass bool init(); eActionOp_APMANAGER* m_action_op = nullptr; sApChannelSwitch* m_cs_params = nullptr; - beerocks::message::sWifiChannel* m_supported_channels_list = nullptr; - size_t m_supported_channels_list_idx__ = 0; + beerocks::message::sWifiChannel* m_preferred_channels_list = nullptr; + size_t m_preferred_channels_list_idx__ = 0; int m_lock_order_counter__ = 0; }; @@ -971,7 +971,7 @@ class cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE : public BaseClass static eActionOp_APMANAGER get_action_op(){ return (eActionOp_APMANAGER)(ACTION_APMANAGER_READ_ACS_REPORT_RESPONSE); } - std::tuple supported_channels_list(size_t idx); + std::tuple preferred_channels_list(size_t idx); void class_swap() override; bool finalize() override; static size_t get_initial_size(); @@ -979,8 +979,8 @@ class cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE : public BaseClass private: bool init(); eActionOp_APMANAGER* m_action_op = nullptr; - beerocks::message::sWifiChannel* m_supported_channels_list = nullptr; - size_t m_supported_channels_list_idx__ = 0; + beerocks::message::sWifiChannel* m_preferred_channels_list = nullptr; + size_t m_preferred_channels_list_idx__ = 0; int m_lock_order_counter__ = 0; }; diff --git a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_backhaul.h b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_backhaul.h index 3b0b2ec928..46ac3e2846 100644 --- a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_backhaul.h +++ b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_backhaul.h @@ -152,7 +152,7 @@ class cACTION_BACKHAUL_ENABLE : public BaseClass uint32_t& vht_capability(); uint8_t* vht_mcs_set(size_t idx = 0); bool set_vht_mcs_set(const void* buffer, size_t size); - std::tuple supported_channels_list(size_t idx); + std::tuple preferred_channels_list(size_t idx); void class_swap() override; bool finalize() override; static size_t get_initial_size(); @@ -186,8 +186,8 @@ class cACTION_BACKHAUL_ENABLE : public BaseClass uint32_t* m_vht_capability = nullptr; uint8_t* m_vht_mcs_set = nullptr; size_t m_vht_mcs_set_idx__ = 0; - beerocks::message::sWifiChannel* m_supported_channels_list = nullptr; - size_t m_supported_channels_list_idx__ = 0; + beerocks::message::sWifiChannel* m_preferred_channels_list = nullptr; + size_t m_preferred_channels_list_idx__ = 0; }; class cACTION_BACKHAUL_CONNECTED_NOTIFICATION : public BaseClass diff --git a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h index 2bffac1c2d..06127c3740 100644 --- a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h +++ b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h @@ -378,7 +378,7 @@ typedef struct sNodeHostap { uint32_t vht_capability; uint8_t vht_mcs_set[beerocks::message::VHT_MCS_SET_SIZE]; char driver_version[beerocks::message::WIFI_DRIVER_VER_LENGTH]; - beerocks::message::sWifiChannel supported_channels[beerocks::message::RADIO_CHANNELS_LENGTH]; + beerocks::message::sWifiChannel preferred_channels[beerocks::message::RADIO_CHANNELS_LENGTH]; void struct_swap(){ iface_mac.struct_swap(); tlvf_swap(8*sizeof(beerocks::eFreqType), reinterpret_cast(&frequency_band)); @@ -386,13 +386,13 @@ typedef struct sNodeHostap { tlvf_swap(16, reinterpret_cast(&ht_capability)); tlvf_swap(32, reinterpret_cast(&vht_capability)); for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ - (supported_channels[i]).struct_swap(); + (preferred_channels[i]).struct_swap(); } } void struct_init(){ iface_mac.struct_init(); for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { - (supported_channels[i]).struct_init(); + (preferred_channels[i]).struct_init(); } } } __attribute__((packed)) sNodeHostap; diff --git a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_control.h b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_control.h index 34fd8acf79..77b752bbcb 100644 --- a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_control.h +++ b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_control.h @@ -538,7 +538,7 @@ class cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION : public BaseClass return (eActionOp_CONTROL)(ACTION_CONTROL_HOSTAP_ACS_NOTIFICATION); } sApChannelSwitch& cs_params(); - std::tuple supported_channels(size_t idx); + std::tuple preferred_channels(size_t idx); void class_swap() override; bool finalize() override; static size_t get_initial_size(); @@ -547,8 +547,8 @@ class cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION : public BaseClass bool init(); eActionOp_CONTROL* m_action_op = nullptr; sApChannelSwitch* m_cs_params = nullptr; - beerocks::message::sWifiChannel* m_supported_channels = nullptr; - size_t m_supported_channels_idx__ = 0; + beerocks::message::sWifiChannel* m_preferred_channels = nullptr; + size_t m_preferred_channels_idx__ = 0; int m_lock_order_counter__ = 0; }; diff --git a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp index cba63d6b36..abbf00c7cd 100644 --- a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp +++ b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp @@ -1180,13 +1180,13 @@ sApChannelSwitch& cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::cs_params() { return (sApChannelSwitch&)(*m_cs_params); } -std::tuple cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::supported_channels_list(size_t idx) { - bool ret_success = ( (m_supported_channels_list_idx__ > 0) && (m_supported_channels_list_idx__ > idx) ); +std::tuple cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::preferred_channels_list(size_t idx) { + bool ret_success = ( (m_preferred_channels_list_idx__ > 0) && (m_preferred_channels_list_idx__ > idx) ); size_t ret_idx = ret_success ? idx : 0; if (!ret_success) { TLVF_LOG(ERROR) << "Requested index is greater than the number of available entries"; } - return std::forward_as_tuple(ret_success, m_supported_channels_list[ret_idx]); + return std::forward_as_tuple(ret_success, m_preferred_channels_list[ret_idx]); } void cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::class_swap() @@ -1194,7 +1194,7 @@ void cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::class_swap() tlvf_swap(8*sizeof(eActionOp_APMANAGER), reinterpret_cast(m_action_op)); m_cs_params->struct_swap(); for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ - m_supported_channels_list[i].struct_swap(); + m_preferred_channels_list[i].struct_swap(); } } @@ -1229,7 +1229,7 @@ size_t cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::get_initial_size() { size_t class_size = 0; class_size += sizeof(sApChannelSwitch); // cs_params - class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // preferred_channels_list return class_size; } @@ -1245,14 +1245,14 @@ bool cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION::init() return false; } if (!m_parse__) { m_cs_params->struct_init(); } - m_supported_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; + m_preferred_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; + m_preferred_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_preferred_channels_list->struct_init(); } } if (m_parse__) { class_swap(); } return true; @@ -3225,20 +3225,20 @@ BaseClass(base->getBuffPtr(), base->getBuffRemainingBytes(), parse){ } cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::~cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE() { } -std::tuple cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::supported_channels_list(size_t idx) { - bool ret_success = ( (m_supported_channels_list_idx__ > 0) && (m_supported_channels_list_idx__ > idx) ); +std::tuple cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::preferred_channels_list(size_t idx) { + bool ret_success = ( (m_preferred_channels_list_idx__ > 0) && (m_preferred_channels_list_idx__ > idx) ); size_t ret_idx = ret_success ? idx : 0; if (!ret_success) { TLVF_LOG(ERROR) << "Requested index is greater than the number of available entries"; } - return std::forward_as_tuple(ret_success, m_supported_channels_list[ret_idx]); + return std::forward_as_tuple(ret_success, m_preferred_channels_list[ret_idx]); } void cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::class_swap() { tlvf_swap(8*sizeof(eActionOp_APMANAGER), reinterpret_cast(m_action_op)); for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ - m_supported_channels_list[i].struct_swap(); + m_preferred_channels_list[i].struct_swap(); } } @@ -3272,7 +3272,7 @@ bool cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::finalize() size_t cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::get_initial_size() { size_t class_size = 0; - class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // preferred_channels_list return class_size; } @@ -3282,14 +3282,14 @@ bool cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE::init() TLVF_LOG(ERROR) << "Not enough available space on buffer. Class init failed"; return false; } - m_supported_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; + m_preferred_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; + m_preferred_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_preferred_channels_list->struct_init(); } } if (m_parse__) { class_swap(); } return true; diff --git a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp index 25c2386ab2..ab958a5278 100644 --- a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp +++ b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_backhaul.cpp @@ -527,13 +527,13 @@ bool cACTION_BACKHAUL_ENABLE::set_vht_mcs_set(const void* buffer, size_t size) { std::copy_n(reinterpret_cast(buffer), size, m_vht_mcs_set); return true; } -std::tuple cACTION_BACKHAUL_ENABLE::supported_channels_list(size_t idx) { - bool ret_success = ( (m_supported_channels_list_idx__ > 0) && (m_supported_channels_list_idx__ > idx) ); +std::tuple cACTION_BACKHAUL_ENABLE::preferred_channels_list(size_t idx) { + bool ret_success = ( (m_preferred_channels_list_idx__ > 0) && (m_preferred_channels_list_idx__ > idx) ); size_t ret_idx = ret_success ? idx : 0; if (!ret_success) { TLVF_LOG(ERROR) << "Requested index is greater than the number of available entries"; } - return std::forward_as_tuple(ret_success, m_supported_channels_list[ret_idx]); + return std::forward_as_tuple(ret_success, m_preferred_channels_list[ret_idx]); } void cACTION_BACKHAUL_ENABLE::class_swap() @@ -547,7 +547,7 @@ void cACTION_BACKHAUL_ENABLE::class_swap() tlvf_swap(16, reinterpret_cast(m_ht_capability)); tlvf_swap(32, reinterpret_cast(m_vht_capability)); for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ - m_supported_channels_list[i].struct_swap(); + m_preferred_channels_list[i].struct_swap(); } } @@ -600,7 +600,7 @@ size_t cACTION_BACKHAUL_ENABLE::get_initial_size() class_size += sizeof(uint8_t); // vht_supported class_size += sizeof(uint32_t); // vht_capability class_size += beerocks::message::VHT_MCS_SET_SIZE * sizeof(uint8_t); // vht_mcs_set - class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels_list + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // preferred_channels_list return class_size; } @@ -713,14 +713,14 @@ bool cACTION_BACKHAUL_ENABLE::init() return false; } m_vht_mcs_set_idx__ = beerocks::message::VHT_MCS_SET_SIZE; - m_supported_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; + m_preferred_channels_list = (beerocks::message::sWifiChannel*)m_buff_ptr__; if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; + m_preferred_channels_list_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels_list->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_preferred_channels_list->struct_init(); } } if (m_parse__) { class_swap(); } return true; diff --git a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp index 283b88128f..cd0438881b 100644 --- a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp +++ b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_control.cpp @@ -1879,13 +1879,13 @@ sApChannelSwitch& cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::cs_params() { return (sApChannelSwitch&)(*m_cs_params); } -std::tuple cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::supported_channels(size_t idx) { - bool ret_success = ( (m_supported_channels_idx__ > 0) && (m_supported_channels_idx__ > idx) ); +std::tuple cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::preferred_channels(size_t idx) { + bool ret_success = ( (m_preferred_channels_idx__ > 0) && (m_preferred_channels_idx__ > idx) ); size_t ret_idx = ret_success ? idx : 0; if (!ret_success) { TLVF_LOG(ERROR) << "Requested index is greater than the number of available entries"; } - return std::forward_as_tuple(ret_success, m_supported_channels[ret_idx]); + return std::forward_as_tuple(ret_success, m_preferred_channels[ret_idx]); } void cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::class_swap() @@ -1893,7 +1893,7 @@ void cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::class_swap() tlvf_swap(8*sizeof(eActionOp_CONTROL), reinterpret_cast(m_action_op)); m_cs_params->struct_swap(); for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ - m_supported_channels[i].struct_swap(); + m_preferred_channels[i].struct_swap(); } } @@ -1928,7 +1928,7 @@ size_t cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::get_initial_size() { size_t class_size = 0; class_size += sizeof(sApChannelSwitch); // cs_params - class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // preferred_channels return class_size; } @@ -1944,14 +1944,14 @@ bool cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION::init() return false; } if (!m_parse__) { m_cs_params->struct_init(); } - m_supported_channels = (beerocks::message::sWifiChannel*)m_buff_ptr__; + m_preferred_channels = (beerocks::message::sWifiChannel*)m_buff_ptr__; if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; return false; } - m_supported_channels_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; + m_preferred_channels_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; if (!m_parse__) { - for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels->struct_init(); } + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_preferred_channels->struct_init(); } } if (m_parse__) { class_swap(); } return true; diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml index 5f5fe56842..a193f51406 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml @@ -89,7 +89,7 @@ cACTION_APMANAGER_HOSTAP_ACS_ERROR_NOTIFICATION: cACTION_APMANAGER_HOSTAP_ACS_NOTIFICATION: _type: class cs_params: sApChannelSwitch - supported_channels_list: + preferred_channels_list: _type: beerocks::message::sWifiChannel _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] @@ -209,7 +209,7 @@ cACTION_APMANAGER_READ_ACS_REPORT_REQUEST: cACTION_APMANAGER_READ_ACS_REPORT_RESPONSE: _type: class - supported_channels_list: + preferred_channels_list: _type: beerocks::message::sWifiChannel _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml index e1786e5a9d..aed71badf0 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_backhaul.yaml @@ -66,7 +66,7 @@ cACTION_BACKHAUL_ENABLE: vht_mcs_set: _type: uint8_t _length: [ "beerocks::message::VHT_MCS_SET_SIZE" ] - supported_channels_list: + preferred_channels_list: _type: beerocks::message::sWifiChannel _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml index a0545f5078..5c321438a0 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml @@ -280,7 +280,7 @@ sNodeHostap: driver_version: _type: char _length: [ "beerocks::message::WIFI_DRIVER_VER_LENGTH" ] - supported_channels: + preferred_channels: _type: beerocks::message::sWifiChannel _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml index cb7b7c5a99..6b572cba6f 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_control.yaml @@ -140,7 +140,7 @@ cACTION_CONTROL_HOSTAP_ACS_ERROR_NOTIFICATION: cACTION_CONTROL_HOSTAP_ACS_NOTIFICATION: _type: class cs_params: sApChannelSwitch - supported_channels: + preferred_channels: _type: beerocks::message::sWifiChannel _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] diff --git a/controller/src/beerocks/master/son_master_thread.cpp b/controller/src/beerocks/master/son_master_thread.cpp index 18d001cdb7..c0a0577db6 100644 --- a/controller/src/beerocks/master/son_master_thread.cpp +++ b/controller/src/beerocks/master/son_master_thread.cpp @@ -2101,7 +2101,7 @@ bool master_thread::handle_intel_slave_join( database.set_node_ipv4(radio_mac, bridge_ipv4); database.set_node_manufacturer(radio_mac, "Intel"); - database.set_hostap_supported_channels(radio_mac, notification->hostap().supported_channels, + database.set_hostap_supported_channels(radio_mac, notification->hostap().preferred_channels, message::RADIO_CHANNELS_LENGTH); if (database.get_node_5ghz_support(radio_mac)) { @@ -2183,9 +2183,9 @@ bool master_thread::handle_intel_slave_join( << " cs_new_event = " << intptr_t(cs_new_event); cs_new_event->hostap_mac = network_utils::mac_from_string(radio_mac); cs_new_event->cs_params = notification->cs_params(); - for (auto supported_channel : notification->hostap().supported_channels) { - if (supported_channel.channel > 0) { - LOG(DEBUG) << "supported_channel = " << int(supported_channel.channel); + for (auto preferred_channel : notification->hostap().preferred_channels) { + if (preferred_channel.channel > 0) { + LOG(DEBUG) << "preferred_channel = " << int(preferred_channel.channel); } } @@ -2559,8 +2559,8 @@ bool master_thread::handle_cmdu_control_message(const std::string &src_mac, CHANNEL_SELECTION_ALLOCATE_EVENT(channel_selection_task::sAcsResponse_event); new_event->hostap_mac = network_utils::mac_from_string(hostap_mac); new_event->cs_params = notification->cs_params(); - auto tuple_supported_channels = notification->supported_channels(0); - std::copy_n(&std::get<1>(tuple_supported_channels), message::RADIO_CHANNELS_LENGTH, + auto tuple_preferred_channels = notification->preferred_channels(0); + std::copy_n(&std::get<1>(tuple_preferred_channels), message::RADIO_CHANNELS_LENGTH, new_event->supported_channels); tasks.push_event(database.get_channel_selection_task_id(), (int)channel_selection_task::eEvent::ACS_RESPONSE_EVENT, From 24740e420e3d89876dcf537bce2e7d0f1823a23e Mon Sep 17 00:00:00 2001 From: Itay Elenzweig Date: Mon, 20 Apr 2020 21:07:07 +0000 Subject: [PATCH 4/7] treewide: Add new supported_channels Currently only the preferred_channels are used throughout the codebase. They is sent as part of the ACTION_APMANAGER_JOINED_NOTIFICATION message. To support the AP Radio Basic Capabilities the supported_channels gathered from the NL80211 need to be used instead. Add supported_channels to the RadioInfo in the bwl Add supported_channels to the ACTION_APMANAGER_JOINED_NOTIFICATION message. Signed-off-by: Itay Elenzweig --- .../src/beerocks/slave/ap_manager_thread.cpp | 5 ++ .../beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp | 48 ++++++++++++++++++- .../beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp | 4 +- .../bwl/econet/ap_wlan_hal_econet.cpp | 48 ++++++++++++++++++- .../bwl/include/bwl/base_wlan_hal_types.h | 1 + .../bwl/nl80211/ap_wlan_hal_nl80211.cpp | 2 +- .../tlvf/beerocks_message_apmanager.h | 4 ++ .../tlvf/beerocks_message_apmanager.cpp | 22 +++++++++ .../tlvf/beerocks_message_apmanager.yaml | 3 ++ 9 files changed, 132 insertions(+), 5 deletions(-) diff --git a/agent/src/beerocks/slave/ap_manager_thread.cpp b/agent/src/beerocks/slave/ap_manager_thread.cpp index 76441a4c04..8f3393829c 100644 --- a/agent/src/beerocks/slave/ap_manager_thread.cpp +++ b/agent/src/beerocks/slave/ap_manager_thread.cpp @@ -1569,6 +1569,9 @@ void ap_manager_thread::handle_hostapd_attached() beerocks::message::VHT_MCS_SET_SIZE, notification->params().vht_mcs_set); // Copy the channels supported by the AP + auto tuple_supported_channels = notification->supported_channels(0); + copy_radio_channels(ap_wlan_hal->get_radio_info().supported_channels, + &std::get<1>(tuple_supported_channels)); copy_radio_channels(ap_wlan_hal->get_radio_info().preferred_channels, notification->params().preferred_channels); @@ -1588,6 +1591,8 @@ void ap_manager_thread::handle_hostapd_attached() LOG(INFO) << " vht_capability = " << std::hex << ap_wlan_hal->get_radio_info().vht_capability; LOG(INFO) << " preferred_channels = " << std::endl << get_radio_channels_string(ap_wlan_hal->get_radio_info().preferred_channels); + LOG(INFO) << " supported_channels = " << std::endl + << get_radio_channels_string(ap_wlan_hal->get_radio_info().supported_channels); // Send CMDU message_com::send_cmdu(slave_socket, cmdu_tx); diff --git a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp index efa8cfcbf8..a6b313f0ce 100644 --- a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp +++ b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp @@ -323,7 +323,53 @@ bool ap_wlan_hal_dummy::read_acs_report() return true; } -bool ap_wlan_hal_dummy::read_supported_channels() { return true; } +bool ap_wlan_hal_dummy::read_supported_channels() +{ + uint8_t idx = 0; + if (m_radio_info.is_5ghz == false) { + m_radio_info.channel = 1; + // 2.4G simulated report + for (uint16_t ch = 1; ch <= 11; ch++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20; + m_radio_info.supported_channels[idx].bss_overlap = 10; + m_radio_info.supported_channels[idx].is_dfs = 0; + idx++; + } + } else { + // 5G simulated report + m_radio_info.channel = 149; + for (uint16_t ch = 36; ch <= 64; ch += 4) { + for (uint16_t step = 0; step < 3; step++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.supported_channels[idx].is_dfs = (ch > 48) ? 1 : 0; + idx++; + } + } + for (uint16_t ch = 100; ch <= 144; ch += 4) { + for (uint16_t step = 0; step < 3; step++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.supported_channels[idx].is_dfs = 1; + idx++; + } + } + for (uint16_t ch = 149; ch <= 165; ch += 4) { + for (uint16_t step = 0; step < 3; step++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.supported_channels[idx].is_dfs = 0; + idx++; + } + } + } + + return true; +} bool ap_wlan_hal_dummy::set_tx_power_limit(int tx_pow_limit) { diff --git a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp index c751f2985d..37928f3b59 100644 --- a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp +++ b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp @@ -1551,8 +1551,8 @@ bool ap_wlan_hal_dwpal::read_supported_channels() } } - m_radio_info.preferred_channels.insert(m_radio_info.preferred_channels.begin(), - supported_channels.begin(), supported_channels.end()); + m_radio_info.supported_channels.insert(m_radio_info.supported_channels.begin(), + preferred_channels.begin(), preferred_channels.end()); return true; } diff --git a/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp b/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp index 5e05b3142d..c66b574051 100644 --- a/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp +++ b/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp @@ -320,7 +320,53 @@ bool ap_wlan_hal_dummy::read_acs_report() return true; } -bool ap_wlan_hal_dummy::read_supported_channels() { return true; } +bool ap_wlan_hal_dummy::read_supported_channels() +{ + uint8_t idx = 0; + if (m_radio_info.is_5ghz == false) { + m_radio_info.channel = 1; + // 2.4G simulated report + for (uint16_t ch = 1; ch <= 11; ch++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20; + m_radio_info.supported_channels[idx].bss_overlap = 10; + m_radio_info.supported_channels[idx].is_dfs = 0; + idx++; + } + } else { + // 5G simulated report + m_radio_info.channel = 149; + for (uint16_t ch = 36; ch <= 64; ch += 4) { + for (uint16_t step = 0; step < 3; step++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.supported_channels[idx].is_dfs = (ch > 48) ? 1 : 0; + idx++; + } + } + for (uint16_t ch = 100; ch <= 144; ch += 4) { + for (uint16_t step = 0; step < 3; step++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.supported_channels[idx].is_dfs = 1; + idx++; + } + } + for (uint16_t ch = 149; ch <= 165; ch += 4) { + for (uint16_t step = 0; step < 3; step++) { + m_radio_info.supported_channels[idx].channel = ch; + m_radio_info.supported_channels[idx].bandwidth = 20 + step * 20; + m_radio_info.supported_channels[idx].bss_overlap = 10 + step * 10; + m_radio_info.supported_channels[idx].is_dfs = 0; + idx++; + } + } + } + + return true; +} bool ap_wlan_hal_dummy::set_tx_power_limit(int tx_pow_limit) { diff --git a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h index 90df30d926..bd84ea530d 100644 --- a/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h +++ b/common/beerocks/bwl/include/bwl/base_wlan_hal_types.h @@ -102,6 +102,7 @@ struct RadioInfo { vht_mcs_set; /**< 32-byte attribute containing the MCS set as defined in 802.11ac */ ChanSwReason last_csa_sw_reason = ChanSwReason::Unknown; std::array preferred_channels; + std::array supported_channels; std::unordered_map available_vaps; // key = vap_id }; diff --git a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp index 329065e322..d4f636dc9d 100644 --- a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp +++ b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp @@ -469,7 +469,7 @@ bool ap_wlan_hal_nl80211::read_supported_channels() } } - m_radio_info.preferred_channels.insert(m_radio_info.preferred_channels.begin(), + m_radio_info.supported_channels.insert(m_radio_info.supported_channels.begin(), supported_channels.begin(), supported_channels.end()); return true; } diff --git a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h index 53274cae51..104f13b950 100644 --- a/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h +++ b/common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_apmanager.h @@ -61,6 +61,7 @@ class cACTION_APMANAGER_JOINED_NOTIFICATION : public BaseClass static eActionOp_APMANAGER get_action_op(){ return (eActionOp_APMANAGER)(ACTION_APMANAGER_JOINED_NOTIFICATION); } + std::tuple supported_channels(size_t idx); sNodeHostap& params(); sApChannelSwitch& cs_params(); void class_swap() override; @@ -70,6 +71,9 @@ class cACTION_APMANAGER_JOINED_NOTIFICATION : public BaseClass private: bool init(); eActionOp_APMANAGER* m_action_op = nullptr; + beerocks::message::sWifiChannel* m_supported_channels = nullptr; + size_t m_supported_channels_idx__ = 0; + int m_lock_order_counter__ = 0; sNodeHostap* m_params = nullptr; sApChannelSwitch* m_cs_params = nullptr; }; diff --git a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp index abbf00c7cd..bd4cf3402f 100644 --- a/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp +++ b/common/beerocks/tlvf/AutoGenerated/src/beerocks/tlvf/beerocks_message_apmanager.cpp @@ -107,6 +107,15 @@ BaseClass(base->getBuffPtr(), base->getBuffRemainingBytes(), parse){ } cACTION_APMANAGER_JOINED_NOTIFICATION::~cACTION_APMANAGER_JOINED_NOTIFICATION() { } +std::tuple cACTION_APMANAGER_JOINED_NOTIFICATION::supported_channels(size_t idx) { + bool ret_success = ( (m_supported_channels_idx__ > 0) && (m_supported_channels_idx__ > idx) ); + size_t ret_idx = ret_success ? idx : 0; + if (!ret_success) { + TLVF_LOG(ERROR) << "Requested index is greater than the number of available entries"; + } + return std::forward_as_tuple(ret_success, m_supported_channels[ret_idx]); +} + sNodeHostap& cACTION_APMANAGER_JOINED_NOTIFICATION::params() { return (sNodeHostap&)(*m_params); } @@ -118,6 +127,9 @@ sApChannelSwitch& cACTION_APMANAGER_JOINED_NOTIFICATION::cs_params() { void cACTION_APMANAGER_JOINED_NOTIFICATION::class_swap() { tlvf_swap(8*sizeof(eActionOp_APMANAGER), reinterpret_cast(m_action_op)); + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++){ + m_supported_channels[i].struct_swap(); + } m_params->struct_swap(); m_cs_params->struct_swap(); } @@ -152,6 +164,7 @@ bool cACTION_APMANAGER_JOINED_NOTIFICATION::finalize() size_t cACTION_APMANAGER_JOINED_NOTIFICATION::get_initial_size() { size_t class_size = 0; + class_size += beerocks::message::RADIO_CHANNELS_LENGTH * sizeof(beerocks::message::sWifiChannel); // supported_channels class_size += sizeof(sNodeHostap); // params class_size += sizeof(sApChannelSwitch); // cs_params return class_size; @@ -163,6 +176,15 @@ bool cACTION_APMANAGER_JOINED_NOTIFICATION::init() TLVF_LOG(ERROR) << "Not enough available space on buffer. Class init failed"; return false; } + m_supported_channels = (beerocks::message::sWifiChannel*)m_buff_ptr__; + if (!buffPtrIncrementSafe(sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH))) { + LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(beerocks::message::sWifiChannel) * (beerocks::message::RADIO_CHANNELS_LENGTH) << ") Failed!"; + return false; + } + m_supported_channels_idx__ = beerocks::message::RADIO_CHANNELS_LENGTH; + if (!m_parse__) { + for (size_t i = 0; i < beerocks::message::RADIO_CHANNELS_LENGTH; i++) { m_supported_channels->struct_init(); } + } m_params = (sNodeHostap*)m_buff_ptr__; if (!buffPtrIncrementSafe(sizeof(sNodeHostap))) { LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(sNodeHostap) << ") Failed!"; diff --git a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml index a193f51406..3efee3d568 100755 --- a/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml +++ b/common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_apmanager.yaml @@ -25,6 +25,9 @@ cACTION_APMANAGER_4ADDR_STA_JOINED: cACTION_APMANAGER_JOINED_NOTIFICATION: _type: class + supported_channels: + _type: beerocks::message::sWifiChannel + _length: [ "beerocks::message::RADIO_CHANNELS_LENGTH" ] params: sNodeHostap cs_params: sApChannelSwitch From 6d2654b181173129f30c8d1b45253d5719dd5b16 Mon Sep 17 00:00:00 2001 From: Itay Elenzweig Date: Mon, 20 Apr 2020 21:08:02 +0000 Subject: [PATCH 5/7] bwl: add update_preference_channels_from_supported_channels In handle_hostapd_attached the ACS report is used to fill the preferred_channels array. If the ACS is not enabled the supported_channels are used instead. Create a function that copies the supported_channels to the preferred_channels. Use the function when the ACS is not enabled. Read the supported channels regardless of the ACS. Signed-off-by: Itay Elenzweig --- agent/src/beerocks/slave/ap_manager_thread.cpp | 3 ++- common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp | 6 ++++++ common/beerocks/bwl/dummy/ap_wlan_hal_dummy.h | 1 + common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp | 6 ++++++ common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.h | 1 + common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp | 6 ++++++ common/beerocks/bwl/econet/ap_wlan_hal_econet.h | 1 + common/beerocks/bwl/include/bwl/ap_wlan_hal.h | 10 +++++++++- common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp | 6 ++++++ common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.h | 1 + 10 files changed, 39 insertions(+), 2 deletions(-) diff --git a/agent/src/beerocks/slave/ap_manager_thread.cpp b/agent/src/beerocks/slave/ap_manager_thread.cpp index 8f3393829c..b33a1aa21c 100644 --- a/agent/src/beerocks/slave/ap_manager_thread.cpp +++ b/agent/src/beerocks/slave/ap_manager_thread.cpp @@ -1512,6 +1512,7 @@ void ap_manager_thread::handle_hostapd_attached() { LOG(DEBUG) << "handling enabled hostapd"; + ap_wlan_hal->read_supported_channels(); if (acs_enabled) { LOG(DEBUG) << "retrieving ACS report"; int read_acs_attempt = 0; @@ -1527,7 +1528,7 @@ void ap_manager_thread::handle_hostapd_attached() usleep(ACS_READ_SLEEP_USC); } } else { - ap_wlan_hal->read_supported_channels(); + ap_wlan_hal->update_preference_channels_from_supported_channels(); } auto notification = diff --git a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp index a6b313f0ce..bfffc82e2f 100644 --- a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp +++ b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp @@ -371,6 +371,12 @@ bool ap_wlan_hal_dummy::read_supported_channels() return true; } +bool ap_wlan_hal_dummy::update_preference_channels_from_supported_channels() +{ + m_radio_info.preferred_channels = m_radio_info.supported_channels; + return true; +} + bool ap_wlan_hal_dummy::set_tx_power_limit(int tx_pow_limit) { LOG(TRACE) << " setting power limit: " << tx_pow_limit << " dBm"; diff --git a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.h b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.h index 3b3db17605..916249e2f0 100644 --- a/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.h +++ b/common/beerocks/bwl/dummy/ap_wlan_hal_dummy.h @@ -68,6 +68,7 @@ class ap_wlan_hal_dummy : public base_wlan_hal_dummy, public ap_wlan_hal { virtual bool restricted_channels_get(char *channel_list) override; virtual bool read_acs_report() override; virtual bool read_supported_channels() override; + virtual bool update_preference_channels_from_supported_channels() override; virtual bool set_tx_power_limit(int tx_pow_limit) override; virtual std::string get_radio_driver_version() override; virtual bool set_vap_enable(const std::string &iface_name, const bool enable) override; diff --git a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp index 37928f3b59..d50c980746 100644 --- a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp +++ b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp @@ -1556,6 +1556,12 @@ bool ap_wlan_hal_dwpal::read_supported_channels() return true; } +bool ap_wlan_hal_dwpal::update_preference_channels_from_supported_channels() +{ + m_radio_info.preferred_channels = m_radio_info.supported_channels; + return true; +} + bool ap_wlan_hal_dwpal::set_tx_power_limit(int tx_pow_limit) { return m_nl80211_client->set_tx_power_limit(m_radio_info.iface_name, tx_pow_limit); diff --git a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.h b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.h index 34d0c3ab2a..a5a62efe86 100644 --- a/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.h +++ b/common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.h @@ -68,6 +68,7 @@ class ap_wlan_hal_dwpal : public base_wlan_hal_dwpal, public ap_wlan_hal { virtual bool restricted_channels_get(char *channel_list) override; virtual bool read_acs_report() override; virtual bool read_supported_channels() override; + virtual bool update_preference_channels_from_supported_channels() override; virtual bool set_tx_power_limit(int tx_pow_limit) override; virtual std::string get_radio_driver_version() override; virtual bool set_vap_enable(const std::string &iface_name, const bool enable) override; diff --git a/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp b/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp index c66b574051..72b5ceab6e 100644 --- a/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp +++ b/common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp @@ -368,6 +368,12 @@ bool ap_wlan_hal_dummy::read_supported_channels() return true; } +bool ap_wlan_hal_dummy::update_preference_channels_from_supported_channels() +{ + m_radio_info.preferred_channels = m_radio_info.supported_channels; + return true; +} + bool ap_wlan_hal_dummy::set_tx_power_limit(int tx_pow_limit) { LOG(TRACE) << __func__ << " power limit: " << tx_pow_limit; diff --git a/common/beerocks/bwl/econet/ap_wlan_hal_econet.h b/common/beerocks/bwl/econet/ap_wlan_hal_econet.h index b12be90d58..feeb657e80 100644 --- a/common/beerocks/bwl/econet/ap_wlan_hal_econet.h +++ b/common/beerocks/bwl/econet/ap_wlan_hal_econet.h @@ -68,6 +68,7 @@ class ap_wlan_hal_dummy : public base_wlan_hal_dummy, public ap_wlan_hal { virtual bool restricted_channels_get(char *channel_list) override; virtual bool read_acs_report() override; virtual bool read_supported_channels() override; + virtual bool update_preference_channels_from_supported_channels() override; virtual bool set_tx_power_limit(int tx_pow_limit) override; virtual std::string get_radio_driver_version() override; virtual bool set_vap_enable(const std::string &iface_name, const bool enable) override; diff --git a/common/beerocks/bwl/include/bwl/ap_wlan_hal.h b/common/beerocks/bwl/include/bwl/ap_wlan_hal.h index ed55037af0..c49b1a1a36 100644 --- a/common/beerocks/bwl/include/bwl/ap_wlan_hal.h +++ b/common/beerocks/bwl/include/bwl/ap_wlan_hal.h @@ -311,13 +311,21 @@ class ap_wlan_hal : public virtual base_wlan_hal { virtual bool read_acs_report() = 0; /*! - * Read the supported channls from the hardware + * Read the supported channels from the hardware * On successful completion the information can be retrieved * * @return true on success or false on error. */ virtual bool read_supported_channels() = 0; + /*! + * Copy the supported channels to the preferred channels + * On successful completion the preferred channels can be retrieved + * + * @return true on success or false on error. + */ + virtual bool update_preference_channels_from_supported_channels() = 0; + /*! * Set Transmit Power Limit * diff --git a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp index d4f636dc9d..ccbf67ce44 100644 --- a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp +++ b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp @@ -474,6 +474,12 @@ bool ap_wlan_hal_nl80211::read_supported_channels() return true; } +bool ap_wlan_hal_nl80211::update_preference_channels_from_supported_channels() +{ + m_radio_info.preferred_channels = m_radio_info.supported_channels; + return true; +} + bool ap_wlan_hal_nl80211::set_tx_power_limit(int tx_pow_limit) { return m_nl80211_client->set_tx_power_limit(m_radio_info.iface_name, tx_pow_limit); diff --git a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.h b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.h index 20a06bf616..680207e1d7 100644 --- a/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.h +++ b/common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.h @@ -67,6 +67,7 @@ class ap_wlan_hal_nl80211 : public base_wlan_hal_nl80211, public ap_wlan_hal { virtual bool restricted_channels_get(char *channel_list) override; virtual bool read_acs_report() override; virtual bool read_supported_channels() override; + virtual bool update_preference_channels_from_supported_channels() override; virtual bool set_tx_power_limit(int tx_pow_limit) override; virtual std::string get_radio_driver_version() override; virtual bool set_vap_enable(const std::string &iface_name, const bool enable) override; From 7f1d050672dd8bdad75415a4885b3f055309a1d6 Mon Sep 17 00:00:00 2001 From: Itay Elenzweig Date: Mon, 20 Apr 2020 21:17:24 +0000 Subject: [PATCH 6/7] slave: son_slave: use the supported_channels The supported_channels are sent to the son_slave but are not used. The supported_channels need to be used in the AP radio capabilities during the JOIN_MASTER state. Store the supported_channels from ACTION_APMANAGER_JOINED_NOTIFICATION. Use the supported_channels for add_ap_radio_basic_capabilities. Signed-off-by: Itay Elenzweig --- agent/src/beerocks/slave/son_slave_thread.cpp | 11 +++++++---- agent/src/beerocks/slave/son_slave_thread.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/agent/src/beerocks/slave/son_slave_thread.cpp b/agent/src/beerocks/slave/son_slave_thread.cpp index d77ddde20c..d097407311 100644 --- a/agent/src/beerocks/slave/son_slave_thread.cpp +++ b/agent/src/beerocks/slave/son_slave_thread.cpp @@ -1626,6 +1626,9 @@ bool slave_thread::handle_cmdu_ap_manager_message(Socket *sd, } hostap_params = notification->params(); hostap_cs_params = notification->cs_params(); + auto tuple_supported_channels = notification->supported_channels(0); + std::copy_n(&std::get<1>(tuple_supported_channels), message::RADIO_CHANNELS_LENGTH, + supported_channels); if (slave_state == STATE_WAIT_FOR_AP_MANAGER_JOINED) { slave_state = STATE_AP_MANAGER_JOINED; } else { @@ -3384,12 +3387,12 @@ bool slave_thread::slave_fsm(bool &call_slave_select) } std::array - preferred_channels; - std::copy_n(std::begin(hostap_params.preferred_channels), preferred_channels.size(), - preferred_channels.begin()); + supported_channels; + std::copy_n(std::begin(hostap_params.supported_channels), supported_channels.size(), + supported_channels.begin()); if (!tlvf_utils::add_ap_radio_basic_capabilities(cmdu_tx, hostap_params.iface_mac, - preferred_channels)) { + supported_channels)) { LOG(ERROR) << "Failed adding AP Radio Basic Capabilities TLV"; return false; } diff --git a/agent/src/beerocks/slave/son_slave_thread.h b/agent/src/beerocks/slave/son_slave_thread.h index c5b17821bb..9bfdd53605 100644 --- a/agent/src/beerocks/slave/son_slave_thread.h +++ b/agent/src/beerocks/slave/son_slave_thread.h @@ -200,6 +200,7 @@ class slave_thread : public beerocks::socket_thread { sSlaveBackhaulParams backhaul_params; beerocks_message::sNodeHostap hostap_params; beerocks_message::sApChannelSwitch hostap_cs_params; + std::vector supported_channels; std::vector channel_preferences; SocketClient *platform_manager_socket = nullptr; From ea6d3f5e849f632e9dbaf783be4e54e22cff67a9 Mon Sep 17 00:00:00 2001 From: Itay Elenzweig Date: Mon, 20 Apr 2020 21:17:43 +0000 Subject: [PATCH 7/7] controller: son_master: print AP Radio Basic Capabilities The supported channels are sent to the son_slave from the AP manager. Then they are sent from the son_slave to the son_master as part of the. AP Radio Basic Capabilities message that is then processed in autoconfig_wsc_parse_radio_caps. Add a print in the son_master to see the AP Radio Basic Capabilities. Signed-off-by: Itay Elenzweig --- controller/src/beerocks/master/son_master_thread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/src/beerocks/master/son_master_thread.cpp b/controller/src/beerocks/master/son_master_thread.cpp index c0a0577db6..23c3da0f40 100644 --- a/controller/src/beerocks/master/son_master_thread.cpp +++ b/controller/src/beerocks/master/son_master_thread.cpp @@ -2243,8 +2243,8 @@ bool master_thread::autoconfig_wsc_parse_radio_caps( LOG(WARNING) << "operating class info list larger then maximum supported channels"; operating_classes_list_length = beerocks::message::RADIO_CHANNELS_LENGTH; } + std::stringstream ss; for (int oc_idx = 0; oc_idx < operating_classes_list_length; oc_idx++) { - std::stringstream ss; auto operating_class_tuple = radio_caps->operating_classes_info_list(oc_idx); if (!std::get<0>(operating_class_tuple)) { LOG(ERROR) << "getting operating class entry has failed!"; @@ -2272,11 +2272,11 @@ bool master_thread::autoconfig_wsc_parse_radio_caps( non_operable_channels.push_back(*channel); } ss << " }" << std::endl; - // LOG(DEBUG) << ss.str(); // store operating class in the DB for this hostap database.add_hostap_supported_operating_class( radio_mac, operating_class, maximum_transmit_power_dbm, non_operable_channels); } + LOG(DEBUG) << "Radio basic capabilities:" << std::endl << ss.str(); return true; }