Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datastorage/uci/msghandler/ubus: add steering with beacon reports #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions src/include/datastorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ struct probe_metric_s {
int no_vht_support; // eval_probe_metric()()
int rssi; // eval_probe_metric()()
int low_rssi; // eval_probe_metric()()
int rcpi; // eval_probe_metric()()
int low_rcpi; // eval_probe_metric()()
int rsni; // eval_probe_metric()()
int low_rsni; // eval_probe_metric()()
int freq; // eval_probe_metric()()
int chan_util; // eval_probe_metric()()
int max_chan_util; // eval_probe_metric()()
int rssi_val; // eval_probe_metric()()
int low_rssi_val; // eval_probe_metric()()
int rcpi_val; // eval_probe_metric()()
int low_rcpi_val; // eval_probe_metric()()
int rsni_val; // eval_probe_metric()()
int low_rsni_val; // eval_probe_metric()()
int chan_util_val; // eval_probe_metric()()
int max_chan_util_val; // eval_probe_metric()()
int min_probe_count;
Expand Down
17 changes: 15 additions & 2 deletions src/storage/datastorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,21 @@ int eval_probe_metric(struct probe_entry_s* probe_entry, ap* ap_entry) {
// TODO: Should RCPI be used here as well?
// TODO: Should this be more scaled? Should -63dB on current and -77dB on other both score 0 if low / high are -80db and -60dB?
// TODO: That then lets device capabilites dominate score - making them more important than RSSI difference of 14dB.
score += (probe_entry->signal >= dawn_metric.rssi_val) ? dawn_metric.rssi : 0;
score += (probe_entry->signal <= dawn_metric.low_rssi_val) ? dawn_metric.low_rssi : 0;
if (probe_entry->rcpi != -1) // -1 currently magic number
{
score += (probe_entry->rcpi >= dawn_metric.rcpi_val) ? dawn_metric.rcpi : 0;
score += (probe_entry->rcpi <= dawn_metric.low_rcpi_val) ? dawn_metric.low_rcpi : 0;
}
else if(probe_entry->rsni != -1)
{
score += (probe_entry->rsni >= dawn_metric.rsni_val) ? dawn_metric.rsni : 0;
score += (probe_entry->rsni <= dawn_metric.low_rsni_val) ? dawn_metric.low_rsni : 0;
}
else //rssi is just fallback
{
score += (probe_entry->signal >= dawn_metric.rssi_val) ? dawn_metric.rssi : 0;
score += (probe_entry->signal <= dawn_metric.low_rssi_val) ? dawn_metric.low_rssi : 0;
}

// TODO: This magic value never checked by caller. What does it achieve?
if (score < 0)
Expand Down
8 changes: 8 additions & 0 deletions src/utils/dawn_uci.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,23 @@ struct probe_metric_s uci_get_dawn_metric() {
ret.no_ht_support = uci_lookup_option_int(uci_ctx, s, "no_ht_support");
ret.no_vht_support = uci_lookup_option_int(uci_ctx, s, "no_vht_support");
ret.rssi = uci_lookup_option_int(uci_ctx, s, "rssi");
ret.rcpi = uci_lookup_option_int(uci_ctx, s, "rcpi");
ret.rsni = uci_lookup_option_int(uci_ctx, s, "rsni");
ret.freq = uci_lookup_option_int(uci_ctx, s, "freq");
ret.rssi_val = uci_lookup_option_int(uci_ctx, s, "rssi_val");
ret.rcpi_val = uci_lookup_option_int(uci_ctx, s, "rcpi_val");
ret.rsni_val = uci_lookup_option_int(uci_ctx, s, "rsni_val");
ret.chan_util = uci_lookup_option_int(uci_ctx, s, "chan_util");
ret.max_chan_util = uci_lookup_option_int(uci_ctx, s, "max_chan_util");
ret.chan_util_val = uci_lookup_option_int(uci_ctx, s, "chan_util_val");
ret.max_chan_util_val = uci_lookup_option_int(uci_ctx, s, "max_chan_util_val");
ret.min_probe_count = uci_lookup_option_int(uci_ctx, s, "min_probe_count");
ret.low_rssi = uci_lookup_option_int(uci_ctx, s, "low_rssi");
ret.low_rcpi = uci_lookup_option_int(uci_ctx, s, "low_rcpi");
ret.low_rsni = uci_lookup_option_int(uci_ctx, s, "low_rsni");
ret.low_rssi_val = uci_lookup_option_int(uci_ctx, s, "low_rssi_val");
ret.low_rcpi_val = uci_lookup_option_int(uci_ctx, s, "low_rcpi_val");
ret.low_rsni_val = uci_lookup_option_int(uci_ctx, s, "low_rsni_val");
ret.bandwidth_threshold = uci_lookup_option_int(uci_ctx, s, "bandwidth_threshold");
ret.use_station_count = uci_lookup_option_int(uci_ctx, s, "use_station_count");
ret.eval_probe_req = uci_lookup_option_int(uci_ctx, s, "eval_probe_req");
Expand Down
16 changes: 16 additions & 0 deletions src/utils/msghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,19 @@ enum {
UCI_NO_VHT_SUPPORT,
UCI_RSSI,
UCI_LOW_RSSI,
UCI_RCPI,
UCI_LOW_RCPI,
UCI_RSNI,
UCI_LOW_RSNI,
UCI_FREQ,
UCI_CHAN_UTIL,
UCI_MAX_CHAN_UTIL,
UCI_RSSI_VAL,
UCI_LOW_RSSI_VAL,
UCI_RCPI_VAL,
UCI_LOW_RCPI_VAL,
UCI_RSNI_VAL,
UCI_LOW_RSNI_VAL,
UCI_CHAN_UTIL_VAL,
UCI_MAX_CHAN_UTIL_VAL,
UCI_MIN_PROBE_COUNT,
Expand Down Expand Up @@ -632,11 +640,19 @@ static const struct blobmsg_policy uci_metric_policy[__UCI_METIC_MAX] = {
[UCI_NO_VHT_SUPPORT] = {.name = "no_vht_support", .type = BLOBMSG_TYPE_INT32},
[UCI_RSSI] = {.name = "rssi", .type = BLOBMSG_TYPE_INT32},
[UCI_LOW_RSSI] = {.name = "low_rssi", .type = BLOBMSG_TYPE_INT32},
[UCI_RCPI] = {.name = "rcpi", .type = BLOBMSG_TYPE_INT32},
[UCI_LOW_RCPI] = {.name = "low_rcpi", .type = BLOBMSG_TYPE_INT32},
[UCI_RSNI] = {.name = "rsni", .type = BLOBMSG_TYPE_INT32},
[UCI_LOW_RSNI] = {.name = "low_rsni", .type = BLOBMSG_TYPE_INT32},
[UCI_FREQ] = {.name = "freq", .type = BLOBMSG_TYPE_INT32},
[UCI_CHAN_UTIL] = {.name = "chan_util", .type = BLOBMSG_TYPE_INT32},
[UCI_MAX_CHAN_UTIL] = {.name = "max_chan_util", .type = BLOBMSG_TYPE_INT32},
[UCI_RSSI_VAL] = {.name = "rssi_val", .type = BLOBMSG_TYPE_INT32},
[UCI_LOW_RSSI_VAL] = {.name = "low_rssi_val", .type = BLOBMSG_TYPE_INT32},
[UCI_RCPI_VAL] = {.name = "rcpi_val", .type = BLOBMSG_TYPE_INT32},
[UCI_LOW_RCPI_VAL] = {.name = "low_rcpi_val", .type = BLOBMSG_TYPE_INT32},
[UCI_RSNI_VAL] = {.name = "rsni_val", .type = BLOBMSG_TYPE_INT32},
[UCI_LOW_RSNI_VAL] = {.name = "low_rsni_val", .type = BLOBMSG_TYPE_INT32},
[UCI_CHAN_UTIL_VAL] = {.name = "chan_util_val", .type = BLOBMSG_TYPE_INT32},
[UCI_MAX_CHAN_UTIL_VAL] = {.name = "max_chan_util_val", .type = BLOBMSG_TYPE_INT32},
[UCI_MIN_PROBE_COUNT] = {.name = "min_probe_count", .type = BLOBMSG_TYPE_INT32},
Expand Down
8 changes: 8 additions & 0 deletions src/utils/ubus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,13 +1332,21 @@ int uci_send_via_network()
blobmsg_add_u32(&b, "no_vht_support", dawn_metric.no_vht_support);
blobmsg_add_u32(&b, "rssi", dawn_metric.rssi);
blobmsg_add_u32(&b, "low_rssi", dawn_metric.low_rssi);
blobmsg_add_u32(&b, "rcpi", dawn_metric.rcpi);
blobmsg_add_u32(&b, "low_rcpi", dawn_metric.low_rcpi);
blobmsg_add_u32(&b, "rsni", dawn_metric.rsni);
blobmsg_add_u32(&b, "low_rsni", dawn_metric.low_rsni);
blobmsg_add_u32(&b, "freq", dawn_metric.freq);
blobmsg_add_u32(&b, "chan_util", dawn_metric.chan_util);


blobmsg_add_u32(&b, "max_chan_util", dawn_metric.max_chan_util);
blobmsg_add_u32(&b, "rssi_val", dawn_metric.rssi_val);
blobmsg_add_u32(&b, "low_rssi_val", dawn_metric.low_rssi_val);
blobmsg_add_u32(&b, "rcpi_val", dawn_metric.rcpi_val);
blobmsg_add_u32(&b, "low_rcpi_val", dawn_metric.low_rcpi_val);
blobmsg_add_u32(&b, "rsni_val", dawn_metric.rsni_val);
blobmsg_add_u32(&b, "low_rsni_val", dawn_metric.low_rsni_val);
blobmsg_add_u32(&b, "chan_util_val", dawn_metric.chan_util_val);
blobmsg_add_u32(&b, "max_chan_util_val", dawn_metric.max_chan_util_val);
blobmsg_add_u32(&b, "min_probe_count", dawn_metric.min_probe_count);
Expand Down