mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
add ap_weight for an ap
This commit is contained in:
parent
a9d5b1eeee
commit
b6b1ec10cf
5 changed files with 16 additions and 2 deletions
|
@ -26,6 +26,7 @@ config times
|
||||||
option update_chan_util '5'
|
option update_chan_util '5'
|
||||||
|
|
||||||
config metric
|
config metric
|
||||||
|
option ap_weight '0'
|
||||||
option ht_support '0'
|
option ht_support '0'
|
||||||
option vht_support '0'
|
option vht_support '0'
|
||||||
option no_ht_support '0'
|
option no_ht_support '0'
|
||||||
|
|
|
@ -36,6 +36,7 @@ struct probe_metric_s dawn_metric;
|
||||||
|
|
||||||
// ---------------- Structs ----------------
|
// ---------------- Structs ----------------
|
||||||
struct probe_metric_s {
|
struct probe_metric_s {
|
||||||
|
int ap_weight;
|
||||||
int ht_support;
|
int ht_support;
|
||||||
int vht_support;
|
int vht_support;
|
||||||
int no_ht_support;
|
int no_ht_support;
|
||||||
|
@ -198,6 +199,7 @@ typedef struct ap_s {
|
||||||
uint8_t ssid[SSID_MAX_LEN];
|
uint8_t ssid[SSID_MAX_LEN];
|
||||||
uint32_t collision_domain;
|
uint32_t collision_domain;
|
||||||
uint32_t bandwidth;
|
uint32_t bandwidth;
|
||||||
|
uint32_t ap_weight;
|
||||||
} ap;
|
} ap;
|
||||||
|
|
||||||
// ---------------- Defines ----------------
|
// ---------------- Defines ----------------
|
||||||
|
|
|
@ -242,6 +242,8 @@ int eval_probe_metric(struct probe_entry_s probe_entry) {
|
||||||
score += !probe_entry.vht_capabilities && !ap_entry.vht_support ? dawn_metric.no_vht_support : 0;
|
score += !probe_entry.vht_capabilities && !ap_entry.vht_support ? dawn_metric.no_vht_support : 0;
|
||||||
score += ap_entry.channel_utilization <= dawn_metric.chan_util_val ? dawn_metric.chan_util : 0;
|
score += ap_entry.channel_utilization <= dawn_metric.chan_util_val ? dawn_metric.chan_util : 0;
|
||||||
score += ap_entry.channel_utilization > dawn_metric.max_chan_util_val ? dawn_metric.max_chan_util : 0;
|
score += ap_entry.channel_utilization > dawn_metric.max_chan_util_val ? dawn_metric.max_chan_util : 0;
|
||||||
|
|
||||||
|
score += ap_entry.ap_weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
score += (probe_entry.freq > 5000) ? dawn_metric.freq : 0;
|
score += (probe_entry.freq > 5000) ? dawn_metric.freq : 0;
|
||||||
|
|
|
@ -49,6 +49,7 @@ struct probe_metric_s uci_get_dawn_metric() {
|
||||||
struct uci_section *s = uci_to_section(e);
|
struct uci_section *s = uci_to_section(e);
|
||||||
|
|
||||||
if (strcmp(s->type, "metric") == 0) {
|
if (strcmp(s->type, "metric") == 0) {
|
||||||
|
ret.ap_weight = uci_lookup_option_int(uci_ctx, s, "ap_weight");
|
||||||
ret.kicking = uci_lookup_option_int(uci_ctx, s, "kicking");
|
ret.kicking = uci_lookup_option_int(uci_ctx, s, "kicking");
|
||||||
ret.ht_support = uci_lookup_option_int(uci_ctx, s, "ht_support");
|
ret.ht_support = uci_lookup_option_int(uci_ctx, s, "ht_support");
|
||||||
ret.vht_support = uci_lookup_option_int(uci_ctx, s, "vht_support");
|
ret.vht_support = uci_lookup_option_int(uci_ctx, s, "vht_support");
|
||||||
|
|
|
@ -152,6 +152,7 @@ enum {
|
||||||
CLIENT_TABLE_NUM_STA,
|
CLIENT_TABLE_NUM_STA,
|
||||||
CLIENT_TABLE_COL_DOMAIN,
|
CLIENT_TABLE_COL_DOMAIN,
|
||||||
CLIENT_TABLE_BANDWIDTH,
|
CLIENT_TABLE_BANDWIDTH,
|
||||||
|
CLIENT_TABLE_WEIGHT,
|
||||||
__CLIENT_TABLE_MAX,
|
__CLIENT_TABLE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,6 +167,7 @@ static const struct blobmsg_policy client_table_policy[__CLIENT_TABLE_MAX] = {
|
||||||
[CLIENT_TABLE_NUM_STA] = {.name = "num_sta", .type = BLOBMSG_TYPE_INT32},
|
[CLIENT_TABLE_NUM_STA] = {.name = "num_sta", .type = BLOBMSG_TYPE_INT32},
|
||||||
[CLIENT_TABLE_COL_DOMAIN] = {.name = "collision_domain", .type = BLOBMSG_TYPE_INT32},
|
[CLIENT_TABLE_COL_DOMAIN] = {.name = "collision_domain", .type = BLOBMSG_TYPE_INT32},
|
||||||
[CLIENT_TABLE_BANDWIDTH] = {.name = "bandwidth", .type = BLOBMSG_TYPE_INT32},
|
[CLIENT_TABLE_BANDWIDTH] = {.name = "bandwidth", .type = BLOBMSG_TYPE_INT32},
|
||||||
|
[CLIENT_TABLE_WEIGHT] = {.name = "ap_weight", .type = BLOBMSG_TYPE_INT32},
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -825,6 +827,12 @@ int parse_to_clients(struct blob_attr *msg, int do_kick, uint32_t id) {
|
||||||
|
|
||||||
ap_entry.station_count = num_stations;
|
ap_entry.station_count = num_stations;
|
||||||
|
|
||||||
|
if (tb[CLIENT_TABLE_WEIGHT]) {
|
||||||
|
ap_entry.ap_weight = blobmsg_get_u32(tb[CLIENT_TABLE_WEIGHT]);
|
||||||
|
} else {
|
||||||
|
ap_entry.ap_weight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
insert_to_ap_array(ap_entry);
|
insert_to_ap_array(ap_entry);
|
||||||
|
|
||||||
if (do_kick && dawn_metric.kicking) {
|
if (do_kick && dawn_metric.kicking) {
|
||||||
|
@ -868,6 +876,8 @@ static void ubus_get_clients_cb(struct ubus_request *req, int type, struct blob_
|
||||||
blobmsg_add_u8(&b_domain, "ht_supported", entry->ht_support);
|
blobmsg_add_u8(&b_domain, "ht_supported", entry->ht_support);
|
||||||
blobmsg_add_u8(&b_domain, "vht_supported", entry->vht_support);
|
blobmsg_add_u8(&b_domain, "vht_supported", entry->vht_support);
|
||||||
|
|
||||||
|
blobmsg_add_u32(&b_domain, "ap_weight", dawn_metric.ap_weight);
|
||||||
|
|
||||||
//int channel_util = get_channel_utilization(entry->iface_name, &entry->last_channel_time, &entry->last_channel_time_busy);
|
//int channel_util = get_channel_utilization(entry->iface_name, &entry->last_channel_time, &entry->last_channel_time_busy);
|
||||||
blobmsg_add_u32(&b_domain, "channel_utilization", entry->chan_util_average);
|
blobmsg_add_u32(&b_domain, "channel_utilization", entry->chan_util_average);
|
||||||
|
|
||||||
|
@ -878,8 +888,6 @@ static void ubus_get_clients_cb(struct ubus_request *req, int type, struct blob_
|
||||||
print_ap_array();
|
print_ap_array();
|
||||||
|
|
||||||
free(data_str);
|
free(data_str);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ubus_get_clients() {
|
static int ubus_get_clients() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue