policy: export snr_to_signal to other source files
Export snr_to_signal to other source files. This will be necessary to determine reported signal strengths from beacon-report throughout the code base. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
16
policy.c
16
policy.c
@@ -129,8 +129,8 @@ find_better_candidate(struct sta_info *si_ref, struct uevent *ev, uint32_t requi
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
snr_to_signal(struct usteer_node *node, int snr)
|
usteer_snr_to_signal(struct usteer_node *node, int snr)
|
||||||
{
|
{
|
||||||
int noise = -95;
|
int noise = -95;
|
||||||
|
|
||||||
@@ -161,10 +161,10 @@ usteer_check_request(struct sta_info *si, enum usteer_event_type type)
|
|||||||
*
|
*
|
||||||
* Otherwise, the client potentially ends up in a assoc - kick loop.
|
* Otherwise, the client potentially ends up in a assoc - kick loop.
|
||||||
*/
|
*/
|
||||||
if (config.min_snr && si->signal < snr_to_signal(si->node, config.min_snr)) {
|
if (config.min_snr && si->signal < usteer_snr_to_signal(si->node, config.min_snr)) {
|
||||||
ev.reason = UEV_REASON_LOW_SIGNAL;
|
ev.reason = UEV_REASON_LOW_SIGNAL;
|
||||||
ev.threshold.cur = si->signal;
|
ev.threshold.cur = si->signal;
|
||||||
ev.threshold.ref = snr_to_signal(si->node, config.min_snr);
|
ev.threshold.ref = usteer_snr_to_signal(si->node, config.min_snr);
|
||||||
ret = false;
|
ret = false;
|
||||||
goto out;
|
goto out;
|
||||||
} else if (!config.assoc_steering) {
|
} else if (!config.assoc_steering) {
|
||||||
@@ -172,7 +172,7 @@ usteer_check_request(struct sta_info *si, enum usteer_event_type type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
min_signal = snr_to_signal(si->node, config.min_connect_snr);
|
min_signal = usteer_snr_to_signal(si->node, config.min_connect_snr);
|
||||||
if (si->signal < min_signal) {
|
if (si->signal < min_signal) {
|
||||||
ev.reason = UEV_REASON_LOW_SIGNAL;
|
ev.reason = UEV_REASON_LOW_SIGNAL;
|
||||||
ev.threshold.cur = si->signal;
|
ev.threshold.cur = si->signal;
|
||||||
@@ -265,7 +265,7 @@ usteer_roam_trigger_sm(struct sta_info *si)
|
|||||||
};
|
};
|
||||||
int min_signal;
|
int min_signal;
|
||||||
|
|
||||||
min_signal = snr_to_signal(si->node, config.roam_trigger_snr);
|
min_signal = usteer_snr_to_signal(si->node, config.roam_trigger_snr);
|
||||||
|
|
||||||
switch (si->roam_state) {
|
switch (si->roam_state) {
|
||||||
case ROAM_TRIGGER_SCAN:
|
case ROAM_TRIGGER_SCAN:
|
||||||
@@ -345,7 +345,7 @@ usteer_local_node_roam_check(struct usteer_local_node *ln, struct uevent *ev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
usteer_update_time();
|
usteer_update_time();
|
||||||
min_signal = snr_to_signal(&ln->node, min_signal);
|
min_signal = usteer_snr_to_signal(&ln->node, min_signal);
|
||||||
|
|
||||||
list_for_each_entry(si, &ln->node.sta_info, node_list) {
|
list_for_each_entry(si, &ln->node.sta_info, node_list) {
|
||||||
if (si->connected != STA_CONNECTED || si->signal >= min_signal ||
|
if (si->connected != STA_CONNECTED || si->signal >= min_signal ||
|
||||||
@@ -375,7 +375,7 @@ usteer_local_node_snr_kick(struct usteer_local_node *ln)
|
|||||||
if (!config.min_snr)
|
if (!config.min_snr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
min_signal = snr_to_signal(&ln->node, config.min_snr);
|
min_signal = usteer_snr_to_signal(&ln->node, config.min_snr);
|
||||||
ev.threshold.ref = min_signal;
|
ev.threshold.ref = min_signal;
|
||||||
|
|
||||||
list_for_each_entry(si, &ln->node.sta_info, node_list) {
|
list_for_each_entry(si, &ln->node.sta_info, node_list) {
|
||||||
|
2
usteer.h
2
usteer.h
@@ -262,6 +262,8 @@ void usteer_init_defaults(void);
|
|||||||
bool usteer_handle_sta_event(struct usteer_node *node, const uint8_t *addr,
|
bool usteer_handle_sta_event(struct usteer_node *node, const uint8_t *addr,
|
||||||
enum usteer_event_type type, int freq, int signal);
|
enum usteer_event_type type, int freq, int signal);
|
||||||
|
|
||||||
|
int usteer_snr_to_signal(struct usteer_node *node, int snr);
|
||||||
|
|
||||||
void usteer_local_nodes_init(struct ubus_context *ctx);
|
void usteer_local_nodes_init(struct ubus_context *ctx);
|
||||||
void usteer_local_node_kick(struct usteer_local_node *ln);
|
void usteer_local_node_kick(struct usteer_local_node *ln);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user