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

Conversation

itayx
Copy link
Collaborator

@itayx itayx commented Apr 1, 2020

The supported_channels are needed to created the Radio Basic Capabilities TLV
To do so they need to be sent to the son_slave_thread, where they will be stored locally
Then the son_slave_thread needs to sent the stored hardware_supported_channels to the son_master_thread as part of the Radio Basic Capabilities TLV

@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from 8965e83 to b0b8a9e Compare April 1, 2020 09:32
@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch 2 times, most recently from 95f0cc2 to bd8d2c9 Compare April 1, 2020 11:05
@itayx itayx changed the title bwl: refactor read_supported_channels to use get_radio_info bwl: update basic radio capabilities Apr 1, 2020
@tomereli
Copy link
Collaborator

tomereli commented Apr 1, 2020

I don't like where this is going - reading supported channels should be done as part of refresh_radio_info. Please make sure to follow this direction.

@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch 3 times, most recently from 5df65ff to 6b4002f Compare April 6, 2020 12:18
@itayx itayx marked this pull request as ready for review April 6, 2020 12:19
@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from 6b4002f to 547a603 Compare April 6, 2020 14:49
@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from 547a603 to cb65b88 Compare April 7, 2020 09:02
Copy link
Collaborator

@arnout arnout left a comment

Choose a reason for hiding this comment

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

In addition to the comments I made: I would expect supported_channels to be removed from sNodeHostap as well. Is there any reason to keep it there?

Not marking as changes requested because I don't know if I'll still do the re-review.

agent/src/beerocks/slave/ap_manager_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/slave/ap_manager_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/slave/ap_manager_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/slave/son_slave_thread.h Outdated Show resolved Hide resolved
@kantera800 kantera800 self-requested a review April 8, 2020 11:45
Copy link
Collaborator

@kantera800 kantera800 left a comment

Choose a reason for hiding this comment

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

I saw couple valuable comments in this PR that need to be addressed.
IMO this is what is still missing:

  1. in handle_hostapd_attached() - when there is no "acs report" need to update_preference_channels_from_supoorted_channels() instead of read_supported_channels()
  2. need to add controller commit that removes set_hostap_supported_channels() from handle_intel_slave_join() since only add_hostap_supported_operating_class() will handle this from now on.
  3. verify changes in 2 scenarios :
    a. Radio configured as Auto channel
    b. Radio configured as Static channel
    print "supported_channels" after autoconfig_wsc_parse_radio_caps().
    Check that in both scenarios prints are the same.
    add the result to PR description.

@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from cb65b88 to 2c2f23c Compare April 12, 2020 16:10
@itayx itayx requested a review from vitalybu as a code owner April 12, 2020 16:10
@itayx
Copy link
Collaborator Author

itayx commented Apr 13, 2020

This is the result of the print in master_thread::autoconfig_wsc_parse_radio_caps after the changes made in this PR

I checked the print two times, one with the radio channel set to auto
and one with the radio channel set to a static value (5G: 36, 2.4G: 5)

While on auto-channel:

operating_class=115
maximum_transmit_power_dbm=30
channel list={ 36 40 44 48 }
statically_non_operable_channel_list={ }
operating_class=116
maximum_transmit_power_dbm=30
channel list={ 36 44 }
statically_non_operable_channel_list={ }
operating_class=117
maximum_transmit_power_dbm=30
channel list={ 40 48 }
statically_non_operable_channel_list={ }
operating_class=124
maximum_transmit_power_dbm=30
channel list={ 149 153 157 161 }
statically_non_operable_channel_list={ }
operating_class=125
maximum_transmit_power_dbm=30
channel list={ 149 153 157 161 165 169 }
statically_non_operable_channel_list={ 169 }
operating_class=126
maximum_transmit_power_dbm=30
channel list={ 149 157 }
statically_non_operable_channel_list={ }
operating_class=127
maximum_transmit_power_dbm=30
channel list={ 153 161 }
statically_non_operable_channel_list={ }
operating_class=81
maximum_transmit_power_dbm=30
channel list={ 1 2 3 4 5 6 7 8 9 10 11 12 13 }
statically_non_operable_channel_list={ 12 13 }
operating_class=83
maximum_transmit_power_dbm=30
channel list={ 1 2 3 4 5 6 7 8 9 }
statically_non_operable_channel_list={ }

while on static channel:

