aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/b43/main.c3
-rw-r--r--drivers/net/wireless/b43legacy/main.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c2
-rw-r--r--drivers/net/wireless/p54/p54common.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c5
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h7
-rw-r--r--include/net/mac80211.h66
-rw-r--r--net/mac80211/debugfs.c43
-rw-r--r--net/mac80211/debugfs_sta.c38
-rw-r--r--net/mac80211/ieee80211_i.h8
-rw-r--r--net/mac80211/main.c5
-rw-r--r--net/mac80211/mlme.c23
-rw-r--r--net/mac80211/rx.c5
-rw-r--r--net/mac80211/sta_info.c2
-rw-r--r--net/mac80211/wme.c120
19 files changed, 100 insertions, 240 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index cf546e367d3e..c6e79a15d3cb 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2996,8 +2996,7 @@ static void b43_qos_update_work(struct work_struct *work)
2996 mutex_unlock(&wl->mutex); 2996 mutex_unlock(&wl->mutex);
2997} 2997}
2998 2998
2999static int b43_op_conf_tx(struct ieee80211_hw *hw, 2999static int b43_op_conf_tx(struct ieee80211_hw *hw, u16 _queue,
3000 int _queue,
3001 const struct ieee80211_tx_queue_params *params) 3000 const struct ieee80211_tx_queue_params *params)
3002{ 3001{
3003 struct b43_wl *wl = hw_to_b43_wl(hw); 3002 struct b43_wl *wl = hw_to_b43_wl(hw);
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 14a5eea2573e..1ccc51e90a8e 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2383,8 +2383,7 @@ out:
2383 return NETDEV_TX_OK; 2383 return NETDEV_TX_OK;
2384} 2384}
2385 2385
2386static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, 2386static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, u16 queue,
2387 int queue,
2388 const struct ieee80211_tx_queue_params *params) 2387 const struct ieee80211_tx_queue_params *params)
2389{ 2388{
2390 return 0; 2389 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 27e5f496bc12..c4b5c1a100f2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -568,7 +568,7 @@ static void iwlcore_init_hw(struct iwl_priv *priv)
568 hw->queues = 4; 568 hw->queues = 4;
569#ifdef CONFIG_IWL4965_HT 569#ifdef CONFIG_IWL4965_HT
570 /* Enhanced value; more queues, to support 11n aggregation */ 570 /* Enhanced value; more queues, to support 11n aggregation */
571 hw->queues = 16; 571 hw->ampdu_queues = 12;
572#endif /* CONFIG_IWL4965_HT */ 572#endif /* CONFIG_IWL4965_HT */
573} 573}
574 574
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index bad367cfbee3..7040cde8bc28 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -7143,7 +7143,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7143 return rc; 7143 return rc;
7144} 7144}
7145 7145
7146static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, int queue, 7146static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
7147 const struct ieee80211_tx_queue_params *params) 7147 const struct ieee80211_tx_queue_params *params)
7148{ 7148{
7149 struct iwl3945_priv *priv = hw->priv; 7149 struct iwl3945_priv *priv = hw->priv;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 5363be7a305e..4406fc72d881 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6339,7 +6339,7 @@ static int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
6339 return ret; 6339 return ret;
6340} 6340}
6341 6341
6342static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, int queue, 6342static int iwl4965_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
6343 const struct ieee80211_tx_queue_params *params) 6343 const struct ieee80211_tx_queue_params *params)
6344{ 6344{
6345 struct iwl_priv *priv = hw->priv; 6345 struct iwl_priv *priv = hw->priv;
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 59a26978f877..34b91ccd8aec 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -935,7 +935,7 @@ static void p54_configure_filter(struct ieee80211_hw *dev,
935 } 935 }
936} 936}
937 937
938static int p54_conf_tx(struct ieee80211_hw *dev, int queue, 938static int p54_conf_tx(struct ieee80211_hw *dev, u16 queue,
939 const struct ieee80211_tx_queue_params *params) 939 const struct ieee80211_tx_queue_params *params)
940{ 940{
941 struct p54_common *priv = dev->priv; 941 struct p54_common *priv = dev->priv;
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 705bc2d41dc1..247fbbfb0f2b 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1442,8 +1442,7 @@ static int rt2400pci_set_retry_limit(struct ieee80211_hw *hw,
1442 return 0; 1442 return 0;
1443} 1443}
1444 1444
1445static int rt2400pci_conf_tx(struct ieee80211_hw *hw, 1445static int rt2400pci_conf_tx(struct ieee80211_hw *hw, u16 queue,
1446 int queue,
1447 const struct ieee80211_tx_queue_params *params) 1446 const struct ieee80211_tx_queue_params *params)
1448{ 1447{
1449 struct rt2x00_dev *rt2x00dev = hw->priv; 1448 struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -1453,7 +1452,7 @@ static int rt2400pci_conf_tx(struct ieee80211_hw *hw,
1453 * per queue. So by default we only configure the TX queue, 1452 * per queue. So by default we only configure the TX queue,
1454 * and ignore all other configurations. 1453 * and ignore all other configurations.
1455 */ 1454 */
1456 if (queue != IEEE80211_TX_QUEUE_DATA0) 1455 if (queue != 0)
1457 return -EINVAL; 1456 return -EINVAL;
1458 1457
1459 if (rt2x00mac_conf_tx(hw, queue, params)) 1458 if (rt2x00mac_conf_tx(hw, queue, params))
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 48a9af47921e..79bd9c9f8963 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -997,7 +997,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
997 struct ieee80211_vif *vif, 997 struct ieee80211_vif *vif,
998 struct ieee80211_bss_conf *bss_conf, 998 struct ieee80211_bss_conf *bss_conf,
999 u32 changes); 999 u32 changes);
1000int rt2x00mac_conf_tx(struct ieee80211_hw *hw, int queue, 1000int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
1001 const struct ieee80211_tx_queue_params *params); 1001 const struct ieee80211_tx_queue_params *params);
1002 1002
1003/* 1003/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 7bc5129484f2..767e0ffce04e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -517,7 +517,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
517} 517}
518EXPORT_SYMBOL_GPL(rt2x00mac_bss_info_changed); 518EXPORT_SYMBOL_GPL(rt2x00mac_bss_info_changed);
519 519
520int rt2x00mac_conf_tx(struct ieee80211_hw *hw, int queue_idx, 520int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
521 const struct ieee80211_tx_queue_params *params) 521 const struct ieee80211_tx_queue_params *params)
522{ 522{
523 struct rt2x00_dev *rt2x00dev = hw->priv; 523 struct rt2x00_dev *rt2x00dev = hw->priv;
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 29fe26525550..d1707a7ca41f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -86,12 +86,9 @@ enum data_queue_qid {
86static inline enum data_queue_qid mac80211_queue_to_qid(unsigned int queue) 86static inline enum data_queue_qid mac80211_queue_to_qid(unsigned int queue)
87{ 87{
88 /* Regular TX queues are mapped directly */ 88 /* Regular TX queues are mapped directly */
89 if (queue < NUM_TX_DATA_QUEUES) 89 if (queue < 4)
90 return queue; 90 return queue;
91 else if (queue == IEEE80211_TX_QUEUE_BEACON) 91 WARN_ON(1);
92 return QID_BEACON;
93 else if (queue == IEEE80211_TX_QUEUE_AFTER_BEACON)
94 return QID_ATIM;
95 return QID_OTHER; 92 return QID_OTHER;
96} 93}
97 94
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ef701d6fd66a..75a34609eed7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -98,6 +98,18 @@ struct ieee80211_ht_bss_info {
98}; 98};
99 99
100/** 100/**
101 * enum ieee80211_max_queues - maximum number of queues
102 *
103 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
104 * @IEEE80211_MAX_AMPDU_QUEUES: Maximum number of queues usable
105 * for A-MPDU operation.
106 */
107enum ieee80211_max_queues {
108 IEEE80211_MAX_QUEUES = 16,
109 IEEE80211_MAX_AMPDU_QUEUES = 16,
110};
111
112/**
101 * struct ieee80211_tx_queue_params - transmit queue configuration 113 * struct ieee80211_tx_queue_params - transmit queue configuration
102 * 114 *
103 * The information provided in this structure is required for QoS 115 * The information provided in this structure is required for QoS
@@ -129,42 +141,6 @@ struct ieee80211_tx_queue_stats {
129 unsigned int count; 141 unsigned int count;
130}; 142};
131 143
132/**
133 * enum ieee80211_tx_queue - transmit queue number
134 *
135 * These constants are used with some callbacks that take a
136 * queue number to set parameters for a queue.
137 *
138 * @IEEE80211_TX_QUEUE_DATA0: data queue 0
139 * @IEEE80211_TX_QUEUE_DATA1: data queue 1
140 * @IEEE80211_TX_QUEUE_DATA2: data queue 2
141 * @IEEE80211_TX_QUEUE_DATA3: data queue 3
142 * @IEEE80211_TX_QUEUE_DATA4: data queue 4
143 * @IEEE80211_TX_QUEUE_SVP: ??
144 * @NUM_TX_DATA_QUEUES: number of data queues
145 * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be
146 * sent after a beacon
147 * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames
148 * @NUM_TX_DATA_QUEUES_AMPDU: adding more queues for A-MPDU
149 */
150enum ieee80211_tx_queue {
151 IEEE80211_TX_QUEUE_DATA0,
152 IEEE80211_TX_QUEUE_DATA1,
153 IEEE80211_TX_QUEUE_DATA2,
154 IEEE80211_TX_QUEUE_DATA3,
155 IEEE80211_TX_QUEUE_DATA4,
156 IEEE80211_TX_QUEUE_SVP,
157
158 NUM_TX_DATA_QUEUES,
159
160/* due to stupidity in the sub-ioctl userspace interface, the items in
161 * this struct need to have fixed values. As soon as it is removed, we can
162 * fix these entries. */
163 IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
164 IEEE80211_TX_QUEUE_BEACON = 7,
165 NUM_TX_DATA_QUEUES_AMPDU = 16
166};
167
168struct ieee80211_low_level_stats { 144struct ieee80211_low_level_stats {
169 unsigned int dot11ACKFailureCount; 145 unsigned int dot11ACKFailureCount;
170 unsigned int dot11RTSFailureCount; 146 unsigned int dot11RTSFailureCount;
@@ -315,7 +291,7 @@ struct ieee80211_tx_control {
315 * position represents antenna number used */ 291 * position represents antenna number used */
316 u8 icv_len; /* length of the ICV/MIC field in octets */ 292 u8 icv_len; /* length of the ICV/MIC field in octets */
317 u8 iv_len; /* length of the IV field in octets */ 293 u8 iv_len; /* length of the IV field in octets */
318 u8 queue; /* hardware queue to use for this frame; 294 u16 queue; /* hardware queue to use for this frame;
319 * 0 = highest, hw->queues-1 = lowest */ 295 * 0 = highest, hw->queues-1 = lowest */
320 u16 aid; /* Station AID */ 296 u16 aid; /* Station AID */
321 int type; /* internal */ 297 int type; /* internal */
@@ -772,7 +748,14 @@ enum ieee80211_hw_flags {
772 * @max_noise: like @max_rssi, but for the noise value. 748 * @max_noise: like @max_rssi, but for the noise value.
773 * 749 *
774 * @queues: number of available hardware transmit queues for 750 * @queues: number of available hardware transmit queues for
775 * data packets. WMM/QoS requires at least four. 751 * data packets. WMM/QoS requires at least four, these
752 * queues need to have configurable access parameters.
753 *
754 * @ampdu_queues: number of available hardware transmit queues
755 * for A-MPDU packets, these have no access parameters
756 * because they're used only for A-MPDU frames. Note that
757 * mac80211 will not currently use any of the regular queues
758 * for aggregation.
776 * 759 *
777 * @rate_control_algorithm: rate control algorithm for this hardware. 760 * @rate_control_algorithm: rate control algorithm for this hardware.
778 * If unset (NULL), the default algorithm will be used. Must be 761 * If unset (NULL), the default algorithm will be used. Must be
@@ -791,7 +774,7 @@ struct ieee80211_hw {
791 unsigned int extra_tx_headroom; 774 unsigned int extra_tx_headroom;
792 int channel_change_time; 775 int channel_change_time;
793 int vif_data_size; 776 int vif_data_size;
794 u8 queues; 777 u16 queues, ampdu_queues;
795 s8 max_rssi; 778 s8 max_rssi;
796 s8 max_signal; 779 s8 max_signal;
797 s8 max_noise; 780 s8 max_noise;
@@ -1069,8 +1052,7 @@ enum ieee80211_ampdu_mlme_action {
1069 * of assocaited station or AP. 1052 * of assocaited station or AP.
1070 * 1053 *
1071 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1054 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1072 * bursting) for a hardware TX queue. The @queue parameter uses the 1055 * bursting) for a hardware TX queue. Must be atomic.
1073 * %IEEE80211_TX_QUEUE_* constants. Must be atomic.
1074 * 1056 *
1075 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1057 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1076 * to get number of currently queued packets (queue length), maximum queue 1058 * to get number of currently queued packets (queue length), maximum queue
@@ -1150,7 +1132,7 @@ struct ieee80211_ops {
1150 u32 short_retry, u32 long_retr); 1132 u32 short_retry, u32 long_retr);
1151 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1133 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1152 enum sta_notify_cmd, const u8 *addr); 1134 enum sta_notify_cmd, const u8 *addr);
1153 int (*conf_tx)(struct ieee80211_hw *hw, int queue, 1135 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1154 const struct ieee80211_tx_queue_params *params); 1136 const struct ieee80211_tx_queue_params *params);
1155 int (*get_tx_stats)(struct ieee80211_hw *hw, 1137 int (*get_tx_stats)(struct ieee80211_hw *hw,
1156 struct ieee80211_tx_queue_stats *stats); 1138 struct ieee80211_tx_queue_stats *stats);
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 1cccbfd781f6..d20d90eead1f 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -197,45 +197,6 @@ DEBUGFS_STATS_FILE(rx_handlers_fragments, 20, "%u",
197DEBUGFS_STATS_FILE(tx_status_drop, 20, "%u", 197DEBUGFS_STATS_FILE(tx_status_drop, 20, "%u",
198 local->tx_status_drop); 198 local->tx_status_drop);
199 199
200static ssize_t stats_wme_rx_queue_read(struct file *file,
201 char __user *userbuf,
202 size_t count, loff_t *ppos)
203{
204 struct ieee80211_local *local = file->private_data;
205 char buf[NUM_RX_DATA_QUEUES*15], *p = buf;
206 int i;
207
208 for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
209 p += scnprintf(p, sizeof(buf)+buf-p,
210 "%u\n", local->wme_rx_queue[i]);
211
212 return simple_read_from_buffer(userbuf, count, ppos, buf, p-buf);
213}
214
215static const struct file_operations stats_wme_rx_queue_ops = {
216 .read = stats_wme_rx_queue_read,
217 .open = mac80211_open_file_generic,
218};
219
220static ssize_t stats_wme_tx_queue_read(struct file *file,
221 char __user *userbuf,
222 size_t count, loff_t *ppos)
223{
224 struct ieee80211_local *local = file->private_data;
225 char buf[NUM_TX_DATA_QUEUES*15], *p = buf;
226 int i;
227
228 for (i = 0; i < NUM_TX_DATA_QUEUES; i++)
229 p += scnprintf(p, sizeof(buf)+buf-p,
230 "%u\n", local->wme_tx_queue[i]);
231
232 return simple_read_from_buffer(userbuf, count, ppos, buf, p-buf);
233}
234
235static const struct file_operations stats_wme_tx_queue_ops = {
236 .read = stats_wme_tx_queue_read,
237 .open = mac80211_open_file_generic,
238};
239#endif 200#endif
240 201
241DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount); 202DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount);
@@ -303,8 +264,6 @@ void debugfs_hw_add(struct ieee80211_local *local)
303 DEBUGFS_STATS_ADD(rx_expand_skb_head2); 264 DEBUGFS_STATS_ADD(rx_expand_skb_head2);
304 DEBUGFS_STATS_ADD(rx_handlers_fragments); 265 DEBUGFS_STATS_ADD(rx_handlers_fragments);
305 DEBUGFS_STATS_ADD(tx_status_drop); 266 DEBUGFS_STATS_ADD(tx_status_drop);
306 DEBUGFS_STATS_ADD(wme_tx_queue);
307 DEBUGFS_STATS_ADD(wme_rx_queue);
308#endif 267#endif
309 DEBUGFS_STATS_ADD(dot11ACKFailureCount); 268 DEBUGFS_STATS_ADD(dot11ACKFailureCount);
310 DEBUGFS_STATS_ADD(dot11RTSFailureCount); 269 DEBUGFS_STATS_ADD(dot11RTSFailureCount);
@@ -356,8 +315,6 @@ void debugfs_hw_del(struct ieee80211_local *local)
356 DEBUGFS_STATS_DEL(rx_expand_skb_head2); 315 DEBUGFS_STATS_DEL(rx_expand_skb_head2);
357 DEBUGFS_STATS_DEL(rx_handlers_fragments); 316 DEBUGFS_STATS_DEL(rx_handlers_fragments);
358 DEBUGFS_STATS_DEL(tx_status_drop); 317 DEBUGFS_STATS_DEL(tx_status_drop);
359 DEBUGFS_STATS_DEL(wme_tx_queue);
360 DEBUGFS_STATS_DEL(wme_rx_queue);
361#endif 318#endif
362 DEBUGFS_STATS_DEL(dot11ACKFailureCount); 319 DEBUGFS_STATS_DEL(dot11ACKFailureCount);
363 DEBUGFS_STATS_DEL(dot11RTSFailureCount); 320 DEBUGFS_STATS_DEL(dot11RTSFailureCount);
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 6d47a1d31b37..676a93202ff9 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -123,36 +123,6 @@ static ssize_t sta_last_seq_ctrl_read(struct file *file, char __user *userbuf,
123} 123}
124STA_OPS(last_seq_ctrl); 124STA_OPS(last_seq_ctrl);
125 125
126#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
127static ssize_t sta_wme_rx_queue_read(struct file *file, char __user *userbuf,
128 size_t count, loff_t *ppos)
129{
130 char buf[15*NUM_RX_DATA_QUEUES], *p = buf;
131 int i;
132 struct sta_info *sta = file->private_data;
133 for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
134 p += scnprintf(p, sizeof(buf)+buf-p, "%u ",
135 sta->wme_rx_queue[i]);
136 p += scnprintf(p, sizeof(buf)+buf-p, "\n");
137 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
138}
139STA_OPS(wme_rx_queue);
140
141static ssize_t sta_wme_tx_queue_read(struct file *file, char __user *userbuf,
142 size_t count, loff_t *ppos)
143{
144 char buf[15*NUM_TX_DATA_QUEUES], *p = buf;
145 int i;
146 struct sta_info *sta = file->private_data;
147 for (i = 0; i < NUM_TX_DATA_QUEUES; i++)
148 p += scnprintf(p, sizeof(buf)+buf-p, "%u ",
149 sta->wme_tx_queue[i]);
150 p += scnprintf(p, sizeof(buf)+buf-p, "\n");
151 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
152}
153STA_OPS(wme_tx_queue);
154#endif
155
156static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, 126static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
157 size_t count, loff_t *ppos) 127 size_t count, loff_t *ppos)
158{ 128{
@@ -293,10 +263,6 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
293 DEBUGFS_ADD(num_ps_buf_frames); 263 DEBUGFS_ADD(num_ps_buf_frames);
294 DEBUGFS_ADD(inactive_ms); 264 DEBUGFS_ADD(inactive_ms);
295 DEBUGFS_ADD(last_seq_ctrl); 265 DEBUGFS_ADD(last_seq_ctrl);
296#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
297 DEBUGFS_ADD(wme_rx_queue);
298 DEBUGFS_ADD(wme_tx_queue);
299#endif
300 DEBUGFS_ADD(agg_status); 266 DEBUGFS_ADD(agg_status);
301} 267}
302 268
@@ -306,10 +272,6 @@ void ieee80211_sta_debugfs_remove(struct sta_info *sta)
306 DEBUGFS_DEL(num_ps_buf_frames); 272 DEBUGFS_DEL(num_ps_buf_frames);
307 DEBUGFS_DEL(inactive_ms); 273 DEBUGFS_DEL(inactive_ms);
308 DEBUGFS_DEL(last_seq_ctrl); 274 DEBUGFS_DEL(last_seq_ctrl);
309#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
310 DEBUGFS_DEL(wme_rx_queue);
311 DEBUGFS_DEL(wme_tx_queue);
312#endif
313 DEBUGFS_DEL(agg_status); 275 DEBUGFS_DEL(agg_status);
314 276
315 debugfs_remove(sta->debugfs.dir); 277 debugfs_remove(sta->debugfs.dir);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index cabdc1439d57..d82ed20a344c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -610,8 +610,8 @@ struct ieee80211_local {
610 struct sta_info *sta_hash[STA_HASH_SIZE]; 610 struct sta_info *sta_hash[STA_HASH_SIZE];
611 struct timer_list sta_cleanup; 611 struct timer_list sta_cleanup;
612 612
613 unsigned long state[NUM_TX_DATA_QUEUES_AMPDU]; 613 unsigned long state[IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_AMPDU_QUEUES];
614 struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES_AMPDU]; 614 struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_AMPDU_QUEUES];
615 struct tasklet_struct tx_pending_tasklet; 615 struct tasklet_struct tx_pending_tasklet;
616 616
617 /* number of interfaces with corresponding IFF_ flags */ 617 /* number of interfaces with corresponding IFF_ flags */
@@ -705,8 +705,6 @@ struct ieee80211_local {
705 unsigned int rx_expand_skb_head2; 705 unsigned int rx_expand_skb_head2;
706 unsigned int rx_handlers_fragments; 706 unsigned int rx_handlers_fragments;
707 unsigned int tx_status_drop; 707 unsigned int tx_status_drop;
708 unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
709 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
710#define I802_DEBUG_INC(c) (c)++ 708#define I802_DEBUG_INC(c) (c)++
711#else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 709#else /* CONFIG_MAC80211_DEBUG_COUNTERS */
712#define I802_DEBUG_INC(c) do { } while (0) 710#define I802_DEBUG_INC(c) do { } while (0)
@@ -764,8 +762,6 @@ struct ieee80211_local {
764 struct dentry *rx_expand_skb_head2; 762 struct dentry *rx_expand_skb_head2;
765 struct dentry *rx_handlers_fragments; 763 struct dentry *rx_handlers_fragments;
766 struct dentry *tx_status_drop; 764 struct dentry *tx_status_drop;
767 struct dentry *wme_tx_queue;
768 struct dentry *wme_rx_queue;
769#endif 765#endif
770 struct dentry *dot11ACKFailureCount; 766 struct dentry *dot11ACKFailureCount;
771 struct dentry *dot11RTSFailureCount; 767 struct dentry *dot11RTSFailureCount;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index e19be27a3def..55e76117da9e 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1745,6 +1745,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1745 goto fail_wep; 1745 goto fail_wep;
1746 } 1746 }
1747 1747
1748 if (hw->queues > IEEE80211_MAX_QUEUES)
1749 hw->queues = IEEE80211_MAX_QUEUES;
1750 if (hw->ampdu_queues > IEEE80211_MAX_AMPDU_QUEUES)
1751 hw->ampdu_queues = IEEE80211_MAX_AMPDU_QUEUES;
1752
1748 ieee80211_install_qdisc(local->mdev); 1753 ieee80211_install_qdisc(local->mdev);
1749 1754
1750 /* add one default STA interface */ 1755 /* add one default STA interface */
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e860d0bacea9..55b85ae5bc11 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -257,19 +257,8 @@ static void ieee80211_sta_def_wmm_params(struct net_device *dev,
257 qparam.cw_max = 1023; 257 qparam.cw_max = 1023;
258 qparam.txop = 0; 258 qparam.txop = 0;
259 259
260 for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++) 260 for (i = 0; i < local_to_hw(local)->queues; i++)
261 local->ops->conf_tx(local_to_hw(local), 261 local->ops->conf_tx(local_to_hw(local), i, &qparam);
262 i + IEEE80211_TX_QUEUE_DATA0,
263 &qparam);
264
265 if (ibss) {
266 /* IBSS uses different parameters for Beacon sending */
267 qparam.cw_min++;
268 qparam.cw_min *= 2;
269 qparam.cw_min--;
270 local->ops->conf_tx(local_to_hw(local),
271 IEEE80211_TX_QUEUE_BEACON, &qparam);
272 }
273 } 262 }
274} 263}
275 264
@@ -306,23 +295,23 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
306 295
307 switch (aci) { 296 switch (aci) {
308 case 1: 297 case 1:
309 queue = IEEE80211_TX_QUEUE_DATA3; 298 queue = 3;
310 if (acm) 299 if (acm)
311 local->wmm_acm |= BIT(0) | BIT(3); 300 local->wmm_acm |= BIT(0) | BIT(3);
312 break; 301 break;
313 case 2: 302 case 2:
314 queue = IEEE80211_TX_QUEUE_DATA1; 303 queue = 1;
315 if (acm) 304 if (acm)
316 local->wmm_acm |= BIT(4) | BIT(5); 305 local->wmm_acm |= BIT(4) | BIT(5);
317 break; 306 break;
318 case 3: 307 case 3:
319 queue = IEEE80211_TX_QUEUE_DATA0; 308 queue = 0;
320 if (acm) 309 if (acm)
321 local->wmm_acm |= BIT(6) | BIT(7); 310 local->wmm_acm |= BIT(6) | BIT(7);
322 break; 311 break;
323 case 0: 312 case 0:
324 default: 313 default:
325 queue = IEEE80211_TX_QUEUE_DATA2; 314 queue = 2;
326 if (acm) 315 if (acm)
327 local->wmm_acm |= BIT(1) | BIT(2); 316 local->wmm_acm |= BIT(1) | BIT(2);
328 break; 317 break;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 02f436a86061..e8b89c89e875 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -275,11 +275,6 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
275 } 275 }
276 } 276 }
277 277
278 I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
279 /* only a debug counter, sta might not be assigned properly yet */
280 if (rx->sta)
281 I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
282
283 rx->queue = tid; 278 rx->queue = tid;
284 /* Set skb->priority to 1d tag if highest order bit of TID is not set. 279 /* Set skb->priority to 1d tag if highest order bit of TID is not set.
285 * For now, set skb->priority to 0 for other cases. */ 280 * For now, set skb->priority to 0 for other cases. */
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 7d4fe4a52929..631943e8af8b 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -257,7 +257,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
257 * sta_rx_agg_session_timer_expired for useage */ 257 * sta_rx_agg_session_timer_expired for useage */
258 sta->timer_to_tid[i] = i; 258 sta->timer_to_tid[i] = i;
259 /* tid to tx queue: initialize according to HW (0 is valid) */ 259 /* tid to tx queue: initialize according to HW (0 is valid) */
260 sta->tid_to_tx_q[i] = local->hw.queues; 260 sta->tid_to_tx_q[i] = local->hw.queues + local->hw.ampdu_queues;
261 /* rx */ 261 /* rx */
262 sta->ampdu_mlme.tid_state_rx[i] = HT_AGG_STATE_IDLE; 262 sta->ampdu_mlme.tid_state_rx[i] = HT_AGG_STATE_IDLE;
263 sta->ampdu_mlme.tid_rx[i] = NULL; 263 sta->ampdu_mlme.tid_rx[i] = NULL;
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 64faa3dc488f..5eddf1f32ed9 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -19,16 +19,22 @@
19#include "wme.h" 19#include "wme.h"
20 20
21/* maximum number of hardware queues we support. */ 21/* maximum number of hardware queues we support. */
22#define TC_80211_MAX_QUEUES 16 22#define QD_MAX_QUEUES (IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_QUEUES)
23/* current number of hardware queues we support. */
24#define QD_NUM(hw) ((hw)->queues + (hw)->ampdu_queues)
23 25
26/*
27 * Default mapping in classifier to work with default
28 * queue setup.
29 */
24const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 }; 30const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 };
25 31
26struct ieee80211_sched_data 32struct ieee80211_sched_data
27{ 33{
28 unsigned long qdisc_pool[BITS_TO_LONGS(TC_80211_MAX_QUEUES)]; 34 unsigned long qdisc_pool[BITS_TO_LONGS(QD_MAX_QUEUES)];
29 struct tcf_proto *filter_list; 35 struct tcf_proto *filter_list;
30 struct Qdisc *queues[TC_80211_MAX_QUEUES]; 36 struct Qdisc *queues[QD_MAX_QUEUES];
31 struct sk_buff_head requeued[TC_80211_MAX_QUEUES]; 37 struct sk_buff_head requeued[QD_MAX_QUEUES];
32}; 38};
33 39
34static const char llc_ip_hdr[8] = {0xAA, 0xAA, 0x3, 0, 0, 0, 0x08, 0}; 40static const char llc_ip_hdr[8] = {0xAA, 0xAA, 0x3, 0, 0, 0, 0x08, 0};
@@ -95,7 +101,7 @@ static inline int wme_downgrade_ac(struct sk_buff *skb)
95 101
96/* positive return value indicates which queue to use 102/* positive return value indicates which queue to use
97 * negative return value indicates to drop the frame */ 103 * negative return value indicates to drop the frame */
98static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd) 104static int classify80211(struct sk_buff *skb, struct Qdisc *qd)
99{ 105{
100 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 106 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
101 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 107 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -106,7 +112,7 @@ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
106 if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)) { 112 if (unlikely((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)) {
107 /* management frames go on AC_VO queue, but are sent 113 /* management frames go on AC_VO queue, but are sent
108 * without QoS control fields */ 114 * without QoS control fields */
109 return IEEE80211_TX_QUEUE_DATA0; 115 return 0;
110 } 116 }
111 117
112 if (0 /* injected */) { 118 if (0 /* injected */) {
@@ -141,14 +147,16 @@ static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd)
141static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd) 147static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
142{ 148{
143 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 149 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
150 struct ieee80211_hw *hw = &local->hw;
144 struct ieee80211_sched_data *q = qdisc_priv(qd); 151 struct ieee80211_sched_data *q = qdisc_priv(qd);
145 struct ieee80211_tx_packet_data *pkt_data = 152 struct ieee80211_tx_packet_data *pkt_data =
146 (struct ieee80211_tx_packet_data *) skb->cb; 153 (struct ieee80211_tx_packet_data *) skb->cb;
147 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 154 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
148 unsigned short fc = le16_to_cpu(hdr->frame_control); 155 unsigned short fc = le16_to_cpu(hdr->frame_control);
149 struct Qdisc *qdisc; 156 struct Qdisc *qdisc;
150 int err, queue;
151 struct sta_info *sta; 157 struct sta_info *sta;
158 int err;
159 u16 queue;
152 u8 tid; 160 u8 tid;
153 161
154 if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) { 162 if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) {
@@ -158,7 +166,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
158 tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 166 tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
159 if (sta) { 167 if (sta) {
160 int ampdu_queue = sta->tid_to_tx_q[tid]; 168 int ampdu_queue = sta->tid_to_tx_q[tid];
161 if ((ampdu_queue < local->hw.queues) && 169 if ((ampdu_queue < QD_NUM(hw)) &&
162 test_bit(ampdu_queue, q->qdisc_pool)) { 170 test_bit(ampdu_queue, q->qdisc_pool)) {
163 queue = ampdu_queue; 171 queue = ampdu_queue;
164 pkt_data->flags |= IEEE80211_TXPD_AMPDU; 172 pkt_data->flags |= IEEE80211_TXPD_AMPDU;
@@ -174,6 +182,9 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
174 182
175 queue = classify80211(skb, qd); 183 queue = classify80211(skb, qd);
176 184
185 if (unlikely(queue >= local->hw.queues))
186 queue = local->hw.queues - 1;
187
177 /* now we know the 1d priority, fill in the QoS header if there is one 188 /* now we know the 1d priority, fill in the QoS header if there is one
178 */ 189 */
179 if (WLAN_FC_IS_QOS_DATA(fc)) { 190 if (WLAN_FC_IS_QOS_DATA(fc)) {
@@ -193,8 +204,8 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
193 sta = sta_info_get(local, hdr->addr1); 204 sta = sta_info_get(local, hdr->addr1);
194 if (sta) { 205 if (sta) {
195 int ampdu_queue = sta->tid_to_tx_q[tid]; 206 int ampdu_queue = sta->tid_to_tx_q[tid];
196 if ((ampdu_queue < local->hw.queues) && 207 if ((ampdu_queue < QD_NUM(hw)) &&
197 test_bit(ampdu_queue, q->qdisc_pool)) { 208 test_bit(ampdu_queue, q->qdisc_pool)) {
198 queue = ampdu_queue; 209 queue = ampdu_queue;
199 pkt_data->flags |= IEEE80211_TXPD_AMPDU; 210 pkt_data->flags |= IEEE80211_TXPD_AMPDU;
200 } else { 211 } else {
@@ -205,17 +216,6 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
205 rcu_read_unlock(); 216 rcu_read_unlock();
206 } 217 }
207 218
208 if (unlikely(queue >= local->hw.queues)) {
209#if 0
210 if (net_ratelimit()) {
211 printk(KERN_DEBUG "%s - queue=%d (hw does not "
212 "support) -> %d\n",
213 __func__, queue, local->hw.queues - 1);
214 }
215#endif
216 queue = local->hw.queues - 1;
217 }
218
219 if (unlikely(queue < 0)) { 219 if (unlikely(queue < 0)) {
220 kfree_skb(skb); 220 kfree_skb(skb);
221 err = NET_XMIT_DROP; 221 err = NET_XMIT_DROP;
@@ -270,7 +270,7 @@ static struct sk_buff *wme_qdiscop_dequeue(struct Qdisc* qd)
270 int queue; 270 int queue;
271 271
272 /* check all the h/w queues in numeric/priority order */ 272 /* check all the h/w queues in numeric/priority order */
273 for (queue = 0; queue < hw->queues; queue++) { 273 for (queue = 0; queue < QD_NUM(hw); queue++) {
274 /* see if there is room in this hardware queue */ 274 /* see if there is room in this hardware queue */
275 if ((test_bit(IEEE80211_LINK_STATE_XOFF, 275 if ((test_bit(IEEE80211_LINK_STATE_XOFF,
276 &local->state[queue])) || 276 &local->state[queue])) ||
@@ -308,7 +308,7 @@ static void wme_qdiscop_reset(struct Qdisc* qd)
308 308
309 /* QUESTION: should we have some hardware flush functionality here? */ 309 /* QUESTION: should we have some hardware flush functionality here? */
310 310
311 for (queue = 0; queue < hw->queues; queue++) { 311 for (queue = 0; queue < QD_NUM(hw); queue++) {
312 skb_queue_purge(&q->requeued[queue]); 312 skb_queue_purge(&q->requeued[queue]);
313 qdisc_reset(q->queues[queue]); 313 qdisc_reset(q->queues[queue]);
314 } 314 }
@@ -326,7 +326,7 @@ static void wme_qdiscop_destroy(struct Qdisc* qd)
326 tcf_destroy_chain(q->filter_list); 326 tcf_destroy_chain(q->filter_list);
327 q->filter_list = NULL; 327 q->filter_list = NULL;
328 328
329 for (queue=0; queue < hw->queues; queue++) { 329 for (queue = 0; queue < QD_NUM(hw); queue++) {
330 skb_queue_purge(&q->requeued[queue]); 330 skb_queue_purge(&q->requeued[queue]);
331 qdisc_destroy(q->queues[queue]); 331 qdisc_destroy(q->queues[queue]);
332 q->queues[queue] = &noop_qdisc; 332 q->queues[queue] = &noop_qdisc;
@@ -337,17 +337,6 @@ static void wme_qdiscop_destroy(struct Qdisc* qd)
337/* called whenever parameters are updated on existing qdisc */ 337/* called whenever parameters are updated on existing qdisc */
338static int wme_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt) 338static int wme_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt)
339{ 339{
340/* struct ieee80211_sched_data *q = qdisc_priv(qd);
341*/
342 /* check our options block is the right size */
343 /* copy any options to our local structure */
344/* Ignore options block for now - always use static mapping
345 struct tc_ieee80211_qopt *qopt = nla_data(opt);
346
347 if (opt->nla_len < nla_attr_size(sizeof(*qopt)))
348 return -EINVAL;
349 memcpy(q->tag2queue, qopt->tag2queue, sizeof(qopt->tag2queue));
350*/
351 return 0; 340 return 0;
352} 341}
353 342
@@ -358,7 +347,7 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct nlattr *opt)
358 struct ieee80211_sched_data *q = qdisc_priv(qd); 347 struct ieee80211_sched_data *q = qdisc_priv(qd);
359 struct net_device *dev = qd->dev; 348 struct net_device *dev = qd->dev;
360 struct ieee80211_local *local; 349 struct ieee80211_local *local;
361 int queues; 350 struct ieee80211_hw *hw;
362 int err = 0, i; 351 int err = 0, i;
363 352
364 /* check that device is a mac80211 device */ 353 /* check that device is a mac80211 device */
@@ -366,29 +355,26 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct nlattr *opt)
366 dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) 355 dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
367 return -EINVAL; 356 return -EINVAL;
368 357
369 /* check this device is an ieee80211 master type device */ 358 local = wdev_priv(dev->ieee80211_ptr);
370 if (dev->type != ARPHRD_IEEE80211) 359 hw = &local->hw;
360
361 /* only allow on master dev */
362 if (dev != local->mdev)
371 return -EINVAL; 363 return -EINVAL;
372 364
373 /* check that there is no qdisc currently attached to device 365 /* ensure that we are root qdisc */
374 * this ensures that we will be the root qdisc. (I can't find a better 366 if (qd->parent != TC_H_ROOT)
375 * way to test this explicitly) */
376 if (dev->qdisc_sleeping != &noop_qdisc)
377 return -EINVAL; 367 return -EINVAL;
378 368
379 if (qd->flags & TCQ_F_INGRESS) 369 if (qd->flags & TCQ_F_INGRESS)
380 return -EINVAL; 370 return -EINVAL;
381 371
382 local = wdev_priv(dev->ieee80211_ptr);
383 queues = local->hw.queues;
384
385 /* if options were passed in, set them */ 372 /* if options were passed in, set them */
386 if (opt) { 373 if (opt)
387 err = wme_qdiscop_tune(qd, opt); 374 err = wme_qdiscop_tune(qd, opt);
388 }
389 375
390 /* create child queues */ 376 /* create child queues */
391 for (i = 0; i < queues; i++) { 377 for (i = 0; i < QD_NUM(hw); i++) {
392 skb_queue_head_init(&q->requeued[i]); 378 skb_queue_head_init(&q->requeued[i]);
393 q->queues[i] = qdisc_create_dflt(qd->dev, &pfifo_qdisc_ops, 379 q->queues[i] = qdisc_create_dflt(qd->dev, &pfifo_qdisc_ops,
394 qd->handle); 380 qd->handle);
@@ -398,8 +384,8 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct nlattr *opt)
398 } 384 }
399 } 385 }
400 386
401 /* reserve all legacy QoS queues */ 387 /* non-aggregation queues: reserve/mark as used */
402 for (i = 0; i < min(IEEE80211_TX_QUEUE_DATA4, queues); i++) 388 for (i = 0; i < local->hw.queues; i++)
403 set_bit(i, q->qdisc_pool); 389 set_bit(i, q->qdisc_pool);
404 390
405 return err; 391 return err;
@@ -407,16 +393,6 @@ static int wme_qdiscop_init(struct Qdisc *qd, struct nlattr *opt)
407 393
408static int wme_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb) 394static int wme_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb)
409{ 395{
410/* struct ieee80211_sched_data *q = qdisc_priv(qd);
411 unsigned char *p = skb->tail;
412 struct tc_ieee80211_qopt opt;
413
414 memcpy(&opt.tag2queue, q->tag2queue, TC_80211_MAX_TAG + 1);
415 NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
416*/ return skb->len;
417/*
418nla_put_failure:
419 skb_trim(skb, p - skb->data);*/
420 return -1; 396 return -1;
421} 397}
422 398
@@ -429,7 +405,7 @@ static int wme_classop_graft(struct Qdisc *qd, unsigned long arg,
429 struct ieee80211_hw *hw = &local->hw; 405 struct ieee80211_hw *hw = &local->hw;
430 unsigned long queue = arg - 1; 406 unsigned long queue = arg - 1;
431 407
432 if (queue >= hw->queues) 408 if (queue >= QD_NUM(hw))
433 return -EINVAL; 409 return -EINVAL;
434 410
435 if (!new) 411 if (!new)
@@ -453,7 +429,7 @@ wme_classop_leaf(struct Qdisc *qd, unsigned long arg)
453 struct ieee80211_hw *hw = &local->hw; 429 struct ieee80211_hw *hw = &local->hw;
454 unsigned long queue = arg - 1; 430 unsigned long queue = arg - 1;
455 431
456 if (queue >= hw->queues) 432 if (queue >= QD_NUM(hw))
457 return NULL; 433 return NULL;
458 434
459 return q->queues[queue]; 435 return q->queues[queue];
@@ -466,7 +442,7 @@ static unsigned long wme_classop_get(struct Qdisc *qd, u32 classid)
466 struct ieee80211_hw *hw = &local->hw; 442 struct ieee80211_hw *hw = &local->hw;
467 unsigned long queue = TC_H_MIN(classid); 443 unsigned long queue = TC_H_MIN(classid);
468 444
469 if (queue - 1 >= hw->queues) 445 if (queue - 1 >= QD_NUM(hw))
470 return 0; 446 return 0;
471 447
472 return queue; 448 return queue;
@@ -492,7 +468,7 @@ static int wme_classop_change(struct Qdisc *qd, u32 handle, u32 parent,
492 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 468 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
493 struct ieee80211_hw *hw = &local->hw; 469 struct ieee80211_hw *hw = &local->hw;
494 470
495 if (cl - 1 > hw->queues) 471 if (cl - 1 > QD_NUM(hw))
496 return -ENOENT; 472 return -ENOENT;
497 473
498 /* TODO: put code to program hardware queue parameters here, 474 /* TODO: put code to program hardware queue parameters here,
@@ -509,7 +485,7 @@ static int wme_classop_delete(struct Qdisc *qd, unsigned long cl)
509 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 485 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
510 struct ieee80211_hw *hw = &local->hw; 486 struct ieee80211_hw *hw = &local->hw;
511 487
512 if (cl - 1 > hw->queues) 488 if (cl - 1 > QD_NUM(hw))
513 return -ENOENT; 489 return -ENOENT;
514 return 0; 490 return 0;
515} 491}
@@ -522,7 +498,7 @@ static int wme_classop_dump_class(struct Qdisc *qd, unsigned long cl,
522 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 498 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
523 struct ieee80211_hw *hw = &local->hw; 499 struct ieee80211_hw *hw = &local->hw;
524 500
525 if (cl - 1 > hw->queues) 501 if (cl - 1 > QD_NUM(hw))
526 return -ENOENT; 502 return -ENOENT;
527 tcm->tcm_handle = TC_H_MIN(cl); 503 tcm->tcm_handle = TC_H_MIN(cl);
528 tcm->tcm_parent = qd->handle; 504 tcm->tcm_parent = qd->handle;
@@ -540,7 +516,7 @@ static void wme_classop_walk(struct Qdisc *qd, struct qdisc_walker *arg)
540 if (arg->stop) 516 if (arg->stop)
541 return; 517 return;
542 518
543 for (queue = 0; queue < hw->queues; queue++) { 519 for (queue = 0; queue < QD_NUM(hw); queue++) {
544 if (arg->count < arg->skip) { 520 if (arg->count < arg->skip) {
545 arg->count++; 521 arg->count++;
546 continue; 522 continue;
@@ -657,10 +633,13 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
657 DECLARE_MAC_BUF(mac); 633 DECLARE_MAC_BUF(mac);
658 634
659 /* prepare the filter and save it for the SW queue 635 /* prepare the filter and save it for the SW queue
660 * matching the recieved HW queue */ 636 * matching the received HW queue */
637
638 if (!local->hw.ampdu_queues)
639 return -EPERM;
661 640
662 /* try to get a Qdisc from the pool */ 641 /* try to get a Qdisc from the pool */
663 for (i = IEEE80211_TX_QUEUE_BEACON; i < local->hw.queues; i++) 642 for (i = local->hw.queues; i < QD_NUM(&local->hw); i++)
664 if (!test_and_set_bit(i, q->qdisc_pool)) { 643 if (!test_and_set_bit(i, q->qdisc_pool)) {
665 ieee80211_stop_queue(local_to_hw(local), i); 644 ieee80211_stop_queue(local_to_hw(local), i);
666 sta->tid_to_tx_q[tid] = i; 645 sta->tid_to_tx_q[tid] = i;
@@ -689,13 +668,14 @@ void ieee80211_ht_agg_queue_remove(struct ieee80211_local *local,
689 struct sta_info *sta, u16 tid, 668 struct sta_info *sta, u16 tid,
690 u8 requeue) 669 u8 requeue)
691{ 670{
671 struct ieee80211_hw *hw = &local->hw;
692 struct ieee80211_sched_data *q = 672 struct ieee80211_sched_data *q =
693 qdisc_priv(local->mdev->qdisc_sleeping); 673 qdisc_priv(local->mdev->qdisc_sleeping);
694 int agg_queue = sta->tid_to_tx_q[tid]; 674 int agg_queue = sta->tid_to_tx_q[tid];
695 675
696 /* return the qdisc to the pool */ 676 /* return the qdisc to the pool */
697 clear_bit(agg_queue, q->qdisc_pool); 677 clear_bit(agg_queue, q->qdisc_pool);
698 sta->tid_to_tx_q[tid] = local->hw.queues; 678 sta->tid_to_tx_q[tid] = QD_NUM(hw);
699 679
700 if (requeue) 680 if (requeue)
701 ieee80211_requeue(local, agg_queue); 681 ieee80211_requeue(local, agg_queue);