mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
cfg80211: dynamically allocate per-tid stats for station info
With the addition of TXQ stats in the per-tid statistics the struct
station_info grew significantly. This resulted in stack size warnings
due to the structure itself being above the limit for the warnings.
Add an allocation function that those who want to provide per-tid
stats should use to allocate the tid array, i.e.
struct station_info::pertid.
Cc: Toke Høiland-Jørgensen <[email protected]>
Fixes: 52539ca89f ("cfg80211: Expose TXQ stats and parameters to userspace")
Signed-off-by: Arend van Spriel <[email protected]>
[johannes: fix missing BIT() and logic by removing]
Signed-off-by: Johannes Berg <[email protected]>
This commit is contained in:
parent
57c6cb8171
commit
8689c051a2
4 changed files with 27 additions and 6 deletions
|
|
@ -4658,7 +4658,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
|
|||
#undef PUT_SINFO
|
||||
#undef PUT_SINFO_U64
|
||||
|
||||
if (sinfo->filled & BIT(NL80211_STA_INFO_TID_STATS)) {
|
||||
if (sinfo->pertid) {
|
||||
struct nlattr *tidsattr;
|
||||
int tid;
|
||||
|
||||
|
|
@ -4702,6 +4702,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
|
|||
}
|
||||
|
||||
nla_nest_end(msg, tidsattr);
|
||||
kfree(sinfo->pertid);
|
||||
}
|
||||
|
||||
nla_nest_end(msg, sinfoattr);
|
||||
|
|
|
|||
|
|
@ -1787,6 +1787,17 @@ bool cfg80211_does_bw_fit_range(const struct ieee80211_freq_range *freq_range,
|
|||
return false;
|
||||
}
|
||||
|
||||
int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp)
|
||||
{
|
||||
sinfo->pertid = kcalloc(sizeof(*(sinfo->pertid)),
|
||||
IEEE80211_NUM_TIDS + 1, gfp);
|
||||
if (!sinfo->pertid)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cfg80211_sinfo_alloc_tid_stats);
|
||||
|
||||
/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
|
||||
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
|
||||
const unsigned char rfc1042_header[] __aligned(2) =
|
||||
|
|
|
|||
Loading…
Reference in a new issue