linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 3/7] mac80211: refuse TX queue configuration on non-QoS HW
Date: Wed, 28 Mar 2012 11:04:25 +0200	[thread overview]
Message-ID: <20120328090432.574661500@sipsolutions.net> (raw)
In-Reply-To: 20120328090422.367469100@sipsolutions.net

From: Johannes Berg <johannes.berg@intel.com>

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>
---
 net/mac80211/cfg.c         |    6 +++---
 net/mac80211/ieee80211_i.h |    2 +-
 net/mac80211/util.c        |   32 +++++++++++++++++++-------------
 3 files changed, 23 insertions(+), 17 deletions(-)

--- a/net/mac80211/cfg.c	2012-03-27 14:10:27.000000000 +0200
+++ b/net/mac80211/cfg.c	2012-03-27 14:10:27.000000000 +0200
@@ -1437,6 +1437,9 @@ static int ieee80211_set_txq_params(stru
 	if (!local->ops->conf_tx)
 		return -EOPNOTSUPP;
 
+	if (local->hw.queues < IEEE80211_NUM_ACS)
+		return -EOPNOTSUPP;
+
 	memset(&p, 0, sizeof(p));
 	p.aifs = params->aifs;
 	p.cw_max = params->cwmax;
@@ -1449,9 +1452,6 @@ static int ieee80211_set_txq_params(stru
 	 */
 	p.uapsd = false;
 
-	if (params->ac >= local->hw.queues)
-		return -EINVAL;
-
 	sdata->tx_conf[params->ac] = p;
 	if (drv_conf_tx(local, sdata, params->ac, &p)) {
 		wiphy_debug(local->hw.wiphy,
--- a/net/mac80211/util.c	2012-03-27 14:09:46.000000000 +0200
+++ b/net/mac80211/util.c	2012-03-27 14:10:27.000000000 +0200
@@ -769,19 +769,22 @@ void ieee80211_set_wmm_default(struct ie
 {
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_tx_queue_params qparam;
-	int queue;
+	int ac;
 	bool use_11b;
 	int aCWmin, aCWmax;
 
 	if (!local->ops->conf_tx)
 		return;
 
+	if (local->hw.queues < IEEE80211_NUM_ACS)
+		return;
+
 	memset(&qparam, 0, sizeof(qparam));
 
 	use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) &&
 		 !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE);
 
-	for (queue = 0; queue < local->hw.queues; queue++) {
+	for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
 		/* Set defaults according to 802.11-2007 Table 7-37 */
 		aCWmax = 1023;
 		if (use_11b)
@@ -789,7 +792,7 @@ void ieee80211_set_wmm_default(struct ie
 		else
 			aCWmin = 15;
 
-		switch (queue) {
+		switch (ac) {
 		case IEEE80211_AC_BK:
 			qparam.cw_max = aCWmax;
 			qparam.cw_min = aCWmin;
@@ -825,8 +828,8 @@ void ieee80211_set_wmm_default(struct ie
 
 		qparam.uapsd = false;
 
-		sdata->tx_conf[queue] = qparam;
-		drv_conf_tx(local, sdata, queue, &qparam);
+		sdata->tx_conf[ac] = qparam;
+		drv_conf_tx(local, sdata, ac, &qparam);
 	}
 
 	/* after reinitialize QoS TX queues setting to default,
@@ -1226,14 +1229,17 @@ int ieee80211_reconfig(struct ieee80211_
 	mutex_unlock(&local->sta_mtx);
 
 	/* reconfigure tx conf */
-	list_for_each_entry(sdata, &local->interfaces, list) {
-		if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
-		    sdata->vif.type == NL80211_IFTYPE_MONITOR ||
-		    !ieee80211_sdata_running(sdata))
-			continue;
-
-		for (i = 0; i < hw->queues; i++)
-			drv_conf_tx(local, sdata, i, &sdata->tx_conf[i]);
+	if (hw->queues >= IEEE80211_NUM_ACS) {
+		list_for_each_entry(sdata, &local->interfaces, list) {
+			if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
+			    sdata->vif.type == NL80211_IFTYPE_MONITOR ||
+			    !ieee80211_sdata_running(sdata))
+				continue;
+
+			for (i = 0; i < IEEE80211_NUM_ACS; i++)
+				drv_conf_tx(local, sdata, i,
+					    &sdata->tx_conf[i]);
+		}
 	}
 
 	/* reconfigure hardware */
--- a/net/mac80211/ieee80211_i.h	2012-03-27 14:10:27.000000000 +0200
+++ b/net/mac80211/ieee80211_i.h	2012-03-27 14:10:34.000000000 +0200
@@ -687,7 +687,7 @@ struct ieee80211_sub_if_data {
 	__be16 control_port_protocol;
 	bool control_port_no_encrypt;
 
-	struct ieee80211_tx_queue_params tx_conf[IEEE80211_MAX_QUEUES];
+	struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
 
 	struct work_struct work;
 	struct sk_buff_head skb_queue;



  parent reply	other threads:[~2012-03-28  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-28  9:04 [PATCH 0/7] mac80211 queue rework preparations Johannes Berg
2012-03-28  9:04 ` [PATCH 1/7] mac80211: remove antenna_sel_tx TX info field Johannes Berg
2012-03-28  9:04 ` [PATCH 2/7] cfg80211/nl80211: clarify TX queue API Johannes Berg
2012-03-28  9:04 ` Johannes Berg [this message]
2012-03-28  9:04 ` [PATCH 4/7] mac80211: decouple # of netdev queues from HW queues Johannes Berg
2012-03-28  9:04 ` [PATCH 5/7] mac80211: debounce queue stop/wake Johannes Berg
2012-03-28  9:04 ` [PATCH 6/7] mac80211: lazily stop queues in add_pending Johannes Berg
2012-03-28  9:04 ` [PATCH 7/7] mac80211: use IEEE80211_NUM_ACS Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120328090432.574661500@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).