operating_class=81
maximum_transmit_power_dbm=30
channel list={ 1 2 3 4 5 6 7 8 9 10 11 12 13 }
statically_non_operable_channel_list={ 12 13 }
operating_class=83
maximum_transmit_power_dbm=30
channel list={ 1 2 3 4 5 6 7 8 9 }
statically_non_operable_channel_list={ }
operating_class=115
maximum_transmit_power_dbm=30
channel list={ 36 40 44 48 }
statically_non_operable_channel_list={ }
operating_class=116
maximum_transmit_power_dbm=30
channel list={ 36 44 }
statically_non_operable_channel_list={ }
operating_class=117
maximum_transmit_power_dbm=30
channel list={ 40 48 }
statically_non_operable_channel_list={ }
operating_class=124
maximum_transmit_power_dbm=30
channel list={ 149 153 157 161 }
statically_non_operable_channel_list={ }
operating_class=125
maximum_transmit_power_dbm=30
channel list={ 149 153 157 161 165 169 }
statically_non_operable_channel_list={ 169 }
operating_class=126
maximum_transmit_power_dbm=30
channel list={ 149 157 }
statically_non_operable_channel_list={ }
operating_class=127
maximum_transmit_power_dbm=30
channel list={ 153 161 }

@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch 3 times, most recently from 83f8546 to bfc3d86 Compare April 15, 2020 12:22
@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from bfc3d86 to 7264120 Compare April 16, 2020 09:22
@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from 7264120 to 3b8bd4b Compare April 19, 2020 18:43
@itayx itayx requested review from kantera800 and tomereli April 19, 2020 18:43
Copy link
Collaborator

@tomereli tomereli left a comment

Choose a reason for hiding this comment

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

This PR is wrong and confusing as hell. You should build a new one which does this with the following commits:

  1. rename supported_channels -> prefered_channels
  2. change prefered_channels to use std::array
  3. add supported_channels using nl

@@ -31,6 +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.preferred_channels.resize(128 /* TODO: Get real value */);
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO should be accompanied with an issue URL which should fix it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, the commit message is really short.

Suggestion:

Preparative commit.
Currently, the supported channels used in prplMesh per radio are the channels read from ACS (Automatic channel scan) report. This is wrong, the ACS report holds the prefered channels, not the supported channels.
The supported channels should be read from the driver via NL, and a new preferred channels vector should be added to hold the ACS results. This will be done in followup commits, for now, just add empty preferred_channels to the radio info structure.

common/beerocks/bwl/common/base_wlan_hal.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/slave/son_slave_thread.cpp Outdated Show resolved Hide resolved
@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from 3b8bd4b to 14facdf Compare April 20, 2020 21:21
itayx added 7 commits April 21, 2020 07:35
…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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
@itayx itayx force-pushed the feature/update-basic-radio-capabilities branch from 14facdf to ea6d3f5 Compare April 21, 2020 07:37
Copy link
Collaborator

@tomereli tomereli left a comment

Choose a reason for hiding this comment

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

Better, but still a lot of comments, some major, so asking for re-review.

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Why change to 128 by default?
  2. why change at all? it should be changed to supported channels length and when you add the preferred channels length we will use a new enum.
  3. The name is bad - NUM_SUPPORTED_CHANNELS and NUM_PREFERRED_CHANNELS is better.

@@ -33,30 +33,28 @@ using namespace beerocks::net;
/////////////////////////// Local Module Functions ///////////////////////////
//////////////////////////////////////////////////////////////////////////////

static void copy_radio_supported_channels(std::shared_ptr<bwl::ap_wlan_hal> &ap_wlan_hal,
beerocks::message::sWifiChannel supported_channels[])
static void copy_radio_channels(std::vector<bwl::WiFiChannel> radio_channels,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a better name now should be just copy_channels cause thats all it does:

static void copy_channels(std::vector<bwl::WiFiChannel> &from,
                                         beerocks::message::sWiFiChannel to[]);

(nitpick)

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Copy the channels supported by the AP

@@ -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(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a bug - isn't it?

Suggested change
m_radio_info.supported_channels.insert(m_radio_info.supported_channels.begin(),
m_radio_info.supported_channels.insert(m_radio_info.supported_channels.begin(),
supported_channels.begin(), supported_channels.end());

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that I look at it again - this is part of a functino which shouldn't exist in this commit - bool ap_wlan_hal_dwpal::read_supported_channels() - I'm confused, didn't the previous commit replace all occurrences of supported channels with preferred channels?

@@ -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(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here as well - the read_supported_channels() should not exist in this commit.

@@ -25,6 +25,9 @@ cACTION_APMANAGER_4ADDR_STA_JOINED:

cACTION_APMANAGER_JOINED_NOTIFICATION:
_type: class
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.

This should be in a separate commit with the autogenerated files changes (nitpick)

@@ -1512,6 +1512,7 @@ void ap_manager_thread::handle_hostapd_attached()
{
LOG(DEBUG) << "handling enabled hostapd";

ap_wlan_hal->read_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.

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.

@@ -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.

@@ -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.

@itayx itayx closed this May 20, 2020
@itayx itayx deleted the feature/update-basic-radio-capabilities branch May 20, 2020 07:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Update Radio Basic Capabilities TLV using the new supported_channels
5 participants