Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • multi-ap/map-controller
1 result
Select Git revision
Show changes
Commits on Source (6)
......@@ -25,7 +25,7 @@ The README briefly describes the salient features supported by mapcontroller, an
* Vendor Extensions
* Vendor Extensions (IOWRT specific)
## UCI Configuration
## AP autoconfiguration
For a detailed view of the available map-controller UCI configuration options,
see [UCI docs](https://dev.iopsys.eu/multi-ap/map-controller/-/blob/devel/docs/api/mapcontroller.md?ref_type=heads).
......
......@@ -2,7 +2,7 @@
## STA steer policy configuration parameters according to EasyMesh standard ##
````
config sta_steering
option enable_sta_steer '1'
option enable_sta_steer '1'
option rcpi_threshold_2g '75'
option rcpi_threshold_5g '85'
option rcpi_threshold_6g '85'
......@@ -14,22 +14,21 @@ config sta_steering
option plugins_enabled '1'
option plugins_policy 'any' # 'any' or 'all'. default = 'any'
list plugins 'rcpi'
list plugins 'rate'
list plugins 'rate' # TBD
````
## Plugin 'rcpi' specific config section ##
````
config sta-steer 'rcpi'
option enabled '1'
option enabled '1'
option diffsnr '8'
option bandsteer '0'
option use_bcn_metrics '1'
option use_usta_metrics '1'
option steer_retry_int '30'
option use_bcn_metrics '1' # currently no effect. Always used.
option use_usta_metrics '1' # currently no effect. Always used.
option steer_int '180'
option steer_disable_int '600'
option steer_retry_int '30' # deprecated. Not used anymore.
option steer_disabled_int '30' # deprecated. Not used anymore.
:
.
option max_steer_attempt '-1' # default = -1 (unlimited)
......@@ -39,8 +38,8 @@ config sta-steer 'rcpi'
````
config sta-steer 'rate'
option enabled '1'
option threshold '40'
option enabled '1'
option threshold '40'
option margin '10'
option boost '20'
:
......
......@@ -484,6 +484,13 @@ void cntlr_bcn_metrics_timer_cb(atimer_t *t)
void node_add_sta(struct node *n, struct sta *s)
{
if (WARN_ON(node_find_sta(n, s->macaddr))) {
cntlr_dbg(LOG_STA,
"%s: Warn! STA " MACFMT " already in node " MACFMT"\n",
__func__, MAC2STR(s->macaddr), MAC2STR(n->almacaddr));
return;
}
memcpy(s->agent_almacaddr, n->almacaddr, 6);
list_add(&s->list, &n->stalist);
n->sta_count++;
......@@ -491,6 +498,13 @@ void node_add_sta(struct node *n, struct sta *s)
void node_del_sta(struct node *n, struct sta *s)
{
if (WARN_ON(!node_find_sta(n, s->macaddr))) {
cntlr_dbg(LOG_STA,
"%s: Warn! STA " MACFMT " not in node " MACFMT"\n",
__func__, MAC2STR(s->macaddr), MAC2STR(n->almacaddr));
return;
}
list_del(&s->list);
n->sta_count--;
}
......
......@@ -67,12 +67,24 @@ enum {
#define USTA_RESPONSE_TIMEOUT 5 /* in seconds */
#define BEACON_RESPONSE_TIMEOUT 10 /* in seconds */
//#define SKIP_OFFCHANNEL_BEACON_REQUEST 1
enum rcpi_trigger_type {
RCPI_TRIGGER_NOP = 0,
RCPI_TRIGGER_NONE = 0,
RCPI_TRIGGER_LOW = -1,
RCPI_TRIGGER_HIGH = 1,
};
enum rcpi_sta_state {
RCPI_STA_CONNECTED,
RCPI_STA_USTA_CHECK,
RCPI_STA_BCN_CHECK,
RCPI_STA_NOP,
RCPI_STA_NOSTEER,
RCPI_STA_DISCONNECTED,
};
/* per-sta steer context data */
struct rcpi_steer_sta_data {
uint8_t macaddr[6];
......@@ -87,10 +99,14 @@ struct rcpi_steer_sta_data {
uint8_t rcpi_high_trigger_cnt;
uint8_t diffsnr;
enum rcpi_sta_state state;
time_t lowrcpi_tstart;
time_t lowrcpi_tend;
bool lowrcpi_epoch;
time_t nop_tstart;
time_t bcn_query_time;
time_t usta_query_time;
......@@ -162,6 +178,28 @@ static void rcpi_reset_steer_sta_data(struct rcpi_steer_sta_data *st);
static int rcpi_query_sta_metrics(struct rcpi_steer_control *sc, struct steer_sta *s);
static const char *rcpi_sta_state_string(enum rcpi_sta_state s)
{
switch (s) {
case RCPI_STA_CONNECTED:
return "Connected";
case RCPI_STA_DISCONNECTED:
return "Disconnected";
case RCPI_STA_USTA_CHECK:
return "Unassoc-STA metrics check";
case RCPI_STA_BCN_CHECK:
return "Beacon metrics check";
case RCPI_STA_NOP:
return "Idle";
case RCPI_STA_NOSTEER:
return "No Steer";
default:
break;
}
return "Unknown";
}
static int timeradd_msecs(struct timeval *a, unsigned long msecs,
struct timeval *res)
{
......@@ -208,6 +246,7 @@ int rcpi_sta_table_entry_process(struct rcpi_steer_control *sc,
{
struct steer_sta *s = (struct steer_sta *)st->sta;
int action = STA_TIMER_NOP;
time_t now = time(NULL);
/* if action = STA_TIMER_ADD, set 'st->interval' as desired.
......@@ -222,35 +261,47 @@ int rcpi_sta_table_entry_process(struct rcpi_steer_control *sc,
return STA_TIMER_NOP;
}
if (st->usta_query_sent && !st->usta_metrics_processed) {
st->check_bcn_report = 1;
/* send sta-metrics-query to know updated metrics */
rcpi_query_sta_metrics(sc, s);
st->interval = 2 * 1000;
switch (st->state) {
case RCPI_STA_USTA_CHECK:
if (st->usta_query_sent && difftime(now, st->usta_query_time) >= USTA_RESPONSE_TIMEOUT) {
st->state = RCPI_STA_BCN_CHECK;
st->check_bcn_report = 1;
cntlr_dbg(LOG_STEER,
"rcpi_sta_timer_cb: STA " MACFMT ": Unassoc-STA meas not available yet\n",
MAC2STR(st->macaddr));
return STA_TIMER_ADD;
}
if (st->bcn_query_sent && !st->bcn_metrics_processed) {
cntlr_dbg(LOG_STEER,
"rcpi_sta_timer_cb: STA " MACFMT ": Beacon Report not available yet\n",
MAC2STR(st->macaddr));
/* send sta-metrics-query to know updated metrics */
rcpi_query_sta_metrics(sc, s);
st->interval = 2 * 1000;
cntlr_dbg(LOG_STEER,
"rcpi_sta_timer_cb: STA " MACFMT ": Unassoc-STA meas not available yet\n",
MAC2STR(st->macaddr));
// reset following so can retry in the next rcpi_steer call
st->usta_query_sent = 0;
st->bcn_query_sent = 0;
st->check_bcn_report = 0;
/* send sta-metrics-query to know updated metrics */
rcpi_query_sta_metrics(sc, s);
}
break;
case RCPI_STA_BCN_CHECK:
if (st->bcn_query_sent && difftime(now, st->bcn_query_time) >= BEACON_RESPONSE_TIMEOUT) {
st->state = RCPI_STA_NOP;
cntlr_dbg(LOG_STEER,
"rcpi_sta_timer_cb: STA " MACFMT ": Beacon Report not available yet\n",
MAC2STR(st->macaddr));
return STA_TIMER_ADD;
/* enter 'steer_int' nop interval */
time(&st->nop_tstart);
st->interval = sc->steer_int * 1000;
action = STA_TIMER_ADD;
}
break;
case RCPI_STA_NOP:
if (difftime(now, st->nop_tstart) >= sc->steer_int) {
/* exit nop state */
st->state = RCPI_STA_CONNECTED;
st->nop_tstart = 0;
st->usta_query_sent = 0;
st->bcn_query_sent = 0;
st->check_bcn_report = 0;
rcpi_query_sta_metrics(sc, s);
}
break;
default:
break;
}
return action;
......@@ -577,9 +628,11 @@ int rcpi_query_beacon_metrics(struct rcpi_steer_control *sc, struct rcpi_steer_s
cntlr_dbg(LOG_STEER, "%s: Nbr-AP " MACFMT ", opclass = %d, channel = %d\n",
__func__, MAC2STR(nbr->bssid), nbr->opclass, nbr->channel);
/* skip off-channel request now */
#ifdef SKIP_OFFCHANNEL_BEACON_REQUEST
/* skip off-channel request */
if (s->bss.channel != nbr->channel)
continue;
#endif
blob_buf_init(&bi, 0);
blob_buf_init(&bo, 0);
......@@ -632,6 +685,7 @@ void rcpi_reset_steer_sta_data(struct rcpi_steer_sta_data *st)
st->tprev = 0;
st->connected = ((struct steer_sta *)st->sta)->bss.connected;
st->state = st->connected ? RCPI_STA_CONNECTED : RCPI_STA_DISCONNECTED;
st->bcn_metrics_processed = false;
st->bcn_query_sent = false;
st->check_bcn_report = false;
......@@ -648,6 +702,8 @@ void rcpi_print_steer_sta_data(struct rcpi_steer_sta_data *st)
#define NUM_USTA_METRICS 16
#define NUM_BCN_METRICS 16
cntlr_dbg(LOG_STEER, "STA = " MACFMT "\n", MAC2STR(st->macaddr));
cntlr_dbg(LOG_STEER, "BSSID = " MACFMT "\n", MAC2STR(((struct steer_sta *)st->sta)->bss.bssid));
cntlr_dbg(LOG_STEER, "state = %s\n", rcpi_sta_state_string(st->state));
cntlr_dbg(LOG_STEER, "lowrcpi = %d\n", st->lowrcpi_epoch);
cntlr_dbg(LOG_STEER, "usta-query-sent = %d\n", st->usta_query_sent);
cntlr_dbg(LOG_STEER, "bcn-query-sent = %d\n", st->bcn_query_sent);
......@@ -774,7 +830,7 @@ int rcpi_sta_trigger_check(struct rcpi_steer_sta_data *st)
int end = 0;
if (st->t < st->rcpi_low_trigger_cnt)
return RCPI_TRIGGER_NOP;
return RCPI_TRIGGER_NONE;
end = st->t < NUM_RCPI_SAMPLES ? st->t : st->t % NUM_RCPI_SAMPLES;
if (st->t >= NUM_RCPI_SAMPLES)
......@@ -799,7 +855,7 @@ int rcpi_sta_trigger_check(struct rcpi_steer_sta_data *st)
return RCPI_TRIGGER_LOW;
}
return RCPI_TRIGGER_NOP;
return RCPI_TRIGGER_NONE;
}
} else {
lowrcpi_cnt = 0;
......@@ -811,12 +867,12 @@ int rcpi_sta_trigger_check(struct rcpi_steer_sta_data *st)
return RCPI_TRIGGER_HIGH;
}
return RCPI_TRIGGER_NOP;
return RCPI_TRIGGER_NONE;
}
}
} while (end != start);
return RCPI_TRIGGER_NOP;
return RCPI_TRIGGER_NONE;
}
int rcpi_steer_ok(struct rcpi_steer_sta_data *st)
......@@ -852,7 +908,8 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
time_t now = time(NULL);
cntlr_trace(LOG_STEER, "%s: STA " MACFMT " --------->\n", __func__, MAC2STR(s->sta->macaddr));
cntlr_trace(LOG_STEER, "%s: STA " MACFMT ", rcpi = %u --------->\n",
__func__, MAC2STR(s->sta->macaddr), s->sta->rcpi);
s->verdict = STEER_VERDICT_UNDECIDED;
s->reason = STEER_REASON_UNDEFINED;
......@@ -917,7 +974,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
rcpi_trigger = rcpi_sta_trigger_check(st);
cntlr_dbg(LOG_STEER, "%s: rcpi-trigger = %s\n", __func__,
rcpi_trigger == RCPI_TRIGGER_LOW ? "LOW" :
rcpi_trigger == RCPI_TRIGGER_HIGH ? "HIGH" : "NOP");
rcpi_trigger == RCPI_TRIGGER_HIGH ? "HIGH" : "NONE");
}
cntlr_dbg(LOG_STEER,
......@@ -998,7 +1055,8 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
MAC2STR(b->bssid), b->rcpi, b->channel, b->opclass);
if (is_meas_old(now, b->rpt_time, BEACON_METRICS_AGEOUT)) {
cntlr_dbg(LOG_STEER, "%s: Ignore old bcn-report\n", __func__);
cntlr_dbg(LOG_STEER, "%s: Ignore %ds old bcn-report\n",
__func__, (int)difftime(now, b->rpt_time));
continue;
}
......@@ -1026,7 +1084,8 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
list_for_each_entry(b, s->meas_reportlist, list) {
if (is_meas_old(now, b->rpt_time, BEACON_METRICS_AGEOUT)) {
cntlr_dbg(LOG_STEER, "%s: Ignore old bcn-report\n", __func__);
cntlr_dbg(LOG_STEER, "%s: Ignore %ds old bcn-report\n",
__func__, (int)difftime(now, b->rpt_time));
continue;
}
......@@ -1066,12 +1125,14 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
if (!st->usta_query_sent) {
ret = rcpi_query_unassoc_sta_metrics(sc, st);
if (!ret && st->usta_query_sent) {
st->state = RCPI_STA_USTA_CHECK;
st->usta_metrics_processed = 0;
rcpi_sta_timer_set(sc, st, USTA_RESPONSE_TIMEOUT * 1000);
}
} else if (st->check_bcn_report && !st->bcn_query_sent) {
ret = rcpi_query_beacon_metrics(sc, st);
if (!ret && st->bcn_query_sent) {
st->state = RCPI_STA_BCN_CHECK;
st->bcn_metrics_processed = 0;
rcpi_sta_timer_set(sc, st, BEACON_RESPONSE_TIMEOUT * 1000);
}
......@@ -1082,7 +1143,6 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
/* curr-rcpi >= report_rcpi_threshold */
if (rcpi_trigger == RCPI_TRIGGER_HIGH) {
st->cleanup = 1;
rcpi_reset_steer_sta_data(st);
}
......