]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/mac80211/sta_info.h
mac80211: add the action to the drv_ampdu_action tracepoint
[karo-tx-linux.git] / net / mac80211 / sta_info.h
index e65cda34d2bc000fb7e3738a6235ba5d53b8fde6..3acbdfa9f649f4832f01b70360d379272cd3258b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2002-2005, Devicescape Software, Inc.
  * Copyright 2013-2014  Intel Mobile Communications GmbH
- * Copyright(c) 2015-2016 Intel Deutschland GmbH
+ * Copyright(c) 2015-2017 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -16,6 +16,7 @@
 #include <linux/if_ether.h>
 #include <linux/workqueue.h>
 #include <linux/average.h>
+#include <linux/bitfield.h>
 #include <linux/etherdevice.h>
 #include <linux/rhashtable.h>
 #include <linux/u64_stats_sync.h>
@@ -115,6 +116,8 @@ enum ieee80211_sta_info_flags {
 #define HT_AGG_STATE_STOPPING          3
 #define HT_AGG_STATE_WANT_START                4
 #define HT_AGG_STATE_WANT_STOP         5
+#define HT_AGG_STATE_START_CB          6
+#define HT_AGG_STATE_STOP_CB           7
 
 enum ieee80211_agg_stop_reason {
        AGG_STOP_DECLINED,
@@ -230,6 +233,8 @@ struct tid_ampdu_rx {
  *     RX timer expired until the work for it runs
  * @tid_rx_stop_requested:  bitmap indicating which BA sessions per TID the
  *     driver requested to close until the work for it runs
+ * @tid_rx_manage_offl: bitmap indicating which BA sessions were requested
+ *     to be treated as started/stopped due to offloading
  * @agg_session_valid: bitmap indicating which TID has a rx BA session open on
  * @unexpected_agg: bitmap indicating which TID already sent a delBA due to
  *     unexpected aggregation related frames outside a session
@@ -247,6 +252,7 @@ struct sta_ampdu_mlme {
        u8 tid_rx_token[IEEE80211_NUM_TIDS];
        unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
        unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
+       unsigned long tid_rx_manage_offl[BITS_TO_LONGS(2 * IEEE80211_NUM_TIDS)];
        unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
        unsigned long unexpected_agg[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
        /* tx */
@@ -324,6 +330,9 @@ struct ieee80211_fast_rx {
        struct rcu_head rcu_head;
 };
 
+/* we use only values in the range 0-100, so pick a large precision */
+DECLARE_EWMA(mesh_fail_avg, 20, 8)
+
 /**
  * struct mesh_sta - mesh STA information
  * @plink_lock: serialize access to plink fields
@@ -369,7 +378,7 @@ struct mesh_sta {
        enum nl80211_mesh_power_mode nonpeer_pm;
 
        /* moving percentage of failed MSDUs */
-       unsigned int fail_avg;
+       struct ewma_mesh_fail_avg fail_avg;
 };
 
 DECLARE_EWMA(signal, 10, 8)
@@ -389,6 +398,14 @@ struct ieee80211_sta_rx_stats {
        u64 msdu[IEEE80211_NUM_TIDS + 1];
 };
 
+/**
+ * The bandwidth threshold below which the per-station CoDel parameters will be
+ * scaled to be more lenient (to prevent starvation of slow stations). This
+ * value will be scaled by the number of active stations when it is being
+ * applied.
+ */
+#define STA_SLOW_THRESHOLD 6000 /* 6 Mbps */
+
 /**
  * struct sta_info - STA information
  *
@@ -442,6 +459,7 @@ struct ieee80211_sta_rx_stats {
  * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for
  *     AP only.
  * @cipher_scheme: optional cipher scheme for this station
+ * @cparams: CoDel parameters for this station.
  * @reserved_tid: reserved TID (if any, otherwise IEEE80211_TID_UNRESERVED)
  * @fast_tx: TX fastpath information
  * @fast_rx: RX fastpath information
@@ -545,6 +563,8 @@ struct sta_info {
        enum ieee80211_smps_mode known_smps_mode;
        const struct ieee80211_cipher_scheme *cipher_scheme;
 
+       struct codel_params cparams;
+
        u8 reserved_tid;
 
        struct cfg80211_chan_def tdls_chandef;
@@ -724,40 +744,55 @@ void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta);
 
 unsigned long ieee80211_sta_last_active(struct sta_info *sta);
 
+enum sta_stats_type {
+       STA_STATS_RATE_TYPE_INVALID = 0,
+       STA_STATS_RATE_TYPE_LEGACY,
+       STA_STATS_RATE_TYPE_HT,
+       STA_STATS_RATE_TYPE_VHT,
+};
+
+#define STA_STATS_FIELD_HT_MCS         GENMASK( 7,  0)
+#define STA_STATS_FIELD_LEGACY_IDX     GENMASK( 3,  0)
+#define STA_STATS_FIELD_LEGACY_BAND    GENMASK( 7,  4)
+#define STA_STATS_FIELD_VHT_MCS                GENMASK( 3,  0)
+#define STA_STATS_FIELD_VHT_NSS                GENMASK( 7,  4)
+#define STA_STATS_FIELD_BW             GENMASK(11,  8)
+#define STA_STATS_FIELD_SGI            GENMASK(12, 12)
+#define STA_STATS_FIELD_TYPE           GENMASK(15, 13)
+
+#define STA_STATS_FIELD(_n, _v)                FIELD_PREP(STA_STATS_FIELD_ ## _n, _v)
+#define STA_STATS_GET(_n, _v)          FIELD_GET(STA_STATS_FIELD_ ## _n, _v)
+
 #define STA_STATS_RATE_INVALID         0
-#define STA_STATS_RATE_VHT             0x8000
-#define STA_STATS_RATE_HT              0x4000
-#define STA_STATS_RATE_LEGACY          0x2000
-#define STA_STATS_RATE_SGI             0x1000
-#define STA_STATS_RATE_BW_SHIFT                9
-#define STA_STATS_RATE_BW_MASK         (0x7 << STA_STATS_RATE_BW_SHIFT)
-
-static inline u16 sta_stats_encode_rate(struct ieee80211_rx_status *s)
+
+static inline u32 sta_stats_encode_rate(struct ieee80211_rx_status *s)
 {
-       u16 r = s->rate_idx;
-
-       if (s->vht_flag & RX_VHT_FLAG_80MHZ)
-               r |= RATE_INFO_BW_80 << STA_STATS_RATE_BW_SHIFT;
-       else if (s->vht_flag & RX_VHT_FLAG_160MHZ)
-               r |= RATE_INFO_BW_160 << STA_STATS_RATE_BW_SHIFT;
-       else if (s->flag & RX_FLAG_40MHZ)
-               r |= RATE_INFO_BW_40 << STA_STATS_RATE_BW_SHIFT;
-       else if (s->flag & RX_FLAG_10MHZ)
-               r |= RATE_INFO_BW_10 << STA_STATS_RATE_BW_SHIFT;
-       else if (s->flag & RX_FLAG_5MHZ)
-               r |= RATE_INFO_BW_5 << STA_STATS_RATE_BW_SHIFT;
-       else
-               r |= RATE_INFO_BW_20 << STA_STATS_RATE_BW_SHIFT;
-
-       if (s->flag & RX_FLAG_SHORT_GI)
-               r |= STA_STATS_RATE_SGI;
-
-       if (s->flag & RX_FLAG_VHT)
-               r |= STA_STATS_RATE_VHT | (s->vht_nss << 4);
-       else if (s->flag & RX_FLAG_HT)
-               r |= STA_STATS_RATE_HT;
-       else
-               r |= STA_STATS_RATE_LEGACY | (s->band << 4);
+       u16 r;
+
+       r = STA_STATS_FIELD(BW, s->bw);
+
+       if (s->enc_flags & RX_ENC_FLAG_SHORT_GI)
+               r |= STA_STATS_FIELD(SGI, 1);
+
+       switch (s->encoding) {
+       case RX_ENC_VHT:
+               r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_VHT);
+               r |= STA_STATS_FIELD(VHT_NSS, s->nss);
+               r |= STA_STATS_FIELD(VHT_MCS, s->rate_idx);
+               break;
+       case RX_ENC_HT:
+               r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_HT);
+               r |= STA_STATS_FIELD(HT_MCS, s->rate_idx);
+               break;
+       case RX_ENC_LEGACY:
+               r |= STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_LEGACY);
+               r |= STA_STATS_FIELD(LEGACY_BAND, s->band);
+               r |= STA_STATS_FIELD(LEGACY_IDX, s->rate_idx);
+               break;
+       default:
+               WARN_ON(1);
+               return STA_STATS_RATE_INVALID;
+       }
 
        return r;
 }