From cf0e99ce0768b8870d7e18b247af7e8f31e3eb02 Mon Sep 17 00:00:00 2001 From: Filip Matusiak <filip.matusiak@iopsys.eu> Date: Tue, 25 Apr 2023 16:29:42 +0200 Subject: [PATCH] Steering: lookup classid on each operating radio Signed-off-by: Filip Matusiak <filip.matusiak@iopsys.eu> --- src/cntlr.c | 5 ----- src/cntlr.h | 1 - src/cntlr_map.c | 27 ++++++++++++++++++++------- src/cntlr_ubus.c | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/cntlr.c b/src/cntlr.c index 5eb43456..68369b9c 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 abd21bb6..4c48ee68 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 88a78c04..582217f0 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 f9329ecf..5a9adff9 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; } -- GitLab