Skip to content

Commit e5328c1

Browse files
Sarika Sharmajmberg-intel
authored andcommitted
wifi: mac80211: refactor populating mesh related fields in sinfo
Introduce the sta_set_mesh_sinfo() to populate mesh related fields in sinfo structure for station statistics. This will allow for the simplified population of other fields in the sinfo structure for link level in a subsequent patch to add support for MLO station statistics. No functionality changes added. Signed-off-by: Sarika Sharma <[email protected]> Link: https://patch.msgid.link/[email protected] [reword since it's just an internal thing] Signed-off-by: Johannes Berg <[email protected]>
1 parent 23ff5f6 commit e5328c1

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

net/mac80211/sta_info.c

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,6 +2584,39 @@ static inline u64 sta_get_stats_bytes(struct ieee80211_sta_rx_stats *rxstats)
25842584
return value;
25852585
}
25862586

2587+
#ifdef CONFIG_MAC80211_MESH
2588+
static void sta_set_mesh_sinfo(struct sta_info *sta,
2589+
struct station_info *sinfo)
2590+
{
2591+
struct ieee80211_local *local = sta->sdata->local;
2592+
2593+
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_LLID) |
2594+
BIT_ULL(NL80211_STA_INFO_PLID) |
2595+
BIT_ULL(NL80211_STA_INFO_PLINK_STATE) |
2596+
BIT_ULL(NL80211_STA_INFO_LOCAL_PM) |
2597+
BIT_ULL(NL80211_STA_INFO_PEER_PM) |
2598+
BIT_ULL(NL80211_STA_INFO_NONPEER_PM) |
2599+
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_GATE) |
2600+
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_AS);
2601+
2602+
sinfo->llid = sta->mesh->llid;
2603+
sinfo->plid = sta->mesh->plid;
2604+
sinfo->plink_state = sta->mesh->plink_state;
2605+
if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
2606+
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_T_OFFSET);
2607+
sinfo->t_offset = sta->mesh->t_offset;
2608+
}
2609+
sinfo->local_pm = sta->mesh->local_pm;
2610+
sinfo->peer_pm = sta->mesh->peer_pm;
2611+
sinfo->nonpeer_pm = sta->mesh->nonpeer_pm;
2612+
sinfo->connected_to_gate = sta->mesh->connected_to_gate;
2613+
sinfo->connected_to_as = sta->mesh->connected_to_as;
2614+
2615+
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC);
2616+
sinfo->airtime_link_metric = airtime_link_metric_get(local, sta);
2617+
}
2618+
#endif
2619+
25872620
void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
25882621
bool tidstats)
25892622
{
@@ -2768,31 +2801,10 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
27682801
sta_set_tidstats(sta, &sinfo->pertid[i], i);
27692802
}
27702803

2771-
if (ieee80211_vif_is_mesh(&sdata->vif)) {
27722804
#ifdef CONFIG_MAC80211_MESH
2773-
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_LLID) |
2774-
BIT_ULL(NL80211_STA_INFO_PLID) |
2775-
BIT_ULL(NL80211_STA_INFO_PLINK_STATE) |
2776-
BIT_ULL(NL80211_STA_INFO_LOCAL_PM) |
2777-
BIT_ULL(NL80211_STA_INFO_PEER_PM) |
2778-
BIT_ULL(NL80211_STA_INFO_NONPEER_PM) |
2779-
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_GATE) |
2780-
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_AS);
2781-
2782-
sinfo->llid = sta->mesh->llid;
2783-
sinfo->plid = sta->mesh->plid;
2784-
sinfo->plink_state = sta->mesh->plink_state;
2785-
if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
2786-
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_T_OFFSET);
2787-
sinfo->t_offset = sta->mesh->t_offset;
2788-
}
2789-
sinfo->local_pm = sta->mesh->local_pm;
2790-
sinfo->peer_pm = sta->mesh->peer_pm;
2791-
sinfo->nonpeer_pm = sta->mesh->nonpeer_pm;
2792-
sinfo->connected_to_gate = sta->mesh->connected_to_gate;
2793-
sinfo->connected_to_as = sta->mesh->connected_to_as;
2805+
if (ieee80211_vif_is_mesh(&sdata->vif))
2806+
sta_set_mesh_sinfo(sta, sinfo);
27942807
#endif
2795-
}
27962808

27972809
sinfo->bss_param.flags = 0;
27982810
if (sdata->vif.bss_conf.use_cts_prot)
@@ -2848,12 +2860,6 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
28482860
sinfo->filled |=
28492861
BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
28502862
}
2851-
2852-
if (ieee80211_vif_is_mesh(&sdata->vif)) {
2853-
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC);
2854-
sinfo->airtime_link_metric =
2855-
airtime_link_metric_get(local, sta);
2856-
}
28572863
}
28582864

28592865
u32 sta_get_expected_throughput(struct sta_info *sta)

0 commit comments

Comments
 (0)