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

[DCS Patch 4/5] port dynamic channel selection from rdkb flow #694

Merged

Conversation

itayx
Copy link
Collaborator

@itayx itayx commented Jan 20, 2020

The Dynamic Channel Selection as a feature can provide information on the supported channels which can be utilized by the management system to provide better availability and user experience.
#562

The Dynamic Channel Selection feature is divided into several pull request, this is the forth out of 5

Dynamic channel selection message flow & actions

Changes in this PR include the following:

  • agent: monitor_thread: proccess nl events
  • agent: monitor_thread: handle channel scan events
  • agent: monitor_thread: handle channel scan trigger CMDU
  • controller & agent: master & slave: DCS channel scan
  • controller: son_managment: DCS channel scan stubs
  • controller: son_managment: DCS channel scan
  • controller: bml: DCS channel scan setup
  • controller: bml: DCS channel scan, set/get enable
  • controller: bml: DCS channel scan, set/get params
  • controller: bml: DCS channel scan, start single scan
  • controller: bml: DCS channel scan, get results

Before merging this PR please merge hotfix #695

@kantera800 kantera800 requested a review from vitalybu January 20, 2020 16:56
@itayx itayx force-pushed the feature/port-dynamic-channel-selection-from-rdkb-flow branch from 34ce4b5 to d30c335 Compare January 20, 2020 17:32
Copy link
Collaborator

@vitalybu vitalybu left a comment

Choose a reason for hiding this comment

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

Reviewed till: controller: bml: DCS channel scan setup

agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
controller/src/beerocks/master/son_management.cpp Outdated Show resolved Hide resolved
@itayx itayx force-pushed the feature/port-dynamic-channel-selection-from-rdkb-flow branch from d30c335 to bf6b727 Compare January 20, 2020 19:05
@itayx
Copy link
Collaborator Author

itayx commented Jan 20, 2020

This PR is dependent on hotfix #695

@arnout
Copy link
Collaborator

arnout commented Jan 21, 2020

Copy link
Collaborator

@rmelotte rmelotte left a comment

Choose a reason for hiding this comment

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

Did a quick code review, lot of the comments are the same. Note that I only blindly reviewed the code itself, not the overall changes, because I don't know enough about it to review it. For this reason I'm only adding this as a comment, not approving nor requesting changes (please take the comments into account though).

Most were:

  • There were many uses of ptr == nullptr to compare pointers, you should use ! ptr directly. There were a lot of these, I didn't add a comment for all of them.

  • Please also remove all C style-casts and use a more appropriate one (probably static_cast in all cases).

  • Also don't use std::string for mac addresses, use sMacAddr instead.

controller/src/beerocks/master/son_master_thread.cpp Outdated Show resolved Hide resolved
controller/src/beerocks/master/son_master_thread.cpp Outdated Show resolved Hide resolved
controller/src/beerocks/master/son_master_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
@@ -101,6 +102,13 @@ void monitor_thread::stop_monitor_thread()
mon_hal_int_events = nullptr;
}

