summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-03-28 05:04:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-10 14:54:10 -0400
commit54bcbc695e2ca88e1c8f05a93d38a04ac6b1aa0e (patch)
tree9de43e51ce2195f5a81fa75770417c584ef50254 /net
parenta3304b0a17495183a2270d4a25978795226597a4 (diff)
mac80211: refuse TX queue configuration on non-QoS HW
Drivers that don't support QoS also don't support setting up their ACs, catch that early. While at it, remove the input check since cfg80211 does it now. Also fix up the restart code to not try to set up the queues in this case. Finally also change the tx_conf array to have IEEE80211_NUM_ACS entries instead of # of queues since that's what it really needs. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c6
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/util.c30
3 files changed, 22 insertions, 16 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index ef40db5ab3c7..12226b7743c6 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1437,6 +1437,9 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
1437 if (!local->ops->conf_tx) 1437 if (!local->ops->conf_tx)
1438 return -EOPNOTSUPP; 1438 return -EOPNOTSUPP;
1439 1439
1440 if (local->hw.queues < IEEE80211_NUM_ACS)
1441 return -EOPNOTSUPP;
1442
1440 memset(&p, 0, sizeof(p)); 1443 memset(&p, 0, sizeof(p));
1441 p.aifs = params->aifs; 1444 p.aifs = params->aifs;
1442 p.cw_max = params->cwmax; 1445 p.cw_max = params->cwmax;
@@ -1449,9 +1452,6 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
1449 */ 1452 */
1450 p.uapsd = false; 1453 p.uapsd = false;
1451 1454
1452 if (params->ac >= local->hw.queues)
1453 return -EINVAL;
1454
1455 sdata->tx_conf[params->ac] = p; 1455 sdata->tx_conf[params->ac] = p;
1456 if (drv_conf_tx(local, sdata, params->ac, &p)) { 1456 if (drv_conf_tx(local, sdata, params->ac, &p)) {
1457 wiphy_debug(local->hw.wiphy, 1457 wiphy_debug(local->hw.wiphy,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 93b075e14d09..8e7af7cee013 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -687,7 +687,7 @@ struct ieee80211_sub_if_data {
687 __be16 control_port_protocol; 687 __be16 control_port_protocol;
688 bool control_port_no_encrypt; 688 bool control_port_no_encrypt;
689 689
690 struct ieee80211_tx_queue_params tx_conf[IEEE80211_MAX_QUEUES]; 690 struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
691 691
692 struct work_struct work; 692 struct work_struct work;
693 struct sk_buff_head skb_queue; 693 struct sk_buff_head skb_queue;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 1d4b8b7a5a33..2b62307825d4 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -769,19 +769,22 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
769{ 769{
770 struct ieee80211_local *local = sdata->local; 770 struct ieee80211_local *local = sdata->local;
771 struct ieee80211_tx_queue_params qparam; 771 struct ieee80211_tx_queue_params qparam;
772 int queue; 772 int ac;
773 bool use_11b; 773 bool use_11b;
774 int aCWmin, aCWmax; 774 int aCWmin, aCWmax;
775 775
776 if (!local->ops->conf_tx) 776 if (!local->ops->conf_tx)
777 return; 777 return;
778 778
779 if (local->hw.queues < IEEE80211_NUM_ACS)
780 return;
781
779 memset(&qparam, 0, sizeof(qparam)); 782 memset(&qparam, 0, sizeof(qparam));
780 783
781 use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) && 784 use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) &&
782 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); 785 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
783 786
784 for (queue = 0; queue < local->hw.queues; queue++) { 787 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
785 /* Set defaults according to 802.11-2007 Table 7-37 */ 788 /* Set defaults according to 802.11-2007 Table 7-37 */
786 aCWmax = 1023; 789 aCWmax = 1023;
787 if (use_11b) 790 if (use_11b)
@@ -789,7 +792,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
789 else 792 else
790 aCWmin = 15; 793 aCWmin = 15;
791 794
792 switch (queue) { 795 switch (ac) {
793 case IEEE80211_AC_BK: 796 case IEEE80211_AC_BK:
794 qparam.cw_max = aCWmax; 797 qparam.cw_max = aCWmax;
795 qparam.cw_min = aCWmin; 798 qparam.cw_min = aCWmin;
@@ -825,8 +828,8 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
825 828
826 qparam.uapsd = false; 829 qparam.uapsd = false;
827 830
828 sdata->tx_conf[queue] = qparam; 831 sdata->tx_conf[ac] = qparam;
829 drv_conf_tx(local, sdata, queue, &qparam); 832 drv_conf_tx(local, sdata, ac, &qparam);
830 } 833 }
831 834
832 /* after reinitialize QoS TX queues setting to default, 835 /* after reinitialize QoS TX queues setting to default,
@@ -1226,14 +1229,17 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1226 mutex_unlock(&local->sta_mtx); 1229 mutex_unlock(&local->sta_mtx);
1227 1230
1228 /* reconfigure tx conf */ 1231 /* reconfigure tx conf */
1229 list_for_each_entry(sdata, &local->interfaces, list) { 1232 if (hw->queues >= IEEE80211_NUM_ACS) {
1230 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN || 1233 list_for_each_entry(sdata, &local->interfaces, list) {
1231 sdata->vif.type == NL80211_IFTYPE_MONITOR || 1234 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1232 !ieee80211_sdata_running(sdata)) 1235 sdata->vif.type == NL80211_IFTYPE_MONITOR ||
1233 continue; 1236 !ieee80211_sdata_running(sdata))
1237 continue;
1234 1238
1235 for (i = 0; i < hw->queues; i++) 1239 for (i = 0; i < IEEE80211_NUM_ACS; i++)
1236 drv_conf_tx(local, sdata, i, &sdata->tx_conf[i]); 1240 drv_conf_tx(local, sdata, i,
1241 &sdata->tx_conf[i]);
1242 }
1237 } 1243 }
1238 1244
1239 /* reconfigure hardware */ 1245 /* reconfigure hardware */