Skip to content
Snippets Groups Projects
Commit 6d4db686 authored by Anjan Chanda's avatar Anjan Chanda
Browse files

steer: defer informing steer plugins of the received responses

parent ccdef96e
No related branches found
No related tags found
No related merge requests found
Pipeline #202707 passed
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "utils/utils.h" #include "utils/utils.h"
#include "wifi_dataelements.h" #include "wifi_dataelements.h"
#include "wifi_opclass.h" #include "wifi_opclass.h"
#include "steer.h"
#define map_plugin "ieee1905.map" #define map_plugin "ieee1905.map"
...@@ -1471,6 +1472,26 @@ static void cntlr_dfs_cleanup_run(atimer_t *t) ...@@ -1471,6 +1472,26 @@ static void cntlr_dfs_cleanup_run(atimer_t *t)
timer_set(&c->dfs_cleanup, c->cfg.dfs_cleanup_timeout * 1000); timer_set(&c->dfs_cleanup, c->cfg.dfs_cleanup_timeout * 1000);
} }
static void cntlr_steer_sched_run(atimer_t *t)
{
struct controller *c = container_of(t, struct controller, steer_sched_timer);
int i;
cntlr_dbg(LOG_STEER, "%s: --->\n", __func__);
for (i = 0; i < c->inform_sta_num; i++) {
struct sta *s = cntlr_find_sta(c->sta_table, &c->inform_stalist[i * 6]);
if (!s)
continue;
if (c->cfg.steer.enable_sta_steer && !s->is_bsta)
cntlr_inform_steer_modules(c, s, c->inform_cmdu_type);
else if (c->cfg.steer.enable_bsta_steer && s->is_bsta)
cntlr_inform_bsteer_modules(c, s, c->inform_cmdu_type);
}
}
static void cntlr_start(atimer_t *t) static void cntlr_start(atimer_t *t)
{ {
struct controller *c = container_of(t, struct controller, start_timer); struct controller *c = container_of(t, struct controller, start_timer);
...@@ -1859,6 +1880,7 @@ void run_controller(void *opts) ...@@ -1859,6 +1880,7 @@ void run_controller(void *opts)
timer_init(&c->query_nodes, cntlr_query_nodes); timer_init(&c->query_nodes, cntlr_query_nodes);
timer_init(&c->acs, cntlr_acs_run); timer_init(&c->acs, cntlr_acs_run);
timer_init(&c->dfs_cleanup, cntlr_dfs_cleanup_run); timer_init(&c->dfs_cleanup, cntlr_dfs_cleanup_run);
timer_init(&c->steer_sched_timer, cntlr_steer_sched_run);
timer_set(&c->heartbeat, 1 * 1000); timer_set(&c->heartbeat, 1 * 1000);
timer_set(&c->start_timer, waitext ? 5 * 1000 : 0); timer_set(&c->start_timer, waitext ? 5 * 1000 : 0);
... ...
......
...@@ -326,6 +326,12 @@ struct controller { ...@@ -326,6 +326,12 @@ struct controller {
void *subscriber; void *subscriber;
bool subscribed; bool subscribed;
#define INFORM_STA_MAXNUM 64
atimer_t steer_sched_timer;
uint16_t inform_cmdu_type;
uint32_t inform_sta_num;
uint8_t inform_stalist[INFORM_STA_MAXNUM * 6];
struct list_head sclist; /* struct steer_control list */ struct list_head sclist; /* struct steer_control list */
#if (EASYMESH_VERSION > 2) #if (EASYMESH_VERSION > 2)
... ...
......
...@@ -292,10 +292,11 @@ inform_steer_plugins: ...@@ -292,10 +292,11 @@ inform_steer_plugins:
if (s) { if (s) {
cntlr_update_sta_steer_data(c, s); cntlr_update_sta_steer_data(c, s);
if (c->cfg.steer.enable_sta_steer && !s->is_bsta) c->inform_cmdu_type = CMDU_TYPE_TOPOLOGY_NOTIFICATION;
cntlr_inform_steer_modules(c, s, CMDU_TYPE_TOPOLOGY_NOTIFICATION); c->inform_sta_num = 1;
else if (c->cfg.steer.enable_bsta_steer && s->is_bsta) memset(c->inform_stalist, 0, sizeof(c->inform_stalist));
cntlr_inform_bsteer_modules(c, s, CMDU_TYPE_TOPOLOGY_NOTIFICATION); memcpy(c->inform_stalist, s->macaddr, 6);
timer_set(&c->steer_sched_timer, 0);
} }
return 0; return 0;
...@@ -2458,8 +2459,7 @@ int handle_link_metrics_response(struct controller *c, struct cmdu_buff *cmdu, ...@@ -2458,8 +2459,7 @@ int handle_link_metrics_response(struct controller *c, struct cmdu_buff *cmdu,
int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu, int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu,
struct node *n) struct node *n)
{ {
#define INFORM_STA_MAXNUM 64 uint8_t inform_stalist[INFORM_STA_MAXNUM * 6] = {0};
struct sta *inform_stalist[INFORM_STA_MAXNUM] = {0};
struct controller *c = (struct controller *)cntlr; struct controller *c = (struct controller *)cntlr;
struct tlv *tv[ASSOC_STA_LINK_METRICS_RESP_NUM_OF_TLV_TYPES][TLV_MAXNUM] = { 0 }; struct tlv *tv[ASSOC_STA_LINK_METRICS_RESP_NUM_OF_TLV_TYPES][TLV_MAXNUM] = { 0 };
int offset = 0; int offset = 0;
...@@ -2521,7 +2521,7 @@ int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu, ...@@ -2521,7 +2521,7 @@ int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu,
} }
if (iidx < INFORM_STA_MAXNUM - 1) if (iidx < INFORM_STA_MAXNUM - 1)
inform_stalist[iidx++] = s; memcpy(&inform_stalist[6 * iidx++], s->de_sta->macaddr, 6);
} }
idx = 0; idx = 0;
...@@ -2574,16 +2574,12 @@ int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu, ...@@ -2574,16 +2574,12 @@ int handle_sta_link_metrics_response(void *cntlr, struct cmdu_buff *cmdu,
* *
* For now, inform steer plugins about the STAs. * For now, inform steer plugins about the STAs.
*/ */
for (i = 0; i < iidx; i++) { c->inform_cmdu_type = CMDU_ASSOC_STA_LINK_METRICS_RESPONSE;
struct sta *s = inform_stalist[i]; c->inform_sta_num = iidx;
memset(c->inform_stalist, 0, sizeof(c->inform_stalist));
memcpy(c->inform_stalist, inform_stalist, iidx * 6);
sta_link_metrics_process(s); timer_set(&c->steer_sched_timer, 0);
if (c->cfg.steer.enable_sta_steer && !s->is_bsta)
cntlr_inform_steer_modules(c, s, CMDU_ASSOC_STA_LINK_METRICS_RESPONSE);
else if (c->cfg.steer.enable_bsta_steer && s->is_bsta)
cntlr_inform_bsteer_modules(c, s, CMDU_ASSOC_STA_LINK_METRICS_RESPONSE);
}
return 0; return 0;
} }
...@@ -2610,8 +2606,7 @@ int handle_unassoc_sta_link_metrics_response(void *cntlr, ...@@ -2610,8 +2606,7 @@ int handle_unassoc_sta_link_metrics_response(void *cntlr,
struct cmdu_buff *cmdu, struct cmdu_buff *cmdu,
struct node *n) struct node *n)
{ {
#define INFORM_STA_MAXNUM 64 uint8_t inform_stalist[INFORM_STA_MAXNUM * 6] = {0};
struct sta *inform_stalist[INFORM_STA_MAXNUM] = {0};
struct controller *c = (struct controller *) cntlr; struct controller *c = (struct controller *) cntlr;
struct tlv *tv[UNASTA_LINK_METRICS_RESP_NUM_OF_TLV_TYPES][TLV_MAXNUM] = {0}; struct tlv *tv[UNASTA_LINK_METRICS_RESP_NUM_OF_TLV_TYPES][TLV_MAXNUM] = {0};
int iidx = 0; int iidx = 0;
...@@ -2706,20 +2701,19 @@ int handle_unassoc_sta_link_metrics_response(void *cntlr, ...@@ -2706,20 +2701,19 @@ int handle_unassoc_sta_link_metrics_response(void *cntlr,
u->ul_rcpi); u->ul_rcpi);
if (iidx < INFORM_STA_MAXNUM - 1) if (iidx < INFORM_STA_MAXNUM - 1)
inform_stalist[iidx++] = s; memcpy(&inform_stalist[6 * iidx++], s->de_sta->macaddr, 6);
offset += sizeof(*b); offset += sizeof(*b);
} }
} }
for (i = 0; i < iidx; i++) { /* inform steer plugins of the responses */
struct sta *s = inform_stalist[i]; c->inform_cmdu_type = CMDU_UNASSOC_STA_LINK_METRIC_RESPONSE;
c->inform_sta_num = iidx;
memset(c->inform_stalist, 0, sizeof(c->inform_stalist));
memcpy(c->inform_stalist, inform_stalist, iidx * 6);
if (!s->is_bsta) timer_set(&c->steer_sched_timer, 0);
cntlr_inform_steer_modules(c, s, CMDU_UNASSOC_STA_LINK_METRIC_RESPONSE);
else
cntlr_inform_bsteer_modules(c, s, CMDU_UNASSOC_STA_LINK_METRIC_RESPONSE);
}
return 0; return 0;
} }
...@@ -2845,10 +2839,13 @@ int handle_beacon_metrics_response(void *cntlr, struct cmdu_buff *cmdu, ...@@ -2845,10 +2839,13 @@ int handle_beacon_metrics_response(void *cntlr, struct cmdu_buff *cmdu,
ppos = ppos + elem->tag_length + 2; ppos = ppos + elem->tag_length + 2;
} }
if (!s->is_bsta) /* inform steer plugins of the responses */
cntlr_inform_steer_modules(c, s, CMDU_BEACON_METRICS_RESPONSE); c->inform_cmdu_type = CMDU_BEACON_METRICS_RESPONSE;
else c->inform_sta_num = 1;
cntlr_inform_bsteer_modules(c, s, CMDU_BEACON_METRICS_RESPONSE); memset(c->inform_stalist, 0, sizeof(c->inform_stalist));
memcpy(c->inform_stalist, s->de_sta->macaddr, 6);
timer_set(&c->steer_sched_timer, 0);
//ret = cntlr_notify_plugins(c, cmdu); //ret = cntlr_notify_plugins(c, cmdu);
...@@ -2936,10 +2933,12 @@ int handle_sta_steer_btm_report(void *cntlr, struct cmdu_buff *cmdu, ...@@ -2936,10 +2933,12 @@ int handle_sta_steer_btm_report(void *cntlr, struct cmdu_buff *cmdu,
} }
/* Inform steering plugins */ /* Inform steering plugins */
if (c->cfg.steer.enable_sta_steer && !s->is_bsta) c->inform_cmdu_type = CMDU_CLIENT_STEERING_BTM_REPORT;
cntlr_inform_steer_modules(c, s, CMDU_CLIENT_STEERING_BTM_REPORT); c->inform_sta_num = 1;
else if (c->cfg.steer.enable_bsta_steer && s->is_bsta) memset(c->inform_stalist, 0, sizeof(c->inform_stalist));
cntlr_inform_bsteer_modules(c, s, CMDU_CLIENT_STEERING_BTM_REPORT); memcpy(c->inform_stalist, s->de_sta->macaddr, 6);
timer_set(&c->steer_sched_timer, 0);
return 0; return 0;
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment