diff --git a/files/dawn.config b/files/dawn.config index cec4439..d233448 100644 --- a/files/dawn.config +++ b/files/dawn.config @@ -27,8 +27,10 @@ config settings metric option low_rssi '-500' option freq '100' option chan_util '50' - option max_chan_util '150' + option max_chan_util '-50' option rssi_val '-60' option low_rssi_val '-80' + option chan_util_val '70' + option max_chan_util_val '150' option min_probe_count '2' option bandwith_threshold '6' diff --git a/src/include/datastorage.h b/src/include/datastorage.h index 979063c..c47e2a4 100644 --- a/src/include/datastorage.h +++ b/src/include/datastorage.h @@ -29,6 +29,8 @@ struct probe_metric_s { int max_chan_util; int rssi_val; int low_rssi_val; + int chan_util_val; + int max_chan_util_val; int min_probe_count; int bandwith_threshold; }; diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index a7d8a65..9708e17 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -75,7 +75,8 @@ int eval_probe_metric(struct probe_entry_s probe_entry) { score += !probe_entry.ht_support && !ap_entry.ht ? dawn_metric.no_ht_support : 0; score += probe_entry.vht_support && ap_entry.vht ? dawn_metric.vht_support : 0; score += !probe_entry.vht_support && !ap_entry.vht ? dawn_metric.no_vht_support : 0; - score += ap_entry.channel_utilization <= dawn_metric.max_chan_util ? 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 += (probe_entry.freq > 5000) ? dawn_metric.freq : 0; diff --git a/src/utils/dawn_uci.c b/src/utils/dawn_uci.c index f694084..9ca9938 100644 --- a/src/utils/dawn_uci.c +++ b/src/utils/dawn_uci.c @@ -158,6 +158,23 @@ struct probe_metric_s uci_get_dawn_metric() { if (ptr.o->type == UCI_TYPE_STRING) ret.max_chan_util = atoi(ptr.o->v.string); + char tmp_chan_util_val[] = "dawn.metric.chan_util_val"; + if (uci_lookup_ptr(c, &ptr, tmp_chan_util_val, 1) != UCI_OK) { + uci_perror(c, "uci_get_daw_metric Error"); + return ret; + } + if (ptr.o->type == UCI_TYPE_STRING) + ret.chan_util_val = atoi(ptr.o->v.string); + + + char tmp_max_chan_util_val[] = "dawn.metric.max_chan_util_val"; + if (uci_lookup_ptr(c, &ptr, tmp_max_chan_util_val, 1) != UCI_OK) { + uci_perror(c, "uci_get_daw_metric Error"); + return ret; + } + if (ptr.o->type == UCI_TYPE_STRING) + ret.max_chan_util_val = atoi(ptr.o->v.string); + printf("Try to load min_probe_count\n"); char tmp_min_probe_count[] = "dawn.metric.min_probe_count";