|
20 | 20 | #include <linux/timer.h> |
21 | 21 | #include <linux/rtnetlink.h> |
22 | 22 |
|
| 23 | +#include <net/codel.h> |
23 | 24 | #include <net/mac80211.h> |
24 | 25 | #include "ieee80211_i.h" |
25 | 26 | #include "driver-ops.h" |
@@ -425,6 +426,11 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, |
425 | 426 |
|
426 | 427 | sta->sta.max_rc_amsdu_len = IEEE80211_MAX_MPDU_LEN_HT_BA; |
427 | 428 |
|
| 429 | + sta->cparams.ce_threshold = CODEL_DISABLED_THRESHOLD; |
| 430 | + sta->cparams.target = MS2TIME(20); |
| 431 | + sta->cparams.interval = MS2TIME(100); |
| 432 | + sta->cparams.ecn = true; |
| 433 | + |
428 | 434 | sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr); |
429 | 435 |
|
430 | 436 | return sta; |
@@ -2310,3 +2316,27 @@ unsigned long ieee80211_sta_last_active(struct sta_info *sta) |
2310 | 2316 | return stats->last_rx; |
2311 | 2317 | return sta->status_stats.last_ack; |
2312 | 2318 | } |
| 2319 | + |
| 2320 | +static void sta_update_codel_params(struct sta_info *sta, u32 thr) |
| 2321 | +{ |
| 2322 | + if (!sta->sdata->local->ops->wake_tx_queue) |
| 2323 | + return; |
| 2324 | + |
| 2325 | + if (thr && thr < STA_SLOW_THRESHOLD * sta->local->num_sta) { |
| 2326 | + sta->cparams.target = MS2TIME(50); |
| 2327 | + sta->cparams.interval = MS2TIME(300); |
| 2328 | + sta->cparams.ecn = false; |
| 2329 | + } else { |
| 2330 | + sta->cparams.target = MS2TIME(20); |
| 2331 | + sta->cparams.interval = MS2TIME(100); |
| 2332 | + sta->cparams.ecn = true; |
| 2333 | + } |
| 2334 | +} |
| 2335 | + |
| 2336 | +void ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta, |
| 2337 | + u32 thr) |
| 2338 | +{ |
| 2339 | + struct sta_info *sta = container_of(pubsta, struct sta_info, sta); |
| 2340 | + |
| 2341 | + sta_update_codel_params(sta, thr); |
| 2342 | +} |
0 commit comments