]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/mac80211/sta_info.c
Merge tag 'mac80211-next-for-davem-2017-06-13' of git://git.kernel.org/pub/scm/linux...
[karo-tx-linux.git] / net / mac80211 / sta_info.c
index 7cdf7a835bb01e8fade3b9d9bb6efaa19158f72b..46e1809356f63ab7f6cac1935bc6e4f044d9d729 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/timer.h>
 #include <linux/rtnetlink.h>
 
+#include <net/codel.h>
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
 #include "driver-ops.h"
@@ -425,6 +426,11 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
 
        sta->sta.max_rc_amsdu_len = IEEE80211_MAX_MPDU_LEN_HT_BA;
 
+       sta->cparams.ce_threshold = CODEL_DISABLED_THRESHOLD;
+       sta->cparams.target = MS2TIME(20);
+       sta->cparams.interval = MS2TIME(100);
+       sta->cparams.ecn = true;
+
        sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
 
        return sta;
@@ -2155,7 +2161,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
                        struct ieee80211_sta_rx_stats *cpurxs;
 
                        cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu);
-                       sinfo->rx_packets += cpurxs->dropped;
+                       sinfo->rx_dropped_misc += cpurxs->dropped;
                }
        }
 
@@ -2310,3 +2316,27 @@ unsigned long ieee80211_sta_last_active(struct sta_info *sta)
                return stats->last_rx;
        return sta->status_stats.last_ack;
 }
+
+static void sta_update_codel_params(struct sta_info *sta, u32 thr)
+{
+       if (!sta->sdata->local->ops->wake_tx_queue)
+               return;
+
+       if (thr && thr < STA_SLOW_THRESHOLD * sta->local->num_sta) {
+               sta->cparams.target = MS2TIME(50);
+               sta->cparams.interval = MS2TIME(300);
+               sta->cparams.ecn = false;
+       } else {
+               sta->cparams.target = MS2TIME(20);
+               sta->cparams.interval = MS2TIME(100);
+               sta->cparams.ecn = true;
+       }
+}
+
+void ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta,
+                                          u32 thr)
+{
+       struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
+
+       sta_update_codel_params(sta, thr);
+}