Skip to main content
Homepage
Explore
Search or go to…
/
Sign in
Explore
Primary navigation
Project
M
map-controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
Multi-AP
map-controller
Commits
1ce2d19e
Commit
1ce2d19e
authored
5 months ago
by
Anjan Chanda
Browse files
Options
Downloads
Patches
Plain Diff
steer: rcpi: use cntlr_get_sta_element() to get wifi_sta_element of STA
parent
52096e84
No related branches found
No related tags found
No related merge requests found
Pipeline
#210990
failed
5 months ago
Status:
Stage: static_code_analysis
Status:
Stage: compile_test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/steer/rcpi/Makefile
+1
-1
1 addition, 1 deletion
src/plugins/steer/rcpi/Makefile
src/plugins/steer/rcpi/rcpi.c
+45
-30
45 additions, 30 deletions
src/plugins/steer/rcpi/rcpi.c
with
46 additions
and
31 deletions
src/plugins/steer/rcpi/Makefile
+
1
−
1
View file @
1ce2d19e
...
@@ -7,7 +7,7 @@ all: rcpi.so
...
@@ -7,7 +7,7 @@ all: rcpi.so
$(
CC
)
$(
CFLAGS
)
-fPIC
-I
.
-I
../../..
-I
../../../utils
-c
$<
-o
$@
$(
CC
)
$(
CFLAGS
)
-fPIC
-I
.
-I
../../..
-I
../../../utils
-c
$<
-o
$@
rcpi.so
:
rcpi.o
rcpi.so
:
rcpi.o
$(
CC
)
$(
CFLAGS
)
$(
LDFLAGS
)
-shared
-Wl
,-soname,
$@
-o
$@
$^
$(
CC
)
$(
CFLAGS
)
$(
LDFLAGS
)
-shared
-Wl
,-soname,
$@
-o
$@
$^
-lcntlr-apis
clean
:
clean
:
rm
-f
*
.o
*
.so
*
rm
-f
*
.o
*
.so
*
This diff is collapsed.
Click to expand it.
src/plugins/steer/rcpi/rcpi.c
+
45
−
30
View file @
1ce2d19e
...
@@ -22,15 +22,15 @@
...
@@ -22,15 +22,15 @@
#include
<1905_tlvs.h>
#include
<1905_tlvs.h>
#include
<easymesh.h>
#include
<easymesh.h>
#include
"cntlr_commands_impl.h"
#include
"wifi_dataelements.h"
#include
"wifi_opclass.h"
#include
"cntlr_commands.h"
#include
"cntlr_apis.h"
#include
"steer_module.h"
#include
"steer_module.h"
#include
"sta.h"
#include
"timer.h"
#include
"timer.h"
#include
"timer_impl.h"
#include
"timer_impl.h"
#include
"utils/utils.h"
#include
"utils/debug.h"
#include
"utils/debug.h"
#include
"wifi_dataelements.h"
#include
"utils/utils.h"
#include
"wifi_opclass.h"
#ifndef MAC_ADDR_HASH
#ifndef MAC_ADDR_HASH
#define MAC_ADDR_HASH(a) (a[0] ^ a[1] ^ a[2] ^ a[3] ^ a[4] ^ a[5])
#define MAC_ADDR_HASH(a) (a[0] ^ a[1] ^ a[2] ^ a[3] ^ a[4] ^ a[5])
...
@@ -552,7 +552,7 @@ int rcpi_query_sta_metrics(struct rcpi_steer_control *sc, struct steer_sta *s)
...
@@ -552,7 +552,7 @@ int rcpi_query_sta_metrics(struct rcpi_steer_control *sc, struct steer_sta *s)
hwaddr_ntoa
(
s
->
bss
.
agent
,
agent
);
hwaddr_ntoa
(
s
->
bss
.
agent
,
agent
);
blobmsg_add_string
(
&
bi
,
"agent"
,
agent
);
blobmsg_add_string
(
&
bi
,
"agent"
,
agent
);
hwaddr_ntoa
(
s
->
sta
->
macaddr
,
stamac
);
hwaddr_ntoa
(
s
->
macaddr
,
stamac
);
blobmsg_add_string
(
&
bi
,
"sta"
,
stamac
);
blobmsg_add_string
(
&
bi
,
"sta"
,
stamac
);
ret
=
COMMAND
(
query_sta_metrics
)(
cntlr
,
bi
.
head
,
&
bo
);
ret
=
COMMAND
(
query_sta_metrics
)(
cntlr
,
bi
.
head
,
&
bo
);
...
@@ -570,7 +570,7 @@ int rcpi_query_sta_metrics(struct rcpi_steer_control *sc, struct steer_sta *s)
...
@@ -570,7 +570,7 @@ int rcpi_query_sta_metrics(struct rcpi_steer_control *sc, struct steer_sta *s)
cntlr_dbg
(
LOG_STEER
,
cntlr_dbg
(
LOG_STEER
,
"%s: STA "
MACFMT
": Request STA-Metrics cmdu mid = %hu
\n
"
,
"%s: STA "
MACFMT
": Request STA-Metrics cmdu mid = %hu
\n
"
,
__func__
,
MAC2STR
(
s
->
sta
->
macaddr
),
req_mid
);
__func__
,
MAC2STR
(
s
->
macaddr
),
req_mid
);
}
}
}
else
{
}
else
{
cntlr_dbg
(
LOG_STEER
,
"%s: failed to Request STA-Metrics
\n
"
,
__func__
);
cntlr_dbg
(
LOG_STEER
,
"%s: failed to Request STA-Metrics
\n
"
,
__func__
);
...
@@ -619,7 +619,7 @@ int rcpi_query_unassoc_sta_metrics(struct rcpi_steer_control *sc, struct rcpi_st
...
@@ -619,7 +619,7 @@ int rcpi_query_unassoc_sta_metrics(struct rcpi_steer_control *sc, struct rcpi_st
blobmsg_add_u32
(
&
bi
,
"opclass"
,
s
->
bss
.
opclass
);
blobmsg_add_u32
(
&
bi
,
"opclass"
,
s
->
bss
.
opclass
);
blobmsg_add_u32
(
&
bi
,
"channel"
,
s
->
bss
.
channel
);
blobmsg_add_u32
(
&
bi
,
"channel"
,
s
->
bss
.
channel
);
arr
=
blobmsg_open_array
(
&
bi
,
"stalist"
);
arr
=
blobmsg_open_array
(
&
bi
,
"stalist"
);
blobmsg_add_macaddr
(
&
bi
,
""
,
s
->
sta
->
macaddr
);
blobmsg_add_macaddr
(
&
bi
,
""
,
s
->
macaddr
);
blobmsg_close_array
(
&
bi
,
arr
);
blobmsg_close_array
(
&
bi
,
arr
);
ret
=
COMMAND
(
query_unassoc_sta_metrics
)(
cntlr
,
bi
.
head
,
&
bo
);
ret
=
COMMAND
(
query_unassoc_sta_metrics
)(
cntlr
,
bi
.
head
,
&
bo
);
...
@@ -637,7 +637,7 @@ int rcpi_query_unassoc_sta_metrics(struct rcpi_steer_control *sc, struct rcpi_st
...
@@ -637,7 +637,7 @@ int rcpi_query_unassoc_sta_metrics(struct rcpi_steer_control *sc, struct rcpi_st
cntlr_dbg
(
LOG_STEER
,
cntlr_dbg
(
LOG_STEER
,
"%s: STA "
MACFMT
": Request Unassoc-STA metrics from "
MACFMT
" cmdu mid = %hu
\n
"
,
"%s: STA "
MACFMT
": Request Unassoc-STA metrics from "
MACFMT
" cmdu mid = %hu
\n
"
,
__func__
,
MAC2STR
(
s
->
sta
->
macaddr
),
__func__
,
MAC2STR
(
s
->
macaddr
),
MAC2STR
(
nbr
->
agent
),
req_mid
);
MAC2STR
(
nbr
->
agent
),
req_mid
);
time
(
&
st
->
usta_query_time
);
time
(
&
st
->
usta_query_time
);
...
@@ -687,7 +687,7 @@ int rcpi_query_beacon_metrics(struct rcpi_steer_control *sc, struct rcpi_steer_s
...
@@ -687,7 +687,7 @@ int rcpi_query_beacon_metrics(struct rcpi_steer_control *sc, struct rcpi_steer_s
blob_buf_init
(
&
bo
,
0
);
blob_buf_init
(
&
bo
,
0
);
blobmsg_add_macaddr
(
&
bi
,
"agent"
,
s
->
bss
.
agent
);
blobmsg_add_macaddr
(
&
bi
,
"agent"
,
s
->
bss
.
agent
);
blobmsg_add_macaddr
(
&
bi
,
"sta"
,
s
->
sta
->
macaddr
);
blobmsg_add_macaddr
(
&
bi
,
"sta"
,
s
->
macaddr
);
blobmsg_add_string
(
&
bi
,
"ssid"
,
(
char
*
)
s
->
bss
.
ssid
);
blobmsg_add_string
(
&
bi
,
"ssid"
,
(
char
*
)
s
->
bss
.
ssid
);
blobmsg_add_macaddr
(
&
bi
,
"bssid"
,
nbr
->
bssid
);
blobmsg_add_macaddr
(
&
bi
,
"bssid"
,
nbr
->
bssid
);
...
@@ -935,7 +935,7 @@ int rcpi_steer_ok(struct rcpi_steer_sta_data *st)
...
@@ -935,7 +935,7 @@ int rcpi_steer_ok(struct rcpi_steer_sta_data *st)
cntlr_dbg
(
LOG_STEER
,
cntlr_dbg
(
LOG_STEER
,
"rcpi_steer: decision is steer STA "
MACFMT
" to new AP "
MACFMT
" with %s-RCPI %u
\n
"
,
"rcpi_steer: decision is steer STA "
MACFMT
" to new AP "
MACFMT
" with %s-RCPI %u
\n
"
,
MAC2STR
(
s
->
sta
->
macaddr
),
MAC2STR
(
s
->
macaddr
),
MAC2STR
(
s
->
target
.
bssid
),
MAC2STR
(
s
->
target
.
bssid
),
s
->
target
.
ul_rcpi
?
"UL"
:
"DL"
,
s
->
target
.
ul_rcpi
?
"UL"
:
"DL"
,
s
->
target
.
ul_rcpi
?
s
->
target
.
ul_rcpi
:
s
->
target
.
dl_rcpi
);
s
->
target
.
ul_rcpi
?
s
->
target
.
ul_rcpi
:
s
->
target
.
dl_rcpi
);
...
@@ -946,25 +946,40 @@ int rcpi_steer_ok(struct rcpi_steer_sta_data *st)
...
@@ -946,25 +946,40 @@ int rcpi_steer_ok(struct rcpi_steer_sta_data *st)
int
rcpi_steer
(
void
*
priv
,
struct
steer_sta
*
s
,
uint16_t
rxcmdu_type
)
int
rcpi_steer
(
void
*
priv
,
struct
steer_sta
*
s
,
uint16_t
rxcmdu_type
)
{
{
struct
rcpi_steer_control
*
sc
=
(
struct
rcpi_steer_control
*
)
priv
;
struct
rcpi_steer_control
*
sc
=
(
struct
rcpi_steer_control
*
)
priv
;
struct
rcpi_steer_sta_data
*
st
=
rcpi_lookup_sta
(
sc
,
s
->
sta
->
macaddr
);
struct
rcpi_steer_sta_data
*
st
=
NULL
;
int
rcpi_trigger
=
RCPI_TRIGGER_NONE
;
uint8_t
best_channel
=
s
->
bss
.
channel
;
struct
wifi_sta_element
*
sta
;
uint8_t
*
best_agent
=
s
->
bss
.
agent
;
uint8_t
*
best_bssid
=
s
->
bss
.
bssid
;
uint8_t
best_rcpi
=
s
->
sta
->
rcpi
;
bool
best_found
=
false
;
bool
best_found
=
false
;
int
rcpi_trigger
=
0
;
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
uint8_t
best_channel
;
uint8_t
*
best_agent
;
uint8_t
*
best_bssid
;
uint8_t
best_rcpi
;
void
*
cntlr
;
if
(
!
sc
||
!
s
)
return
0
;
cntlr
=
((
struct
steer_control
*
)(
sc
->
self
))
->
controller
;
sta
=
cntlr_get_sta_element
(
cntlr
,
s
->
macaddr
);
if
(
!
sta
)
return
0
;
cntlr_dbg
(
LOG_STEER
,
"%s: STA "
MACFMT
", rcpi = %u --------->
\n
"
,
cntlr_dbg
(
LOG_STEER
,
"%s: STA "
MACFMT
", rcpi = %u --------->
\n
"
,
__func__
,
MAC2STR
(
s
->
sta
->
macaddr
),
s
->
sta
->
rcpi
);
__func__
,
MAC2STR
(
s
->
macaddr
),
sta
->
rcpi
);
best_rcpi
=
sta
->
rcpi
;
best_channel
=
s
->
bss
.
channel
;
best_agent
=
s
->
bss
.
agent
;
best_bssid
=
s
->
bss
.
bssid
;
s
->
verdict
=
STEER_VERDICT_UNDECIDED
;
s
->
verdict
=
STEER_VERDICT_UNDECIDED
;
s
->
reason
=
STEER_REASON_UNDEFINED
;
s
->
reason
=
STEER_REASON_UNDEFINED
;
st
=
rcpi_lookup_sta
(
sc
,
sta
->
macaddr
);
if
(
!
st
)
{
if
(
!
st
)
{
int
idx
=
sta_table_hash
(
s
->
sta
->
macaddr
);
int
idx
=
sta_table_hash
(
sta
->
macaddr
);
/* initialize steer state data for the STA */
/* initialize steer state data for the STA */
st
=
calloc
(
1
,
sizeof
(
*
st
));
st
=
calloc
(
1
,
sizeof
(
*
st
));
...
@@ -975,7 +990,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -975,7 +990,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
st
->
priv
=
sc
;
st
->
priv
=
sc
;
st
->
sta
=
s
;
st
->
sta
=
s
;
memcpy
(
st
->
macaddr
,
s
->
sta
->
macaddr
,
6
);
memcpy
(
st
->
macaddr
,
sta
->
macaddr
,
6
);
st
->
t
=
0
;
st
->
t
=
0
;
time
(
&
st
->
t0
);
time
(
&
st
->
t0
);
st
->
diffsnr
=
sc
->
diffsnr
;
st
->
diffsnr
=
sc
->
diffsnr
;
...
@@ -1000,7 +1015,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -1000,7 +1015,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
if
(
s
->
bss
.
connected
!=
st
->
connected
)
{
if
(
s
->
bss
.
connected
!=
st
->
connected
)
{
cntlr_dbg
(
LOG_STEER
,
cntlr_dbg
(
LOG_STEER
,
"%s: STA "
MACFMT
" %s "
MACFMT
"
\n
"
,
__func__
,
"%s: STA "
MACFMT
" %s "
MACFMT
"
\n
"
,
__func__
,
MAC2STR
(
s
->
sta
->
macaddr
),
MAC2STR
(
sta
->
macaddr
),
s
->
bss
.
connected
==
0
?
"disconnected from"
:
"connected to"
,
s
->
bss
.
connected
==
0
?
"disconnected from"
:
"connected to"
,
MAC2STR
(
s
->
bss
.
bssid
));
MAC2STR
(
s
->
bss
.
bssid
));
...
@@ -1013,12 +1028,12 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -1013,12 +1028,12 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
/* update STA's rcpi samples */
/* update STA's rcpi samples */
if
(
rxcmdu_type
==
CMDU_ASSOC_STA_LINK_METRICS_RESPONSE
||
if
(
rxcmdu_type
==
CMDU_ASSOC_STA_LINK_METRICS_RESPONSE
||
rxcmdu_type
==
CMDU_AP_METRICS_RESPONSE
)
{
rxcmdu_type
==
CMDU_AP_METRICS_RESPONSE
)
{
st
->
rcpi
[
st
->
t
%
NUM_RCPI_SAMPLES
].
sample
=
s
->
sta
->
rcpi
;
st
->
rcpi
[
st
->
t
%
NUM_RCPI_SAMPLES
].
sample
=
sta
->
rcpi
;
st
->
rcpi
[
st
->
t
%
NUM_RCPI_SAMPLES
].
dt
=
st
->
tprev
?
difftime
(
now
,
st
->
tprev
)
:
0
;
st
->
rcpi
[
st
->
t
%
NUM_RCPI_SAMPLES
].
dt
=
st
->
tprev
?
difftime
(
now
,
st
->
tprev
)
:
0
;
st
->
t
++
;
st
->
t
++
;
st
->
tprev
=
now
;
st
->
tprev
=
now
;
rcpi_dump_sta_table
(
sc
,
s
->
sta
->
macaddr
);
rcpi_dump_sta_table
(
sc
,
sta
->
macaddr
);
rcpi_trigger
=
rcpi_sta_trigger_check
(
st
);
rcpi_trigger
=
rcpi_sta_trigger_check
(
st
);
cntlr_dbg
(
LOG_STEER
,
"%s: rcpi-trigger = %s
\n
"
,
__func__
,
cntlr_dbg
(
LOG_STEER
,
"%s: rcpi-trigger = %s
\n
"
,
__func__
,
...
@@ -1035,8 +1050,8 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -1035,8 +1050,8 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
cntlr_dbg
(
LOG_STEER
,
cntlr_dbg
(
LOG_STEER
,
"%s: STA "
MACFMT
" connected to "
MACFMT
" on channel %d has RCPI = %u
\n
"
,
"%s: STA "
MACFMT
" connected to "
MACFMT
" on channel %d has RCPI = %u
\n
"
,
__func__
,
MAC2STR
(
s
->
sta
->
macaddr
),
MAC2STR
(
s
->
bss
.
bssid
),
__func__
,
MAC2STR
(
sta
->
macaddr
),
MAC2STR
(
s
->
bss
.
bssid
),
s
->
bss
.
channel
,
s
->
sta
->
rcpi
);
s
->
bss
.
channel
,
sta
->
rcpi
);
if
(
sc
->
max_btm_attempt
!=
DEFAULT_MAX_STEER_ATTEMPT
&&
if
(
sc
->
max_btm_attempt
!=
DEFAULT_MAX_STEER_ATTEMPT
&&
...
@@ -1044,7 +1059,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -1044,7 +1059,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
cntlr_dbg
(
LOG_STEER
,
cntlr_dbg
(
LOG_STEER
,
"%s: Skip STA "
MACFMT
" steer check. "
"%s: Skip STA "
MACFMT
" steer check. "
"Num-attempts (%d) > max-attempts (%d)
\n
"
,
"Num-attempts (%d) > max-attempts (%d)
\n
"
,
__func__
,
MAC2STR
(
s
->
sta
->
macaddr
),
__func__
,
MAC2STR
(
sta
->
macaddr
),
st
->
num_steer_attempt
,
sc
->
max_btm_attempt
);
st
->
num_steer_attempt
,
sc
->
max_btm_attempt
);
return
0
;
return
0
;
}
}
...
@@ -1086,7 +1101,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -1086,7 +1101,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
if
(
best_found
)
{
if
(
best_found
)
{
/* better AP found using unassoc-sta metrics */
/* better AP found using unassoc-sta metrics */
if
(
s
->
sta
->
rcpi
<=
s
->
bss
.
rcpi_threshold
)
{
if
(
sta
->
rcpi
<=
s
->
bss
.
rcpi_threshold
)
{
memcpy
(
s
->
target
.
bssid
,
best_bssid
,
6
);
memcpy
(
s
->
target
.
bssid
,
best_bssid
,
6
);
memcpy
(
s
->
target
.
agent
,
best_agent
,
6
);
memcpy
(
s
->
target
.
agent
,
best_agent
,
6
);
s
->
target
.
channel
=
best_channel
;
s
->
target
.
channel
=
best_channel
;
...
@@ -1108,7 +1123,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -1108,7 +1123,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
/* most recent report(s) are at list-head */
/* most recent report(s) are at list-head */
cntlr_dbg
(
LOG_STEER
,
cntlr_dbg
(
LOG_STEER
,
"%s: STA "
MACFMT
" BCN-Rpt: bss = "
MACFMT
", rcpi = %u, ch = %d, opclass = %d
\n
"
,
"%s: STA "
MACFMT
" BCN-Rpt: bss = "
MACFMT
", rcpi = %u, ch = %d, opclass = %d
\n
"
,
__func__
,
MAC2STR
(
s
->
sta
->
macaddr
),
__func__
,
MAC2STR
(
sta
->
macaddr
),
MAC2STR
(
b
->
bssid
),
b
->
rcpi
,
b
->
channel
,
b
->
opclass
);
MAC2STR
(
b
->
bssid
),
b
->
rcpi
,
b
->
channel
,
b
->
opclass
);
if
(
!
is_bcnreport_usable
(
st
,
b
))
{
if
(
!
is_bcnreport_usable
(
st
,
b
))
{
...
@@ -1166,7 +1181,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
...
@@ -1166,7 +1181,7 @@ int rcpi_steer(void *priv, struct steer_sta *s, uint16_t rxcmdu_type)
if
(
best_found
)
{
if
(
best_found
)
{
/* better AP found using beacon-report */
/* better AP found using beacon-report */
if
(
s
->
sta
->
rcpi
<=
s
->
bss
.
rcpi_threshold
)
{
if
(
sta
->
rcpi
<=
s
->
bss
.
rcpi_threshold
)
{
memcpy
(
s
->
target
.
bssid
,
best_bssid
,
6
);
memcpy
(
s
->
target
.
bssid
,
best_bssid
,
6
);
memcpy
(
s
->
target
.
agent
,
best_agent
,
6
);
memcpy
(
s
->
target
.
agent
,
best_agent
,
6
);
s
->
target
.
channel
=
best_channel
;
s
->
target
.
channel
=
best_channel
;
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment