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

bwl: update basic radio capabilities #1065

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent/src/beerocks/slave/ap_manager_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,7 @@ void ap_manager_thread::handle_hostapd_attached()
{
LOG(DEBUG) << "handling enabled hostapd";

ap_wlan_hal->read_supported_channels();
itayx marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we read the supported channels here? we anyway read it from NL so why every time we attach to hostapd? This should be done only once.

if (acs_enabled) {
LOG(DEBUG) << "retrieving ACS report";
int read_acs_attempt = 0;
Expand All @@ -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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - the logic of how we choose the channel preference should be abstracted by the BWL.
So instead we should have a read_preferred_channels() API in BWL which internally will use the radio supported channels we read at boot if ACS is disabled.
So - this whole commit should be removed, and replaced with a simple clear API to read preferred channels exactly like the API to read supported channels.

}

auto notification =
Expand Down
6 changes: 6 additions & 0 deletions common/beerocks/bwl/dummy/ap_wlan_hal_dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions common/beerocks/bwl/dummy/ap_wlan_hal_dummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions common/beerocks/bwl/dwpal/ap_wlan_hal_dwpal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions common/beerocks/bwl/econet/ap_wlan_hal_econet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions common/beerocks/bwl/econet/ap_wlan_hal_econet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion common/beerocks/bwl/include/bwl/ap_wlan_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
6 changes: 6 additions & 0 deletions common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you already do this here - so the API is very simple.. Just use m_radio_info.supported_channels if ACS is disabled.

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);
Expand Down
1 change: 1 addition & 0 deletions common/beerocks/bwl/nl80211/ap_wlan_hal_nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down