From f17bfe6eec9ee5d23d7b4f1db458e8931487e183 Mon Sep 17 00:00:00 2001 From: Filip Matusiak <filip.matusiak@iopsys.eu> Date: Fri, 13 Dec 2024 15:48:45 +0100 Subject: [PATCH] steer: fix steer metrics trigger Signed-off-by: Filip Matusiak <filip.matusiak@iopsys.eu> --- src/cntlr_map.c | 149 +++++++++++++++++++++++++----------------------- 1 file changed, 77 insertions(+), 72 deletions(-) diff --git a/src/cntlr_map.c b/src/cntlr_map.c index d725a14a..7173c1f2 100644 --- a/src/cntlr_map.c +++ b/src/cntlr_map.c @@ -2576,6 +2576,82 @@ static void cntlr_get_bcn_metrics(struct controller *c, struct sta *s, bool matc timer_set(&s->bcn_metrics_timer, s->bcn_report_wait_time * 1000); } +static int cntrl_check_steer_metrics(struct controller *c, struct sta *s) +{ + struct steer_control_config *scc; + struct netif_radio *r; + struct radio_policy *rp; + + r = find_radio_by_bssid(c, s->bssid); + if (!r) + return -1; + + rp = cntlr_get_radio_policy(&c->cfg, r->radio_el->macaddr); + if (!rp) + return -1; + + scc = get_steer_control_config(c); + if (!scc) + return -1; + + if (s->type == IEEE1905 && + s->de_sta->rcpi < rp->report_rcpi_threshold) { + if (!scc->enable_bsta_steer) { + dbg("|%s:%d| rcpi below %d, but will not query for any " \ + "metrics as 'enable_bsta_steer' is not set!\n", + __func__, __LINE__, rp->rcpi_threshold); + return 0; + } + + /* Get bcn metrics for bsta */ + if (scc->use_bcn_metrics) { + dbg("|%s:%d| request bcn metrics from bsta\n", + __func__, __LINE__); + cntlr_mark_bcnlist_stale(c, s); + cntlr_request_bcn_metrics_bsta(c, s); + /* TODO: set timeout here (?) */ + } + } else if (s->type == NON_IEEE1905 && + s->de_sta->rcpi < rp->report_rcpi_threshold) { + + if (!scc->enable_sta_steer) { + dbg("|%s:%d| rcpi below %d, but will not query for any " \ + "metrics as 'enable_sta_steer' is not set!\n", + __func__, __LINE__, rp->rcpi_threshold); + return 0; + } + + /* Get bcn metrics */ + if (scc->use_bcn_metrics) { + /* check that if only one agent and bandsteer disabled + * then dont send request for bcn metrics + */ + if (c->num_nodes > 1 || scc->bandsteer) + cntlr_get_bcn_metrics(c, s, !scc->bandsteer); + } + + /* Get usta metrics for each agent in mesh */ + if (scc->use_usta_metrics) { + struct node *no = NULL; + + dbg("|%s:%d| request usta metrics from sta\n", + __func__, __LINE__); + free_usta_metrics(c, s); + list_for_each_entry(no, &c->nodelist, list) { + cntlr_request_usta_metrics(c, no, s); + } + } + } else if (s->type == NON_IEEE1905 && + s->de_sta->rcpi >= rp->report_rcpi_threshold) { + if (scc->use_bcn_metrics && timer_pending(&s->bcn_metrics_timer)) { + cntlr_mark_bcnlist_stale(c, s); + timer_del(&s->bcn_metrics_timer); + } + } + + return 0; +} + int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu, struct node *n) { @@ -2603,13 +2679,6 @@ int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu, uint8_t *tv_data = (uint8_t *)tv[0][0]->data; struct tlv_assoc_sta_link_metrics *p = (struct tlv_assoc_sta_link_metrics *)tv_data; - struct netif_radio *r; - struct radio_policy *rp; - struct steer_control_config *scc; - - scc = get_steer_control_config(c); - if (!scc) - return -1; s = cntlr_find_sta(c, p->macaddr); if (!s) @@ -2638,71 +2707,7 @@ int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu, offset += sizeof(*b); } - r = find_radio_by_bssid(c, s->bssid); - if (!r) - return -1; - - rp = cntlr_get_radio_policy(&c->cfg, r->radio_el->macaddr); - if (!rp) - return -1; - - if (s->type == IEEE1905 && - s->de_sta->rcpi < rp->report_rcpi_threshold) { - - if (!scc->enable_bsta_steer) { - dbg("|%s:%d| rcpi below %d, but will not query for any " \ - "metrics as 'enable_bsta_steer' is not set!\n", - __func__, __LINE__, rp->rcpi_threshold); - return 0; - } - - /* Get bcn metrics for bsta */ - if (scc->use_bcn_metrics) { - dbg("|%s:%d| request bcn metrics from bsta\n", - __func__, __LINE__); - cntlr_mark_bcnlist_stale(c, s); - cntlr_request_bcn_metrics_bsta(c, s); - /* TODO: set timeout here (?) */ - } - - } else if (s->type == NON_IEEE1905 && - s->de_sta->rcpi < rp->report_rcpi_threshold) { - - if (!scc->enable_sta_steer) { - dbg("|%s:%d| rcpi below %d, but will not query for any " \ - "metrics as 'enable_sta_steer' is not set!\n", - __func__, __LINE__, rp->rcpi_threshold); - return 0; - } - - - /* Get bcn metrics */ - if (scc->use_bcn_metrics) { - /* check that if only one agent and bandsteer disabled - * then dont send request for bcn metrics - */ - if (c->num_nodes > 1 || scc->bandsteer) - cntlr_get_bcn_metrics(c, s, !scc->bandsteer); - } - - /* Get usta metrics for each agent in mesh */ - if (scc->use_usta_metrics) { - struct node *no = NULL; - - dbg("|%s:%d| request usta metrics from sta\n", - __func__, __LINE__); - free_usta_metrics(c, s); - list_for_each_entry(no, &c->nodelist, list) { - cntlr_request_usta_metrics(c, no, s); - } - } - } else if (s->type == NON_IEEE1905 && - s->de_sta->rcpi >= rp->report_rcpi_threshold) { - if (scc->use_bcn_metrics && timer_pending(&s->bcn_metrics_timer)) { - cntlr_mark_bcnlist_stale(c, s); - timer_del(&s->bcn_metrics_timer); - } - } + cntrl_check_steer_metrics(c, s); } idx = 0; -- GitLab