* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
  * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
  *     (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
+ *     Note that this doesn't use the @filled bit, but is used if non-NULL.
  * @ack_signal: signal strength (in dBm) of the last ACK frame.
  * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
  *     been sent.
        u64 rx_beacon;
        u64 rx_duration;
        u8 rx_beacon_signal_avg;
-       struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
+       struct cfg80211_tid_stats *pertid;
        s8 ack_signal;
        s8 avg_ack_signal;
 };
                                        struct ieee80211_channel *chan,
                                        gfp_t gfp);
 
+/**
+ * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
+ *
+ * @sinfo: the station information
+ * @gfp: allocation flags
+ */
+int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
 
 /**
  * cfg80211_new_sta - notify userspace about station
 
                        sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
        }
 
-       sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
-       for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
-               struct cfg80211_tid_stats *tidstats = &sinfo->pertid[i];
+       if (!cfg80211_sinfo_alloc_tid_stats(sinfo, GFP_KERNEL)) {
+               for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
+                       struct cfg80211_tid_stats *tidstats = &sinfo->pertid[i];
 
-               sta_set_tidstats(sta, tidstats, i);
+                       sta_set_tidstats(sta, tidstats, i);
+               }
        }
 
        if (ieee80211_vif_is_mesh(&sdata->vif)) {
 
 #undef PUT_SINFO
 #undef PUT_SINFO_U64
 
-       if (sinfo->filled & BIT(NL80211_STA_INFO_TID_STATS)) {
+       if (sinfo->pertid) {
                struct nlattr *tidsattr;
                int tid;
 
                }
 
                nla_nest_end(msg, tidsattr);
+               kfree(sinfo->pertid);
        }
 
        nla_nest_end(msg, sinfoattr);
 
        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) =