diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-04-30 12:51:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-07 15:02:26 -0400 |
commit | e100bb64bf7cdeae7f742a65ee1985649a7fd1b4 (patch) | |
tree | 87ed4147c4dc583aba7c27b0717febb6fabdc76a /net | |
parent | 36fc6757fe711def63ea3686bf6ed475d714e114 (diff) |
mac80211: QoS related cleanups
This
* makes the queue number passed to drivers a u16
(as it will be with skb_get_queue_mapping)
* removes the useless queue number defines
* splits hw->queues into hw->queues/ampdu_queues
* removes the debugfs files for per-queue counters
* removes some dead QoS code
* removes the beacon queue configuration for IBSS
so that the drivers now never get a queue number
bigger than (hw->queues + hw->ampdu_queues - 1)
for tx and only in the range 0..hw->queues-1 for
conf_tx.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/debugfs.c | 43 | ||||
-rw-r--r-- | net/mac80211/debugfs_sta.c | 38 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 8 | ||||
-rw-r--r-- | net/mac80211/main.c | 5 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 23 | ||||
-rw-r--r-- | net/mac80211/rx.c | 5 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 2 | ||||
-rw-r--r-- | net/mac80211/wme.c | 120 |
8 files changed, 64 insertions, 180 deletions
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", | |||
197 | DEBUGFS_STATS_FILE(tx_status_drop, 20, "%u", | 197 | DEBUGFS_STATS_FILE(tx_status_drop, 20, "%u", |
198 | local->tx_status_drop); | 198 | local->tx_status_drop); |
199 | 199 | ||
200 | static 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 | |||
215 | static const struct file_operations stats_wme_rx_queue_ops = { | ||
216 | .read = stats_wme_rx_queue_read, | ||
217 | .open = mac80211_open_file_generic, | ||
218 | }; | ||
219 | |||
220 | static 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 | |||
235 | static 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 | ||
241 | DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount); | 202 | DEBUGFS_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 | } |
124 | STA_OPS(last_seq_ctrl); | 124 | STA_OPS(last_seq_ctrl); |
125 | 125 | ||
126 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS | ||
127 | static 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 | } | ||
139 | STA_OPS(wme_rx_queue); | ||
140 | |||
141 | static 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 | } | ||
153 | STA_OPS(wme_tx_queue); | ||
154 | #endif | ||
155 | |||
156 | static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, | 126 | static 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 | */ | ||
24 | const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 }; | 30 | const int ieee802_1d_to_ac[8] = { 2, 3, 3, 2, 1, 1, 0, 0 }; |
25 | 31 | ||
26 | struct ieee80211_sched_data | 32 | struct 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 | ||
34 | static const char llc_ip_hdr[8] = {0xAA, 0xAA, 0x3, 0, 0, 0, 0x08, 0}; | 40 | static 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 */ |
98 | static inline int classify80211(struct sk_buff *skb, struct Qdisc *qd) | 104 | static 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) | |||
141 | static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd) | 147 | static 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 */ |
338 | static int wme_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt) | 338 | static 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 | ||
408 | static int wme_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb) | 394 | static 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 | /* | ||
418 | nla_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); |