-
Notifications
You must be signed in to change notification settings - Fork 32
[DCS Patch 2/5] port dynamic channel selection from rdkb infrastructure #643
[DCS Patch 2/5] port dynamic channel selection from rdkb infrastructure #643
Conversation
fd4c6ed
to
894b852
Compare
894b852
to
81c8bd4
Compare
common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_action.h
Show resolved
Hide resolved
common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_bml.yaml
Outdated
Show resolved
Hide resolved
const bool single_scan) | ||
{ | ||
auto n = get_node(mac); | ||
static std::list<sChannelScanResultsElement> dummy_return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this one is super ugly.
I prefer return std::list<sChannelScanResultsElement>();
instead everywhere.
Or you can return a shared_ptr instead of const reference and return nullptr instead of dummy_return.
Anything BUT dummy_return
👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return {}
can work as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried that, when I do I get an error saying:
error: returning reference to temporary [-Werror=return-local-addr]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you can return a shared_ptr instead of const reference and return nullptr instead of dummy_return.
This will be the only thing that works. But it's super-annoying, because it means the caller has to check for nullptr everywhere while it could just work with the empty set without problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you can return a shared_ptr instead of const reference and return nullptr instead of dummy_return.
This will be the only thing that works. But it's super-annoying, because it means the caller has to check for nullptr everywhere while it could just work with the empty set without problem.
So you think the dummy_return
should stay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now it stays, if we decide to fix this later on we'll decide in #665
// Channel Scan | ||
// | ||
bool set_channel_scan_is_enabled(const std::string &mac, const bool enable); | ||
bool get_channel_scan_is_enabled(const std::string &mac); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and in any other method which doesn't change the state of the class, declare the function as const:
bool get_channel_scan_is_enabled(const std::string &mac) const;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also - the name is really long and for no reason. I prefer channel_scan_enabled(const std::string &mac)
(nitpick)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it will be
channel_scan_enabled(const std::string &mac) const; //get
channel_scan_enabled(const std::string &mac, const bool enable); //set
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are far more important things to fix in this PR. So let's keep it for #665
common/beerocks/tlvf/AutoGenerated/include/beerocks/tlvf/beerocks_message_common.h
Show resolved
Hide resolved
common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_action.yaml
Outdated
Show resolved
Hide resolved
common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_action.yaml
Outdated
Show resolved
Hide resolved
const bool single_scan) | ||
{ | ||
auto n = get_node(mac); | ||
static std::list<sChannelScanResultsElement> dummy_return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return {}
can work as well
common/beerocks/tlvf/yaml/beerocks/tlvf/beerocks_message_common.yaml
Outdated
Show resolved
Hide resolved
auto n = get_node(mac); | ||
if (!n) { | ||
LOG(ERROR) << "node not found.... "; | ||
return *(std::make_shared<std::set<uint8_t>>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? AFAICS this has the same problem as return std::set<uint8_t>();
only the compiler doesn't complain about it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically creating a shared_ptr, then instead of returning the shared_ptr itself which would increment the reference count preventing the memory from being released, we return the contents and when we return they are invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a dummy_return, if we decide that using a dummy_return is incorrect we'll fix it in #665
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small comment
81c8bd4
to
7736ee5
Compare
ready for re-review:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase-squash and I'll do the followup review.
@morantr please review after the rebase.
5a2ee50
to
9202cba
Compare
1e47869
to
c971631
Compare
b574c68
to
6a5042e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comments - but please fix them before merging. Especially everything related to the string to mac and mac to string conversions.
@@ -443,6 +447,30 @@ enum eBssType { | |||
BSS_TYPE_INVALID | |||
}; | |||
|
|||
enum class eChannelScanErrCode : uint8_t { | |||
CHANNEL_SCAN_SUCCESS = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its an enum class - no need for the CHANNEL_SCAN_
prefix. #665
}; | ||
|
||
enum class eChannelScanOpErrCode : uint8_t { | ||
CHANNEL_SCAN_OP_SUCCESS = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d5defe5
to
43c37fc
Compare
This is a preperative commit for 'Add channel scan structures'. Add enums to support the DCS feature. Add eChannelScanErrCode that describes the scan operation status. Add eDcsOpErrCode that describes the API's operation status. Signed-off-by: itay elenzweig <[email protected]>
This is a preperative commit for 'Add channel scan & DCS CMDUs'. Add DCS structures to support the DCS feature [yaml only]. Signed-off-by: itay elenzweig <[email protected]>
This is a preperative commit for 'Add channel scan & DCS CMDUs'. Add DCS structures to support the DCS feature [AutoGenerated]. Signed-off-by: itay elenzweig <[email protected]>
Add requests from the bml to the controller [YAML]. Add requests from the controller to the agent [YAML]. Add notifications from the agent to the controller [YAML]. Add requests from the agent to the monitor [YAML]. Add notifications from the monitor to the agent [YAML]. Signed-off-by: itay elenzweig <[email protected]>
Add requests from the bml to the controller [AutoGenerated]. Add requests from the controller to the agent [AutoGenerated]. Add notifications from the agent to the controller [AutoGenerated]. Add requests from the agent to the monitor [AutoGenerated]. Add notifications from the monitor to the agent [AutoGenerated]. Signed-off-by: itay elenzweig <[email protected]>
This is a preperative commit for 'Add channel scan DB methods'. Add the result class & container, which is used to store the DCS scan results returned from the monitor/agent. Add DCS configutation class for the DCS feature. Add DCS scan status class, which is used to store the latest DCS scan results status. Signed-off-by: itay elenzweig <[email protected]>
Add DB method get_hostap_by_mac Add DB methods to get/set scan params (configutation). Add DB methods to get/set scan status. Add DB methods to get/set scan results. Add DB methods to clear channel pool. Add DB methods to check if a channel is in the current channel scan's pool. Signed-off-by: itay elenzweig <[email protected]>
43c37fc
to
cd6b49c
Compare
The Dynamic Channel Selection feature is divided into several pull request, this is the second out of 5
start review from 9db41a9
High Level Infastructure (Controller & yaml): Support for Channel Scan & DCS:
Changes in this PR include the following: