diff options
author | Toke Høiland-Jørgensen <toke@toke.dk> | 2016-09-23 22:59:11 +0300 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2016-09-30 14:33:33 +0300 |
commit | 3ff23cd5654b9c8f4d567caa73439b4c39fbeaae (patch) | |
tree | 7c7317b0aa529c0fce09c9322bc2d124253740a7 /net/mac80211/tx.c | |
parent | 2a4e675d887bb3130354561a70f05127de8b9926 (diff) | |
download | linux-3ff23cd5654b9c8f4d567caa73439b4c39fbeaae.tar.xz |
mac80211: Set lower memory limit for non-VHT devices
Small devices can run out of memory from queueing too many packets. If
VHT is not supported by the PHY, having more than 4 MBytes of total
queue in the TXQ intermediate queues is not needed, and so we can safely
limit the memory usage in these cases and avoid OOM.
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index e8c996463b11..378a7a6b6dbe 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1433,6 +1433,8 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local) struct fq *fq = &local->fq; int ret; int i; + bool supp_vht = false; + enum nl80211_band band; if (!local->ops->wake_tx_queue) return 0; @@ -1441,6 +1443,23 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local) if (ret) return ret; + /* + * If the hardware doesn't support VHT, it is safe to limit the maximum + * queue size. 4 Mbytes is 64 max-size aggregates in 802.11n. + */ + for (band = 0; band < NUM_NL80211_BANDS; band++) { + struct ieee80211_supported_band *sband; + + sband = local->hw.wiphy->bands[band]; + if (!sband) + continue; + + supp_vht = supp_vht || sband->vht_cap.vht_supported; + } + + if (!supp_vht) + fq->memory_limit = 4 << 20; /* 4 Mbytes */ + codel_params_init(&local->cparams); local->cparams.interval = MS2TIME(100); local->cparams.target = MS2TIME(20); |