From 209ffb0bb4932e29e3d4d05f515b71985491abce Mon Sep 17 00:00:00 2001 From: Filip Matusiak <filip.matusiak@iopsys.eu> Date: Thu, 18 May 2023 17:00:11 +0200 Subject: [PATCH] Prepare channel list promptly prior to sending bcn request Signed-off-by: Filip Matusiak <filip.matusiak@iopsys.eu> --- src/cntlr.h | 1 - src/cntlr_map.c | 43 +++++++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/cntlr.h b/src/cntlr.h index c8881786..5d5419a3 100644 --- a/src/cntlr.h +++ b/src/cntlr.h @@ -398,7 +398,6 @@ struct controller { struct hlist_head *as_table; /** active sta hash table */ struct controller_config cfg; struct cmdu_ackq cmdu_ack_q; - struct steering steer_params; /* Autoconfig */ uint16_t mid_5g; diff --git a/src/cntlr_map.c b/src/cntlr_map.c index 7137b74d..90a1d678 100644 --- a/src/cntlr_map.c +++ b/src/cntlr_map.c @@ -66,20 +66,19 @@ int handle_topology_notification(void *cntlr, struct cmdu_buff *cmdu) return 0; } -static void _cntlr_update_steer_params(struct controller *c, struct opclass *op) +static void _cntlr_get_steer_params(struct opclass *op, struct steering *sp) { int i, j, k; bool found; struct opclass_entry *oe; - struct steering *sp; for (i = 0; i < op->opclass_entry_num; i++) { oe = &op->opclass_entry[i]; for (j = 0; j < oe->channels_num; j++) { - sp = &c->steer_params; found = false; for (k = 0; k < sp->channels_num; k++) { if(sp->channels[k] == oe->channels[j].channel) { + /* channel already enlisted */ found = true; break; } @@ -97,7 +96,8 @@ static void _cntlr_update_steer_params(struct controller *c, struct opclass *op) } } -static void cntlr_update_steer_params(struct controller *c, struct sta *s) +static void cntlr_get_steer_params(struct controller *c, struct sta *s, + struct steering *sp) { struct netif_iface *p = NULL; /* fh anf bk iface */ struct netif_radio *r = NULL; @@ -108,7 +108,7 @@ static void cntlr_update_steer_params(struct controller *c, struct sta *s) list_for_each_entry(p, &r->iflist, list) { if (p->ssid && s->fh && s->fh->ssid && !memcmp(p->ssid, s->fh->ssid, 33)) - _cntlr_update_steer_params(c, &r->cur_opclass); + _cntlr_get_steer_params(&r->cur_opclass, sp); } } } @@ -320,9 +320,6 @@ int handle_topology_response(void *cntlr, struct cmdu_buff *cmdu) //s->failed_steer_attempts = 0; //timestamp_reset(s->stats.last_steer_time); } - - /* Get STA data for steering and beacon requests */ - cntlr_update_steer_params(c, s); } } } @@ -1311,12 +1308,14 @@ static uint8_t cntlr_get_classid_ht20(struct controller *c, uint8_t channel) #define STA_CHANNEL_REPORT_MAX_NUM 32 static int cntlr_request_bcn_metrics_sta(struct controller *c, struct sta *s) { + trace("%s: --->\n", __func__); + struct cmdu_buff *bcn_cmdu; uint8_t wildcard[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; uint8_t opclass = 0; uint8_t channel = 0; struct sta_channel_report *reports = NULL; - struct steering *sp; + struct steering sp = {}; uint8_t num_report = 0; struct { uint8_t opclass; @@ -1325,31 +1324,31 @@ static int cntlr_request_bcn_metrics_sta(struct controller *c, struct sta *s) uint8_t opc; int i; - trace("%s: --->\n", __func__); - - sp = &c->steer_params; + cntlr_get_steer_params(c, s, &sp); - dbg("|%s:%d| channels_num = %d\n", __func__, __LINE__, sp->channels_num); + dbg("|%s:%d| Number of measured channels = %d\n", + __func__, __LINE__, sp.channels_num); - if (sp->channels_num < 1) + if (sp.channels_num < 1) return -1; - if (sp->channels_num == 1) { - /* won't use channel report */ - opclass = cntlr_get_classid_ht20(c, sp->channels[0]); /* /20 */ + if (sp.channels_num == 1) { + /* use one channel/opclass pair directly */ + opclass = cntlr_get_classid_ht20(c, sp.channels[0]); /* /20 */ if (!opclass) return -1; - channel = sp->channels[0]; + channel = sp.channels[0]; num_report = 0; } else { + /* use channel report - list of opc/ch pairs */ opclass = 0; - channel = 255; /* use channel report */ - for (i = 0; i < sp->channels_num; i++) { - opc = cntlr_get_classid_ht20(c, sp->channels[i]); + channel = 255; + for (i = 0; i < sp.channels_num; i++) { + opc = cntlr_get_classid_ht20(c, sp.channels[i]); if (!opc) continue; op_ch[num_report].opclass = opc; - op_ch[num_report].channel = sp->channels[i]; + op_ch[num_report].channel = sp.channels[i]; num_report++; if (num_report > STA_CHANNEL_REPORT_MAX_NUM) { -- GitLab