Commit b255b72b authored by Seevalamuthu Mariappan's avatar Seevalamuthu Mariappan Committed by Johannes Berg

mac80211: Read rx_stats with perCPU pointers

Use perCPU pointers to get rx_stats in sta_set_sinfo
when RSS is enabled
Signed-off-by: default avatarSeevalamuthu Mariappan <seevalam@codeaurora.org>
Link: https://lore.kernel.org/r/1584526555-25960-1-git-send-email-seevalam@codeaurora.orgSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent dd063ffa
...@@ -2150,19 +2150,41 @@ static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) ...@@ -2150,19 +2150,41 @@ static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo)
return 0; return 0;
} }
static inline u64 sta_get_tidstats_msdu(struct ieee80211_sta_rx_stats *rxstats,
int tid)
{
unsigned int start;
u64 value;
do {
start = u64_stats_fetch_begin(&rxstats->syncp);
value = rxstats->msdu[tid];
} while (u64_stats_fetch_retry(&rxstats->syncp, start));
return value;
}
static void sta_set_tidstats(struct sta_info *sta, static void sta_set_tidstats(struct sta_info *sta,
struct cfg80211_tid_stats *tidstats, struct cfg80211_tid_stats *tidstats,
int tid) int tid)
{ {
struct ieee80211_local *local = sta->local; struct ieee80211_local *local = sta->local;
int cpu;
if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) { if (!(tidstats->filled & BIT(NL80211_TID_STATS_RX_MSDU))) {
unsigned int start; if (!ieee80211_hw_check(&local->hw, USES_RSS))
tidstats->rx_msdu +=
sta_get_tidstats_msdu(&sta->rx_stats, tid);
do { if (sta->pcpu_rx_stats) {
start = u64_stats_fetch_begin(&sta->rx_stats.syncp); for_each_possible_cpu(cpu) {
tidstats->rx_msdu = sta->rx_stats.msdu[tid]; struct ieee80211_sta_rx_stats *cpurxs;
} while (u64_stats_fetch_retry(&sta->rx_stats.syncp, start));
cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu);
tidstats->rx_msdu +=
sta_get_tidstats_msdu(cpurxs, tid);
}
}
tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU); tidstats->filled |= BIT(NL80211_TID_STATS_RX_MSDU);
} }
...@@ -2266,6 +2288,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, ...@@ -2266,6 +2288,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) | if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_RX_BYTES64) |
BIT_ULL(NL80211_STA_INFO_RX_BYTES)))) { BIT_ULL(NL80211_STA_INFO_RX_BYTES)))) {
if (!ieee80211_hw_check(&local->hw, USES_RSS))
sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats); sinfo->rx_bytes += sta_get_stats_bytes(&sta->rx_stats);
if (sta->pcpu_rx_stats) { if (sta->pcpu_rx_stats) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment