|
@@ -5,6 +5,7 @@
|
|
|
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
|
|
|
* Copyright 2013-2014 Intel Mobile Communications GmbH
|
|
|
* Copyright (C) 2015-2017 Intel Deutschland GmbH
|
|
|
+ * Copyright (C) 2018 Intel Corporation
|
|
|
*
|
|
|
* 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
|
|
@@ -1113,6 +1114,48 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
|
|
|
return crc;
|
|
|
}
|
|
|
|
|
|
+void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
|
|
|
+ struct ieee80211_tx_queue_params
|
|
|
+ *qparam, int ac)
|
|
|
+{
|
|
|
+ struct ieee80211_chanctx_conf *chanctx_conf;
|
|
|
+ const struct ieee80211_reg_rule *rrule;
|
|
|
+ struct ieee80211_wmm_ac *wmm_ac;
|
|
|
+ u16 center_freq = 0;
|
|
|
+
|
|
|
+ if (sdata->vif.type != NL80211_IFTYPE_AP &&
|
|
|
+ sdata->vif.type != NL80211_IFTYPE_STATION)
|
|
|
+ return;
|
|
|
+
|
|
|
+ rcu_read_lock();
|
|
|
+ chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
|
|
|
+ if (chanctx_conf)
|
|
|
+ center_freq = chanctx_conf->def.chan->center_freq;
|
|
|
+
|
|
|
+ if (!center_freq) {
|
|
|
+ rcu_read_unlock();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq));
|
|
|
+
|
|
|
+ if (IS_ERR_OR_NULL(rrule) || !rrule->wmm_rule) {
|
|
|
+ rcu_read_unlock();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sdata->vif.type == NL80211_IFTYPE_AP)
|
|
|
+ wmm_ac = &rrule->wmm_rule->ap[ac];
|
|
|
+ else
|
|
|
+ wmm_ac = &rrule->wmm_rule->client[ac];
|
|
|
+ qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min);
|
|
|
+ qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max);
|
|
|
+ qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn);
|
|
|
+ qparam->txop = !qparam->txop ? wmm_ac->cot / 32 :
|
|
|
+ min_t(u16, qparam->txop, wmm_ac->cot / 32);
|
|
|
+ rcu_read_unlock();
|
|
|
+}
|
|
|
+
|
|
|
void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
|
|
|
bool bss_notify, bool enable_qos)
|
|
|
{
|
|
@@ -1206,6 +1249,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ ieee80211_regulatory_limit_wmm_params(sdata, &qparam, ac);
|
|
|
|
|
|
qparam.uapsd = false;
|
|
|
|