if (mon_hal_nl_events) {
remove_socket(mon_hal_nl_events);
delete mon_hal_nl_events;
Copy link
Collaborator

Choose a reason for hiding this comment

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

By looking at the rest of the file I wonder why we have to resort to explicitly calling delete here, though that's not related to this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kantera800
I'm not sure myself if this is needed

Copy link
Collaborator

Choose a reason for hiding this comment

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

from looking at the code remove_socket just isn't strong enough

controller/src/beerocks/bml/internal/bml_internal.cpp Outdated Show resolved Hide resolved
controller/src/beerocks/bml/internal/bml_internal.cpp Outdated Show resolved Hide resolved
controller/src/beerocks/bml/internal/bml_internal.cpp Outdated Show resolved Hide resolved
controller/src/beerocks/bml/internal/bml_internal.h Outdated Show resolved Hide resolved
controller/src/beerocks/bml/internal/bml_internal.h Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Outdated Show resolved Hide resolved
agent/src/beerocks/monitor/monitor_thread.cpp Show resolved Hide resolved
agent/src/beerocks/slave/son_slave_thread.cpp Show resolved Hide resolved
controller/src/beerocks/master/son_master_thread.cpp Outdated Show resolved Hide resolved
const unsigned int max_results_size,
uint8_t *output_result_status, bool is_single_scan)
{
if (m_sockPlatform == nullptr && !connect_to_platform()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, please separate to 2 separate if conditions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed

controller/src/beerocks/bml/internal/bml_internal.cpp Outdated Show resolved Hide resolved
//output_results_size will be set to the number of actual returning results
*output_results_size = 0;
for (auto res : scan_results) {
auto out = &((*output_results)[*output_results_size]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

auto &

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant to pass the output result as a reference.

Change the declaration of translate_channel_scan_results to accept BML_NEIGHBOR_AP &res_out instead of BML_NEIGHBOR_AP *res_out and set auto &out = (*output_results)[*output_results_size];

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh.. my bad
Fixed and added a comment explaining the whole (*output_results)[*output_results_size] deal so it would be more understandable

controller/src/beerocks/bml/internal/bml_internal.h Outdated Show resolved Hide resolved
@tomereli
Copy link
Collaborator

Channel selection test fails with this pr

@tomereli
Copy link
Collaborator

Please fix the channel selection test, then rebase squash and we'll do the followup review.

@@ -152,6 +152,9 @@ class bml_internal : public beerocks::socket_thread {
int bml_set_vap_list_credentials(const BML_VAP_INFO *vaps, const uint8_t vaps_num);
int bml_get_vap_list_credentials(BML_VAP_INFO *vaps, uint8_t &vaps_num);

//set and get channel scan enable flag
int set_dcs_continuous_scan_enable(const std::string &mac, int enable);
int get_dcs_continuous_scan_enable(const std::string &mac, int *output_enable);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not reference?

controller/src/beerocks/bml/internal/bml_internal.cpp Outdated Show resolved Hide resolved
@arnout arnout dismissed stale reviews from tomereli and vitalybu January 22, 2020 09:22

Superseded

@itayx itayx force-pushed the feature/port-dynamic-channel-selection-from-rdkb-flow branch from 41b6a12 to 22a9b51 Compare January 22, 2020 12:59
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.

Only small comments only but since the commit messages where not changed yet I'm not approving.
Please fix the new comments, update commit messages appropriately, rebase + squash and ask for a final re-review.

@@ -601,7 +601,7 @@ int bml_get_dcs_continuous_scan_params(BML_CTX ctx, const char *radio_mac, int *
* @return BML_RET_OK on success.
*/
int bml_get_dcs_scan_results(BML_CTX ctx, const char *radio_mac,
struct BML_DCS_NEIGHBOR_AP **output_results,
struct BML_NEIGHBOR_AP **output_results,
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

return BML_RET_OP_FAILED;
auto pBML = static_cast<bml_internal *>(ctx);
return pBML->set_dcs_continuous_scan_enable(
network_utils::mac_from_string(std::string(radio_mac)), enable);
}

int bml_get_dcs_continuous_scan_enable(BML_CTX ctx, const char *radio_mac, int *output_enable)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change to int bml_get_dcs_continuous_scan_enable(BML_CTX ctx, const char *radio_mac, int *enable)

Or even better as Vitaly suggested - why not use reference?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the BML I can't use a reference, since I'm not sure how well it will be imported in C
I can change the bml_internal to use a reference instead

@@ -152,6 +152,9 @@ class bml_internal : public beerocks::socket_thread {
int bml_set_vap_list_credentials(const BML_VAP_INFO *vaps, const uint8_t vaps_num);
int bml_get_vap_list_credentials(BML_VAP_INFO *vaps, uint8_t &vaps_num);

//set and get channel scan enable flag
int set_dcs_continuous_scan_enable(const sMacAddr &mac, int enable);
int get_dcs_continuous_scan_enable(const sMacAddr &mac, int *enable);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer int bml_get_dcs_continuous_scan_enable(BML_CTX ctx, const char *radio_mac, int &enable)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the BML cannot use a reference since it's used as a C API
but the bml_internal uses reference

//output_results_size will be set to the number of actual returning results
*output_results_size = 0;
for (auto res : scan_results) {
auto out = &((*output_results)[*output_results_size]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant to pass the output result as a reference.

Change the declaration of translate_channel_scan_results to accept BML_NEIGHBOR_AP &res_out instead of BML_NEIGHBOR_AP *res_out and set auto &out = (*output_results)[*output_results_size];

@@ -67,6 +67,39 @@ static void config_logger(const std::string log_file = std::string())

#endif // BEEROCKS_DEBUG

static void translate_channel_scan_results(const beerocks_message::sChannelScanResults &res_in,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change to static void translate_channel_scan_results(const beerocks_message::sChannelScanResults &res_in, BML_NEIGHBOR_AP &res_out)

Please always use reference whenever possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed

@ghost ghost assigned itayx Jan 22, 2020
@itayx itayx force-pushed the feature/port-dynamic-channel-selection-from-rdkb-flow branch 3 times, most recently from 90d6b81 to 9b0a787 Compare January 22, 2020 17:42
@tomereli tomereli self-requested a review January 22, 2020 17:45
@vitalybu vitalybu self-requested a review January 22, 2020 17:57
@itayx itayx force-pushed the feature/port-dynamic-channel-selection-from-rdkb-flow branch from 9b0a787 to 8036cbe Compare January 22, 2020 20:18
@kantera800 kantera800 force-pushed the feature/port-dynamic-channel-selection-from-rdkb-flow branch from 8036cbe to 2f6ede3 Compare January 23, 2020 07:52
itayx added 13 commits January 23, 2020 11:38
was clearing config::channel_pool instead scan_results

Signed-off-by: itay elenzweig <[email protected]>
Remove the "current state" and "next state" logs
Move the log and compare functions to the cpp file
Add log on fsm_move_state

Signed-off-by: itay elenzweig <[email protected]>
The dynamic channel selection feature uses the NL and dwpal
apis to trigger a neighboring scan and uses the results
received for analytical data.

Open the NL sockets and start listening for events
Process the NL events and add handling stubs

Signed-off-by: itay elenzweig <[email protected]>
The monitor thread receives channel scan events sent from
the wlan hal dwpal and handles them accordingly, by
propagating them to the agent

Add handling for Channel_Scan_Triggered
Add handling for Channel_Scan_New_Results_Ready
Add handling for Channel_Scan_Dump_Result
Add handling for Channel_Scan_Finished
Add handling for Channel_Scan_Abort

Signed-off-by: itay elenzweig <[email protected]>
The agent can request the monitor thread to trigger a
channel scan

Receive the channel scan trigger CMDU
Extract parameters and print descriptive log
Trigger the channel scan with parameters

Signed-off-by: itay elenzweig <[email protected]>
Requests, responses and notifications are propagated from
the agent to the controller and to the dynamic channel
selection task with no alteration to the data within

Create the task and add it to the task list on slave join
Handle channel scan trigger request and response
Handle channel scan triggered notification
Handle channel scan results notification
Handle channel scan finish notification
Handle channel scan abort notification

Signed-off-by: itay elenzweig <[email protected]>
This is a preparative commit for 'son_management: DCS channel scan'.

Add DCS task to includes
Add channel scan BML CMDUs to cases in "handle_bml_message"

Signed-off-by: itay elenzweig <[email protected]>
The son_management's role is to handle incoming bml
requests, which means storing values in the DB,
launching an event to trigger the DCS scan in the task

Handle set/get enable request/response
Handle set/get params request/response
Handle get results request/response
Handle start single scan request/response

Signed-off-by: itay elenzweig <[email protected]>
The DCS channel scan feature is used via the BML APIs.

Ths is a preparative commit for all 'bml: DCS channel scan' commits.

Update the neighboring ap structure to fit new architecture
Add delayed response timeout to be used for results
Add cases to handle BML CMDUs responses
Add doxygen to the bml_internal APIs

Signed-off-by: itay elenzweig <[email protected]>
Get/Set the enable flag for the continuous DCS channel scan

Implement BML functionality
Add bml_internal API
Implement response CMDU handling

Signed-off-by: itay elenzweig <[email protected]>
Get/Set the scan parameters for the continuous DCS channel scan

Implement BML functionality
Add bml_internal API
Add response promise handling
Implement response CMDU handling

Signed-off-by: itay elenzweig <[email protected]>
Start the single (one time) channel scan with parameters

Implement BML functionality
Add bml_internal API
Implement response CMDU handling

Signed-off-by: itay elenzweig <[email protected]>
Get the scan results for both the single and continuous DCS channel scan

Implement BML functionality
Add bml_internal API
Add response promise handling
Implement response CMDU handling
Add translation function from BML struct to CMDU struct

Signed-off-by: itay elenzweig <[email protected]>
@itayx itayx force-pushed the feature/port-dynamic-channel-selection-from-rdkb-flow branch from 2f6ede3 to c51544b Compare January 23, 2020 09:39
@kantera800 kantera800 merged commit db81eec into master Jan 23, 2020
@kantera800 kantera800 deleted the feature/port-dynamic-channel-selection-from-rdkb-flow branch January 23, 2020 11:27
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.

6 participants