Skip to content

Commit

Permalink
wifi: mac80211: refactor populating mesh related fields in sinfo
Browse files Browse the repository at this point in the history
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 <quic_sarishar@quicinc.com>
Link: https://patch.msgid.link/20250213171632.1646538-3-quic_sarishar@quicinc.com
[reword since it's just an internal thing]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Sarika Sharma authored and Johannes Berg committed Feb 28, 2025
1 parent 23ff5f6 commit e5328c1
Showing 1 changed file with 35 additions and 29 deletions.
64 changes: 35 additions & 29 deletions net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,39 @@ static inline u64 sta_get_stats_bytes(struct ieee80211_sta_rx_stats *rxstats)
return value;
}

#ifdef CONFIG_MAC80211_MESH
static void sta_set_mesh_sinfo(struct sta_info *sta,
struct station_info *sinfo)
{
struct ieee80211_local *local = sta->sdata->local;

sinfo->filled |= BIT_ULL(NL80211_STA_INFO_LLID) |
BIT_ULL(NL80211_STA_INFO_PLID) |
BIT_ULL(NL80211_STA_INFO_PLINK_STATE) |
BIT_ULL(NL80211_STA_INFO_LOCAL_PM) |
BIT_ULL(NL80211_STA_INFO_PEER_PM) |
BIT_ULL(NL80211_STA_INFO_NONPEER_PM) |
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_GATE) |
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_AS);

sinfo->llid = sta->mesh->llid;
sinfo->plid = sta->mesh->plid;
sinfo->plink_state = sta->mesh->plink_state;
if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_T_OFFSET);
sinfo->t_offset = sta->mesh->t_offset;
}
sinfo->local_pm = sta->mesh->local_pm;
sinfo->peer_pm = sta->mesh->peer_pm;
sinfo->nonpeer_pm = sta->mesh->nonpeer_pm;
sinfo->connected_to_gate = sta->mesh->connected_to_gate;
sinfo->connected_to_as = sta->mesh->connected_to_as;

sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC);
sinfo->airtime_link_metric = airtime_link_metric_get(local, sta);
}
#endif

void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
bool tidstats)
{
Expand Down Expand Up @@ -2768,31 +2801,10 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
sta_set_tidstats(sta, &sinfo->pertid[i], i);
}

if (ieee80211_vif_is_mesh(&sdata->vif)) {
#ifdef CONFIG_MAC80211_MESH
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_LLID) |
BIT_ULL(NL80211_STA_INFO_PLID) |
BIT_ULL(NL80211_STA_INFO_PLINK_STATE) |
BIT_ULL(NL80211_STA_INFO_LOCAL_PM) |
BIT_ULL(NL80211_STA_INFO_PEER_PM) |
BIT_ULL(NL80211_STA_INFO_NONPEER_PM) |
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_GATE) |
BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_AS);

sinfo->llid = sta->mesh->llid;
sinfo->plid = sta->mesh->plid;
sinfo->plink_state = sta->mesh->plink_state;
if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_T_OFFSET);
sinfo->t_offset = sta->mesh->t_offset;
}
sinfo->local_pm = sta->mesh->local_pm;
sinfo->peer_pm = sta->mesh->peer_pm;
sinfo->nonpeer_pm = sta->mesh->nonpeer_pm;
sinfo->connected_to_gate = sta->mesh->connected_to_gate;
sinfo->connected_to_as = sta->mesh->connected_to_as;
if (ieee80211_vif_is_mesh(&sdata->vif))
sta_set_mesh_sinfo(sta, sinfo);
#endif
}

sinfo->bss_param.flags = 0;
if (sdata->vif.bss_conf.use_cts_prot)
Expand Down Expand Up @@ -2848,12 +2860,6 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
sinfo->filled |=
BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
}

if (ieee80211_vif_is_mesh(&sdata->vif)) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_LINK_METRIC);
sinfo->airtime_link_metric =
airtime_link_metric_get(local, sta);
}
}

u32 sta_get_expected_throughput(struct sta_info *sta)
Expand Down

0 comments on commit e5328c1

Please sign in to comment.