aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-16 18:57:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:14 -0400
commite2530083609148a7835b54c431f6b8956407c1f6 (patch)
tree8ed43347541444c7a72d2c79f550f69a93cad591 /drivers/net
parenteefce91a384a64c7bbf913eb08c4adfb911c3639 (diff)
mac80211: use multi-queue master netdevice
This patch updates mac80211 and drivers to be multi-queue aware and use that instead of the internal queue mapping. Also does a number of cleanups in various pieces of the code that fall out and reduces internal mac80211 state size. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath5k/base.c2
-rw-r--r--drivers/net/wireless/b43/dma.c7
-rw-r--r--drivers/net/wireless/b43/pio.c8
-rw-r--r--drivers/net/wireless/b43legacy/dma.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c4
-rw-r--r--drivers/net/wireless/p54/p54common.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h13
-rw-r--r--drivers/net/wireless/rtl8180_dev.c4
10 files changed, 25 insertions, 38 deletions
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 7d97934265db..18e9422d26dd 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -2657,7 +2657,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2657 if (list_empty(&sc->txbuf)) { 2657 if (list_empty(&sc->txbuf)) {
2658 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); 2658 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n");
2659 spin_unlock_irqrestore(&sc->txbuflock, flags); 2659 spin_unlock_irqrestore(&sc->txbuflock, flags);
2660 ieee80211_stop_queue(hw, info->queue); 2660 ieee80211_stop_queue(hw, skb_get_queue_mapping(skb));
2661 return -1; 2661 return -1;
2662 } 2662 }
2663 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); 2663 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list);
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index aced9866d815..b4eadd908bea 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1297,7 +1297,8 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1297 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); 1297 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
1298 } else { 1298 } else {
1299 /* Decide by priority where to put this frame. */ 1299 /* Decide by priority where to put this frame. */
1300 ring = select_ring_by_priority(dev, info->queue); 1300 ring = select_ring_by_priority(
1301 dev, skb_get_queue_mapping(skb));
1301 } 1302 }
1302 1303
1303 spin_lock_irqsave(&ring->lock, flags); 1304 spin_lock_irqsave(&ring->lock, flags);
@@ -1315,7 +1316,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1315 /* Assign the queue number to the ring (if not already done before) 1316 /* Assign the queue number to the ring (if not already done before)
1316 * so TX status handling can use it. The queue to ring mapping is 1317 * so TX status handling can use it. The queue to ring mapping is
1317 * static, so we don't need to store it per frame. */ 1318 * static, so we don't need to store it per frame. */
1318 ring->queue_prio = info->queue; 1319 ring->queue_prio = skb_get_queue_mapping(skb);
1319 1320
1320 err = dma_tx_fragment(ring, skb); 1321 err = dma_tx_fragment(ring, skb);
1321 if (unlikely(err == -ENOKEY)) { 1322 if (unlikely(err == -ENOKEY)) {
@@ -1333,7 +1334,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1333 if ((free_slots(ring) < SLOTS_PER_PACKET) || 1334 if ((free_slots(ring) < SLOTS_PER_PACKET) ||
1334 should_inject_overflow(ring)) { 1335 should_inject_overflow(ring)) {
1335 /* This TX ring is full. */ 1336 /* This TX ring is full. */
1336 ieee80211_stop_queue(dev->wl->hw, info->queue); 1337 ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb));
1337 ring->stopped = 1; 1338 ring->stopped = 1;
1338 if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { 1339 if (b43_debug(dev, B43_DBG_DMAVERBOSE)) {
1339 b43dbg(dev->wl, "Stopped TX ring %d\n", ring->index); 1340 b43dbg(dev->wl, "Stopped TX ring %d\n", ring->index);
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 284786a94e7d..8b1555d95f1c 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -509,7 +509,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
509 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); 509 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
510 } else { 510 } else {
511 /* Decide by priority where to put this frame. */ 511 /* Decide by priority where to put this frame. */
512 q = select_queue_by_priority(dev, info->queue); 512 q = select_queue_by_priority(dev, skb_get_queue_mapping(skb));
513 } 513 }
514 514
515 spin_lock_irqsave(&q->lock, flags); 515 spin_lock_irqsave(&q->lock, flags);
@@ -532,7 +532,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
532 if (total_len > (q->buffer_size - q->buffer_used)) { 532 if (total_len > (q->buffer_size - q->buffer_used)) {
533 /* Not enough memory on the queue. */ 533 /* Not enough memory on the queue. */
534 err = -EBUSY; 534 err = -EBUSY;
535 ieee80211_stop_queue(dev->wl->hw, info->queue); 535 ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb));
536 q->stopped = 1; 536 q->stopped = 1;
537 goto out_unlock; 537 goto out_unlock;
538 } 538 }
@@ -540,7 +540,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
540 /* Assign the queue number to the ring (if not already done before) 540 /* Assign the queue number to the ring (if not already done before)
541 * so TX status handling can use it. The mac80211-queue to b43-queue 541 * so TX status handling can use it. The mac80211-queue to b43-queue
542 * mapping is static, so we don't need to store it per frame. */ 542 * mapping is static, so we don't need to store it per frame. */
543 q->queue_prio = info->queue; 543 q->queue_prio = skb_get_queue_mapping(skb);
544 544
545 err = pio_tx_frame(q, skb); 545 err = pio_tx_frame(q, skb);
546 if (unlikely(err == -ENOKEY)) { 546 if (unlikely(err == -ENOKEY)) {
@@ -560,7 +560,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
560 if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) || 560 if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) ||
561 (q->free_packet_slots == 0)) { 561 (q->free_packet_slots == 0)) {
562 /* The queue is full. */ 562 /* The queue is full. */
563 ieee80211_stop_queue(dev->wl->hw, info->queue); 563 ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb));
564 q->stopped = 1; 564 q->stopped = 1;
565 } 565 }
566 566
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index c1c501d963bc..33cc256c5baf 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -1325,11 +1325,10 @@ int b43legacy_dma_tx(struct b43legacy_wldev *dev,
1325 struct sk_buff *skb) 1325 struct sk_buff *skb)
1326{ 1326{
1327 struct b43legacy_dmaring *ring; 1327 struct b43legacy_dmaring *ring;
1328 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1329 int err = 0; 1328 int err = 0;
1330 unsigned long flags; 1329 unsigned long flags;
1331 1330
1332 ring = priority_to_txring(dev, info->queue); 1331 ring = priority_to_txring(dev, skb_get_queue_mapping(skb));
1333 spin_lock_irqsave(&ring->lock, flags); 1332 spin_lock_irqsave(&ring->lock, flags);
1334 B43legacy_WARN_ON(!ring->tx); 1333 B43legacy_WARN_ON(!ring->tx);
1335 if (unlikely(free_slots(ring) < SLOTS_PER_PACKET)) { 1334 if (unlikely(free_slots(ring) < SLOTS_PER_PACKET)) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index a61293ba3f6b..0ebab967d5e7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -696,7 +696,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
696 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 696 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
697 struct iwl_tfd_frame *tfd; 697 struct iwl_tfd_frame *tfd;
698 u32 *control_flags; 698 u32 *control_flags;
699 int txq_id = info->queue; 699 int txq_id = skb_get_queue_mapping(skb);
700 struct iwl_tx_queue *txq = NULL; 700 struct iwl_tx_queue *txq = NULL;
701 struct iwl_queue *q = NULL; 701 struct iwl_queue *q = NULL;
702 dma_addr_t phys_addr; 702 dma_addr_t phys_addr;
@@ -917,7 +917,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
917 spin_unlock_irqrestore(&priv->lock, flags); 917 spin_unlock_irqrestore(&priv->lock, flags);
918 } 918 }
919 919
920 ieee80211_stop_queue(priv->hw, info->queue); 920 ieee80211_stop_queue(priv->hw, skb_get_queue_mapping(skb));
921 } 921 }
922 922
923 return 0; 923 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index a740a1817d16..e0f52e264418 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2552,7 +2552,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2552 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2552 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2553 struct iwl3945_tfd_frame *tfd; 2553 struct iwl3945_tfd_frame *tfd;
2554 u32 *control_flags; 2554 u32 *control_flags;
2555 int txq_id = info->queue; 2555 int txq_id = skb_get_queue_mapping(skb);
2556 struct iwl3945_tx_queue *txq = NULL; 2556 struct iwl3945_tx_queue *txq = NULL;
2557 struct iwl3945_queue *q = NULL; 2557 struct iwl3945_queue *q = NULL;
2558 dma_addr_t phys_addr; 2558 dma_addr_t phys_addr;
@@ -2765,7 +2765,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2765 spin_unlock_irqrestore(&priv->lock, flags); 2765 spin_unlock_irqrestore(&priv->lock, flags);
2766 } 2766 }
2767 2767
2768 ieee80211_stop_queue(priv->hw, info->queue); 2768 ieee80211_stop_queue(priv->hw, skb_get_queue_mapping(skb));
2769 } 2769 }
2770 2770
2771 return 0; 2771 return 0;
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 850857932e29..91ac9208b77d 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -407,7 +407,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
407 last_addr = range->end_addr; 407 last_addr = range->end_addr;
408 __skb_unlink(entry, &priv->tx_queue); 408 __skb_unlink(entry, &priv->tx_queue);
409 memset(&info->status, 0, sizeof(info->status)); 409 memset(&info->status, 0, sizeof(info->status));
410 priv->tx_stats[info->queue].len--; 410 priv->tx_stats[skb_get_queue_mapping(skb)].len--;
411 entry_hdr = (struct p54_control_hdr *) entry->data; 411 entry_hdr = (struct p54_control_hdr *) entry->data;
412 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; 412 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
413 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) 413 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
@@ -551,13 +551,13 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
551 size_t padding, len; 551 size_t padding, len;
552 u8 rate; 552 u8 rate;
553 553
554 current_queue = &priv->tx_stats[info->queue]; 554 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb)];
555 if (unlikely(current_queue->len > current_queue->limit)) 555 if (unlikely(current_queue->len > current_queue->limit))
556 return NETDEV_TX_BUSY; 556 return NETDEV_TX_BUSY;
557 current_queue->len++; 557 current_queue->len++;
558 current_queue->count++; 558 current_queue->count++;
559 if (current_queue->len == current_queue->limit) 559 if (current_queue->len == current_queue->limit)
560 ieee80211_stop_queue(dev, info->queue); 560 ieee80211_stop_queue(dev, skb_get_queue_mapping(skb));
561 561
562 padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; 562 padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3;
563 len = skb->len; 563 len = skb->len;
@@ -589,7 +589,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
589 memset(txhdr->rateset, rate, 8); 589 memset(txhdr->rateset, rate, 8);
590 txhdr->wep_key_present = 0; 590 txhdr->wep_key_present = 0;
591 txhdr->wep_key_len = 0; 591 txhdr->wep_key_len = 0;
592 txhdr->frame_type = cpu_to_le32(info->queue + 4); 592 txhdr->frame_type = cpu_to_le32(skb_get_queue_mapping(skb) + 4);
593 txhdr->magic4 = 0; 593 txhdr->magic4 = 0;
594 txhdr->antenna = (info->antenna_sel_tx == 0) ? 594 txhdr->antenna = (info->antenna_sel_tx == 0) ?
595 2 : info->antenna_sel_tx - 1; 595 2 : info->antenna_sel_tx - 1;
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index b5379b027b18..c05e05b58887 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -102,7 +102,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
102 struct rt2x00_dev *rt2x00dev = hw->priv; 102 struct rt2x00_dev *rt2x00dev = hw->priv;
103 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 103 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
104 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data; 104 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
105 enum data_queue_qid qid = mac80211_queue_to_qid(tx_info->queue); 105 enum data_queue_qid qid = skb_get_queue_mapping(skb);
106 struct data_queue *queue; 106 struct data_queue *queue;
107 u16 frame_control; 107 u16 frame_control;
108 108
@@ -149,23 +149,23 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
149 IEEE80211_TX_CTL_USE_CTS_PROTECT)) && 149 IEEE80211_TX_CTL_USE_CTS_PROTECT)) &&
150 !rt2x00dev->ops->hw->set_rts_threshold) { 150 !rt2x00dev->ops->hw->set_rts_threshold) {
151 if (rt2x00queue_available(queue) <= 1) { 151 if (rt2x00queue_available(queue) <= 1) {
152 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue); 152 ieee80211_stop_queue(rt2x00dev->hw, qid);
153 return NETDEV_TX_BUSY; 153 return NETDEV_TX_BUSY;
154 } 154 }
155 155
156 if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb)) { 156 if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb)) {
157 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue); 157 ieee80211_stop_queue(rt2x00dev->hw, qid);
158 return NETDEV_TX_BUSY; 158 return NETDEV_TX_BUSY;
159 } 159 }
160 } 160 }
161 161
162 if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, queue, skb)) { 162 if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, queue, skb)) {
163 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue); 163 ieee80211_stop_queue(rt2x00dev->hw, qid);
164 return NETDEV_TX_BUSY; 164 return NETDEV_TX_BUSY;
165 } 165 }
166 166
167 if (rt2x00queue_full(queue)) 167 if (rt2x00queue_full(queue))
168 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue); 168 ieee80211_stop_queue(rt2x00dev->hw, qid);
169 169
170 if (rt2x00dev->ops->lib->kick_tx_queue) 170 if (rt2x00dev->ops->lib->kick_tx_queue)
171 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, qid); 171 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, qid);
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index f263fe422f87..4d00ced14cc7 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -80,19 +80,6 @@ enum data_queue_qid {
80}; 80};
81 81
82/** 82/**
83 * mac80211_queue_to_qid - Convert mac80211 queue to rt2x00 qid
84 * @queue: mac80211 queue.
85 */
86static inline enum data_queue_qid mac80211_queue_to_qid(unsigned int queue)
87{
88 /* Regular TX queues are mapped directly */
89 if (queue < 4)
90 return queue;
91 WARN_ON(1);
92 return QID_OTHER;
93}
94
95/**
96 * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc 83 * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc
97 * 84 *
98 * @FRAME_DESC_DRIVER_GENERATED: Frame was generated inside driver 85 * @FRAME_DESC_DRIVER_GENERATED: Frame was generated inside driver
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c
index 4427bc9f78a9..b7172a12c057 100644
--- a/drivers/net/wireless/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl8180_dev.c
@@ -246,7 +246,7 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
246 u16 plcp_len = 0; 246 u16 plcp_len = 0;
247 __le16 rts_duration = 0; 247 __le16 rts_duration = 0;
248 248
249 prio = info->queue; 249 prio = skb_get_queue_mapping(skb);
250 ring = &priv->tx_ring[prio]; 250 ring = &priv->tx_ring[prio];
251 251
252 mapping = pci_map_single(priv->pdev, skb->data, 252 mapping = pci_map_single(priv->pdev, skb->data,
@@ -298,7 +298,7 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
298 entry->flags = cpu_to_le32(tx_flags); 298 entry->flags = cpu_to_le32(tx_flags);
299 __skb_queue_tail(&ring->queue, skb); 299 __skb_queue_tail(&ring->queue, skb);
300 if (ring->entries - skb_queue_len(&ring->queue) < 2) 300 if (ring->entries - skb_queue_len(&ring->queue) < 2)
301 ieee80211_stop_queue(dev, info->queue); 301 ieee80211_stop_queue(dev, skb_get_queue_mapping(skb));
302 spin_unlock_irqrestore(&priv->lock, flags); 302 spin_unlock_irqrestore(&priv->lock, flags);
303 303
304 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); 304 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4)));