diff --git a/src/cntlr.c b/src/cntlr.c index 5eb434562e72a6d0b340d6eba9643ebfffdfdf61..68369b9cea4cee3a42f244c8aba95a99cb9230a8 100644 --- a/src/cntlr.c +++ b/src/cntlr.c @@ -1006,11 +1006,6 @@ struct netif_radio *cntlr_node_add_radio(struct controller *c, struct node *n, return r; } -uint8_t cntlr_get_classid_ht20(struct wifi_radio_element *radio, uint8_t channel) -{ - return wifi_opclass_get_id(&radio->pref_opclass, channel, 20); -} - void cntlr_radio_pref_opclass_reset(struct wifi_radio_element *radio) { /* diff --git a/src/cntlr.h b/src/cntlr.h index abd21bb62947a3ea20bac2a14c009dd34b530f07..4c48ee688a6dc5b5f08363332bf55c0694799385 100644 --- a/src/cntlr.h +++ b/src/cntlr.h @@ -408,7 +408,6 @@ void free_bcn_metrics(struct controller *c, struct sta *s); void cntlr_mark_old_bcn_metrics(struct controller *c, struct sta *s); void free_usta_metrics(struct controller *c, struct sta *s); -uint8_t cntlr_get_classid_ht20(struct wifi_radio_element *radio, uint8_t channel); int cntlr_radio_pref_opclass_add(struct wifi_radio_element *radio, uint8_t opclass, uint8_t channel, uint8_t preference); void cntlr_radio_pref_opclass_reset(struct wifi_radio_element *radio); diff --git a/src/cntlr_map.c b/src/cntlr_map.c index 88a78c0499ca512ceb04ff20166167086c85f001..582217f0e8183c508915209176fd59db644f00af 100644 --- a/src/cntlr_map.c +++ b/src/cntlr_map.c @@ -1916,6 +1916,24 @@ static void cntlr_request_bcn_metrics_bsta(struct controller *c, struct sta *s) } } +static uint8_t cntlr_get_classid_ht20(struct controller *c, uint8_t channel) +{ + struct node *n = NULL; + struct netif_radio *r = NULL; + uint8_t id; + + list_for_each_entry(n, &c->nodelist, list) { + list_for_each_entry(r, &n->radiolist, list) { + id = wifi_opclass_get_id(&r->radio_el->pref_opclass, + channel, 20); + if (id) + return id; + } + } + + return 0; /* Not found */ +} + static int cntlr_request_bcn_metrics_sta(struct controller *c, struct sta *s) { struct cmdu_buff *bcn_cmdu; @@ -1923,7 +1941,6 @@ static int cntlr_request_bcn_metrics_sta(struct controller *c, struct sta *s) uint8_t opclass = 0; uint8_t channel = 0; struct sta_channel_report *reports = NULL; - struct netif_radio *nr; struct steering *sp; uint8_t num_report = 0; struct { @@ -1935,10 +1952,6 @@ static int cntlr_request_bcn_metrics_sta(struct controller *c, struct sta *s) trace("%s: --->\n", __func__); - nr = find_radio_by_bssid(c, s->bssid); - if (!nr) - return -1; - sp = &c->steer_params; dbg("|%s:%d| channels_num = %d\n", __func__, __LINE__, sp->channels_num); @@ -1948,7 +1961,7 @@ static int cntlr_request_bcn_metrics_sta(struct controller *c, struct sta *s) if (sp->channels_num == 1) { /* won't use channel report */ - opclass = cntlr_get_classid_ht20(nr->radio_el, sp->channels[0]); /* /20 */ + opclass = cntlr_get_classid_ht20(c, sp->channels[0]); /* /20 */ if (!opclass) return -1; channel = sp->channels[0]; @@ -1957,7 +1970,7 @@ static int cntlr_request_bcn_metrics_sta(struct controller *c, struct sta *s) opclass = 0; channel = 255; /* use channel report */ for (i = 0; i < sp->channels_num; i++) { - opc = cntlr_get_classid_ht20(nr->radio_el, sp->channels[i]); + opc = cntlr_get_classid_ht20(c, sp->channels[i]); if (!opc) continue; op_ch[num_report].opclass = opc; diff --git a/src/cntlr_ubus.c b/src/cntlr_ubus.c index f9329ecfff43fb52f3243c744d62b954b1c2f72f..5a9adff93da3e84b260d3c9d47c9100824261bb7 100644 --- a/src/cntlr_ubus.c +++ b/src/cntlr_ubus.c @@ -2398,7 +2398,7 @@ static int cntlr_scan(struct ubus_context *ctx, struct ubus_object *obj, return UBUS_STATUS_UNKNOWN_ERROR; } - classid = cntlr_get_classid_ht20(r->radio_el, ch); + classid = wifi_opclass_get_id(&r->radio_el->pref_opclass, ch, 20); /* one classid per radio */ scan_req_data.radios[k].opclasses[0].classid = classid; }