diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-29 01:57:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-29 01:57:58 -0400 |
commit | 28f49d8fec19833672a6a813bfde0068fee50bc9 (patch) | |
tree | 6905c5cabc063e44b891ae0af5b5d7cce69e6e71 /drivers/net/wireless/rt2x00 | |
parent | 332e4af80d1214fbf0e263e1408fc7c5b64ecdd6 (diff) | |
parent | ff28bd94e307c67abb1bccda5d3a9018bd798e08 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 59 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 100 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 51 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.c | 126 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.c | 141 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.h | 35 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00rfkill.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 103 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 8 |
15 files changed, 363 insertions, 343 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index bb3d83560d02..b3dffcfed835 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -632,15 +632,15 @@ static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev, | |||
632 | struct queue_entry *entry) | 632 | struct queue_entry *entry) |
633 | { | 633 | { |
634 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 634 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
635 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
635 | u32 word; | 636 | u32 word; |
636 | 637 | ||
637 | rt2x00_desc_read(entry_priv->desc, 2, &word); | 638 | rt2x00_desc_read(entry_priv->desc, 2, &word); |
638 | rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, | 639 | rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, entry->skb->len); |
639 | entry->queue->data_size); | ||
640 | rt2x00_desc_write(entry_priv->desc, 2, word); | 640 | rt2x00_desc_write(entry_priv->desc, 2, word); |
641 | 641 | ||
642 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 642 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
643 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, entry_priv->data_dma); | 643 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
644 | rt2x00_desc_write(entry_priv->desc, 1, word); | 644 | rt2x00_desc_write(entry_priv->desc, 1, word); |
645 | 645 | ||
646 | rt2x00_desc_read(entry_priv->desc, 0, &word); | 646 | rt2x00_desc_read(entry_priv->desc, 0, &word); |
@@ -1012,7 +1012,7 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1012 | * Start writing the descriptor words. | 1012 | * Start writing the descriptor words. |
1013 | */ | 1013 | */ |
1014 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1014 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
1015 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, entry_priv->data_dma); | 1015 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1016 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1016 | rt2x00_desc_write(entry_priv->desc, 1, word); |
1017 | 1017 | ||
1018 | rt2x00_desc_read(txd, 2, &word); | 1018 | rt2x00_desc_read(txd, 2, &word); |
@@ -1154,7 +1154,7 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, | |||
1154 | } | 1154 | } |
1155 | txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); | 1155 | txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); |
1156 | 1156 | ||
1157 | rt2x00pci_txdone(rt2x00dev, entry, &txdesc); | 1157 | rt2x00lib_txdone(entry, &txdesc); |
1158 | } | 1158 | } |
1159 | } | 1159 | } |
1160 | 1160 | ||
@@ -1366,7 +1366,7 @@ static void rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1366 | IEEE80211_HW_SIGNAL_DBM; | 1366 | IEEE80211_HW_SIGNAL_DBM; |
1367 | rt2x00dev->hw->extra_tx_headroom = 0; | 1367 | rt2x00dev->hw->extra_tx_headroom = 0; |
1368 | 1368 | ||
1369 | SET_IEEE80211_DEV(rt2x00dev->hw, &rt2x00dev_pci(rt2x00dev)->dev); | 1369 | SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); |
1370 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, | 1370 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, |
1371 | rt2x00_eeprom_addr(rt2x00dev, | 1371 | rt2x00_eeprom_addr(rt2x00dev, |
1372 | EEPROM_MAC_ADDR_0)); | 1372 | EEPROM_MAC_ADDR_0)); |
@@ -1412,9 +1412,10 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1412 | rt2400pci_probe_hw_mode(rt2x00dev); | 1412 | rt2400pci_probe_hw_mode(rt2x00dev); |
1413 | 1413 | ||
1414 | /* | 1414 | /* |
1415 | * This device requires the atim queue | 1415 | * This device requires the atim queue and DMA-mapped skbs. |
1416 | */ | 1416 | */ |
1417 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); | 1417 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); |
1418 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); | ||
1418 | 1419 | ||
1419 | /* | 1420 | /* |
1420 | * Set the rssi offset. | 1421 | * Set the rssi offset. |
@@ -1526,7 +1527,7 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1526 | * Write entire beacon with descriptor to register, | 1527 | * Write entire beacon with descriptor to register, |
1527 | * and kick the beacon generator. | 1528 | * and kick the beacon generator. |
1528 | */ | 1529 | */ |
1529 | memcpy(entry_priv->data, skb->data, skb->len); | 1530 | rt2x00queue_map_txskb(rt2x00dev, intf->beacon->skb); |
1530 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); | 1531 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); |
1531 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); | 1532 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); |
1532 | 1533 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 3c956b91c4e3..0423c251c78e 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -727,10 +727,11 @@ static void rt2500pci_init_rxentry(struct rt2x00_dev *rt2x00dev, | |||
727 | struct queue_entry *entry) | 727 | struct queue_entry *entry) |
728 | { | 728 | { |
729 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 729 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
730 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
730 | u32 word; | 731 | u32 word; |
731 | 732 | ||
732 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 733 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
733 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, entry_priv->data_dma); | 734 | rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
734 | rt2x00_desc_write(entry_priv->desc, 1, word); | 735 | rt2x00_desc_write(entry_priv->desc, 1, word); |
735 | 736 | ||
736 | rt2x00_desc_read(entry_priv->desc, 0, &word); | 737 | rt2x00_desc_read(entry_priv->desc, 0, &word); |
@@ -1171,7 +1172,7 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1171 | * Start writing the descriptor words. | 1172 | * Start writing the descriptor words. |
1172 | */ | 1173 | */ |
1173 | rt2x00_desc_read(entry_priv->desc, 1, &word); | 1174 | rt2x00_desc_read(entry_priv->desc, 1, &word); |
1174 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, entry_priv->data_dma); | 1175 | rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); |
1175 | rt2x00_desc_write(entry_priv->desc, 1, word); | 1176 | rt2x00_desc_write(entry_priv->desc, 1, word); |
1176 | 1177 | ||
1177 | rt2x00_desc_read(txd, 2, &word); | 1178 | rt2x00_desc_read(txd, 2, &word); |
@@ -1311,7 +1312,7 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, | |||
1311 | } | 1312 | } |
1312 | txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); | 1313 | txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); |
1313 | 1314 | ||
1314 | rt2x00pci_txdone(rt2x00dev, entry, &txdesc); | 1315 | rt2x00lib_txdone(entry, &txdesc); |
1315 | } | 1316 | } |
1316 | } | 1317 | } |
1317 | 1318 | ||
@@ -1688,7 +1689,7 @@ static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1688 | 1689 | ||
1689 | rt2x00dev->hw->extra_tx_headroom = 0; | 1690 | rt2x00dev->hw->extra_tx_headroom = 0; |
1690 | 1691 | ||
1691 | SET_IEEE80211_DEV(rt2x00dev->hw, &rt2x00dev_pci(rt2x00dev)->dev); | 1692 | SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); |
1692 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, | 1693 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, |
1693 | rt2x00_eeprom_addr(rt2x00dev, | 1694 | rt2x00_eeprom_addr(rt2x00dev, |
1694 | EEPROM_MAC_ADDR_0)); | 1695 | EEPROM_MAC_ADDR_0)); |
@@ -1752,9 +1753,10 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1752 | rt2500pci_probe_hw_mode(rt2x00dev); | 1753 | rt2500pci_probe_hw_mode(rt2x00dev); |
1753 | 1754 | ||
1754 | /* | 1755 | /* |
1755 | * This device requires the atim queue | 1756 | * This device requires the atim queue and DMA-mapped skbs. |
1756 | */ | 1757 | */ |
1757 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); | 1758 | __set_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); |
1759 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); | ||
1758 | 1760 | ||
1759 | /* | 1761 | /* |
1760 | * Set the rssi offset. | 1762 | * Set the rssi offset. |
@@ -1842,7 +1844,7 @@ static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1842 | * Write entire beacon with descriptor to register, | 1844 | * Write entire beacon with descriptor to register, |
1843 | * and kick the beacon generator. | 1845 | * and kick the beacon generator. |
1844 | */ | 1846 | */ |
1845 | memcpy(entry_priv->data, skb->data, skb->len); | 1847 | rt2x00queue_map_txskb(rt2x00dev, intf->beacon->skb); |
1846 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); | 1848 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); |
1847 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); | 1849 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); |
1848 | 1850 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 0462d6d35b8a..0dd1cb537b92 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1594,7 +1594,7 @@ static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1594 | 1594 | ||
1595 | rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE; | 1595 | rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE; |
1596 | 1596 | ||
1597 | SET_IEEE80211_DEV(rt2x00dev->hw, &rt2x00dev_usb(rt2x00dev)->dev); | 1597 | SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); |
1598 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, | 1598 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, |
1599 | rt2x00_eeprom_addr(rt2x00dev, | 1599 | rt2x00_eeprom_addr(rt2x00dev, |
1600 | EEPROM_MAC_ADDR_0)); | 1600 | EEPROM_MAC_ADDR_0)); |
@@ -1678,7 +1678,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1678 | static int rt2500usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | 1678 | static int rt2500usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) |
1679 | { | 1679 | { |
1680 | struct rt2x00_dev *rt2x00dev = hw->priv; | 1680 | struct rt2x00_dev *rt2x00dev = hw->priv; |
1681 | struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev); | 1681 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
1682 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1682 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1683 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); | 1683 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); |
1684 | struct queue_entry_priv_usb_bcn *bcn_priv; | 1684 | struct queue_entry_priv_usb_bcn *bcn_priv; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 52d8e9688219..6842464dcf3e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -44,7 +44,7 @@ | |||
44 | /* | 44 | /* |
45 | * Module information. | 45 | * Module information. |
46 | */ | 46 | */ |
47 | #define DRV_VERSION "2.1.7" | 47 | #define DRV_VERSION "2.1.8" |
48 | #define DRV_PROJECT "http://rt2x00.serialmonkey.com" | 48 | #define DRV_PROJECT "http://rt2x00.serialmonkey.com" |
49 | 49 | ||
50 | /* | 50 | /* |
@@ -111,33 +111,6 @@ | |||
111 | #define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) | 111 | #define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) |
112 | 112 | ||
113 | /* | 113 | /* |
114 | * IEEE802.11 header defines | ||
115 | */ | ||
116 | static inline int is_rts_frame(u16 fc) | ||
117 | { | ||
118 | return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && | ||
119 | ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)); | ||
120 | } | ||
121 | |||
122 | static inline int is_cts_frame(u16 fc) | ||
123 | { | ||
124 | return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && | ||
125 | ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_CTS)); | ||
126 | } | ||
127 | |||
128 | static inline int is_probe_resp(u16 fc) | ||
129 | { | ||
130 | return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && | ||
131 | ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP)); | ||
132 | } | ||
133 | |||
134 | static inline int is_beacon(u16 fc) | ||
135 | { | ||
136 | return (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && | ||
137 | ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON)); | ||
138 | } | ||
139 | |||
140 | /* | ||
141 | * Chipset identification | 114 | * Chipset identification |
142 | * The chipset on the device is composed of a RT and RF chip. | 115 | * The chipset on the device is composed of a RT and RF chip. |
143 | * The chipset combination is important for determining device capabilities. | 116 | * The chipset combination is important for determining device capabilities. |
@@ -628,6 +601,7 @@ enum rt2x00_flags { | |||
628 | DRIVER_REQUIRE_BEACON_GUARD, | 601 | DRIVER_REQUIRE_BEACON_GUARD, |
629 | DRIVER_REQUIRE_ATIM_QUEUE, | 602 | DRIVER_REQUIRE_ATIM_QUEUE, |
630 | DRIVER_REQUIRE_SCHEDULED, | 603 | DRIVER_REQUIRE_SCHEDULED, |
604 | DRIVER_REQUIRE_DMA, | ||
631 | 605 | ||
632 | /* | 606 | /* |
633 | * Driver configuration | 607 | * Driver configuration |
@@ -652,11 +626,7 @@ struct rt2x00_dev { | |||
652 | * When accessing this variable, the rt2x00dev_{pci,usb} | 626 | * When accessing this variable, the rt2x00dev_{pci,usb} |
653 | * macro's should be used for correct typecasting. | 627 | * macro's should be used for correct typecasting. |
654 | */ | 628 | */ |
655 | void *dev; | 629 | struct device *dev; |
656 | #define rt2x00dev_pci(__dev) ( (struct pci_dev *)(__dev)->dev ) | ||
657 | #define rt2x00dev_usb(__dev) ( (struct usb_interface *)(__dev)->dev ) | ||
658 | #define rt2x00dev_usb_dev(__dev)\ | ||
659 | ( (struct usb_device *)interface_to_usbdev(rt2x00dev_usb(__dev)) ) | ||
660 | 630 | ||
661 | /* | 631 | /* |
662 | * Callback functions. | 632 | * Callback functions. |
@@ -931,10 +901,11 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate) | |||
931 | } | 901 | } |
932 | 902 | ||
933 | /** | 903 | /** |
934 | * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. | 904 | * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. |
935 | * @queue: The queue for which the skb will be applicable. | 905 | * @rt2x00dev: Pointer to &struct rt2x00_dev. |
906 | * @skb: The skb to map. | ||
936 | */ | 907 | */ |
937 | struct sk_buff *rt2x00queue_alloc_rxskb(struct data_queue *queue); | 908 | void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); |
938 | 909 | ||
939 | /** | 910 | /** |
940 | * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input | 911 | * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input |
@@ -985,26 +956,14 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, | |||
985 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, | 956 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, |
986 | enum queue_index index); | 957 | enum queue_index index); |
987 | 958 | ||
988 | /** | ||
989 | * rt2x00queue_index_inc - Index incrementation function | ||
990 | * @queue: Queue (&struct data_queue) to perform the action on. | ||
991 | * @index: Index type (&enum queue_index) to perform the action on. | ||
992 | * | ||
993 | * This function will increase the requested index on the queue, | ||
994 | * it will grab the appropriate locks and handle queue overflow events by | ||
995 | * resetting the index to the start of the queue. | ||
996 | */ | ||
997 | void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index); | ||
998 | |||
999 | |||
1000 | /* | 959 | /* |
1001 | * Interrupt context handlers. | 960 | * Interrupt context handlers. |
1002 | */ | 961 | */ |
1003 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); | 962 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); |
1004 | void rt2x00lib_txdone(struct queue_entry *entry, | 963 | void rt2x00lib_txdone(struct queue_entry *entry, |
1005 | struct txdone_entry_desc *txdesc); | 964 | struct txdone_entry_desc *txdesc); |
1006 | void rt2x00lib_rxdone(struct queue_entry *entry, | 965 | void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, |
1007 | struct rxdone_entry_desc *rxdesc); | 966 | struct queue_entry *entry); |
1008 | 967 | ||
1009 | /* | 968 | /* |
1010 | * mac80211 handlers. | 969 | * mac80211 handlers. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index cc4fee105ed6..ae8ab71fe474 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -469,12 +469,19 @@ static void rt2x00lib_intf_scheduled(struct work_struct *work) | |||
469 | static void rt2x00lib_beacondone_iter(void *data, u8 *mac, | 469 | static void rt2x00lib_beacondone_iter(void *data, u8 *mac, |
470 | struct ieee80211_vif *vif) | 470 | struct ieee80211_vif *vif) |
471 | { | 471 | { |
472 | struct rt2x00_dev *rt2x00dev = data; | ||
472 | struct rt2x00_intf *intf = vif_to_intf(vif); | 473 | struct rt2x00_intf *intf = vif_to_intf(vif); |
473 | 474 | ||
474 | if (vif->type != IEEE80211_IF_TYPE_AP && | 475 | if (vif->type != IEEE80211_IF_TYPE_AP && |
475 | vif->type != IEEE80211_IF_TYPE_IBSS) | 476 | vif->type != IEEE80211_IF_TYPE_IBSS) |
476 | return; | 477 | return; |
477 | 478 | ||
479 | /* | ||
480 | * Clean up the beacon skb. | ||
481 | */ | ||
482 | rt2x00queue_free_skb(rt2x00dev, intf->beacon->skb); | ||
483 | intf->beacon->skb = NULL; | ||
484 | |||
478 | spin_lock(&intf->lock); | 485 | spin_lock(&intf->lock); |
479 | intf->delayed_flags |= DELAYED_UPDATE_BEACON; | 486 | intf->delayed_flags |= DELAYED_UPDATE_BEACON; |
480 | spin_unlock(&intf->lock); | 487 | spin_unlock(&intf->lock); |
@@ -498,6 +505,12 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
498 | { | 505 | { |
499 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 506 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
500 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); | 507 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
508 | enum data_queue_qid qid = skb_get_queue_mapping(entry->skb); | ||
509 | |||
510 | /* | ||
511 | * Unmap the skb. | ||
512 | */ | ||
513 | rt2x00queue_unmap_skb(rt2x00dev, entry->skb); | ||
501 | 514 | ||
502 | /* | 515 | /* |
503 | * Send frame to debugfs immediately, after this call is completed | 516 | * Send frame to debugfs immediately, after this call is completed |
@@ -546,39 +559,77 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
546 | ieee80211_tx_status_irqsafe(rt2x00dev->hw, entry->skb); | 559 | ieee80211_tx_status_irqsafe(rt2x00dev->hw, entry->skb); |
547 | else | 560 | else |
548 | dev_kfree_skb_irq(entry->skb); | 561 | dev_kfree_skb_irq(entry->skb); |
562 | |||
563 | /* | ||
564 | * Make this entry available for reuse. | ||
565 | */ | ||
549 | entry->skb = NULL; | 566 | entry->skb = NULL; |
567 | entry->flags = 0; | ||
568 | |||
569 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry); | ||
570 | |||
571 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | ||
572 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); | ||
573 | |||
574 | /* | ||
575 | * If the data queue was below the threshold before the txdone | ||
576 | * handler we must make sure the packet queue in the mac80211 stack | ||
577 | * is reenabled when the txdone handler has finished. | ||
578 | */ | ||
579 | if (!rt2x00queue_threshold(entry->queue)) | ||
580 | ieee80211_wake_queue(rt2x00dev->hw, qid); | ||
550 | } | 581 | } |
551 | EXPORT_SYMBOL_GPL(rt2x00lib_txdone); | 582 | EXPORT_SYMBOL_GPL(rt2x00lib_txdone); |
552 | 583 | ||
553 | void rt2x00lib_rxdone(struct queue_entry *entry, | 584 | void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, |
554 | struct rxdone_entry_desc *rxdesc) | 585 | struct queue_entry *entry) |
555 | { | 586 | { |
556 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 587 | struct rxdone_entry_desc rxdesc; |
588 | struct sk_buff *skb; | ||
557 | struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status; | 589 | struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status; |
558 | unsigned int header_size = ieee80211_get_hdrlen_from_skb(entry->skb); | ||
559 | struct ieee80211_supported_band *sband; | 590 | struct ieee80211_supported_band *sband; |
560 | struct ieee80211_hdr *hdr; | 591 | struct ieee80211_hdr *hdr; |
561 | const struct rt2x00_rate *rate; | 592 | const struct rt2x00_rate *rate; |
593 | unsigned int header_size; | ||
562 | unsigned int align; | 594 | unsigned int align; |
563 | unsigned int i; | 595 | unsigned int i; |
564 | int idx = -1; | 596 | int idx = -1; |
565 | u16 fc; | 597 | |
598 | /* | ||
599 | * Allocate a new sk_buffer. If no new buffer available, drop the | ||
600 | * received frame and reuse the existing buffer. | ||
601 | */ | ||
602 | skb = rt2x00queue_alloc_rxskb(rt2x00dev, entry); | ||
603 | if (!skb) | ||
604 | return; | ||
605 | |||
606 | /* | ||
607 | * Unmap the skb. | ||
608 | */ | ||
609 | rt2x00queue_unmap_skb(rt2x00dev, entry->skb); | ||
610 | |||
611 | /* | ||
612 | * Extract the RXD details. | ||
613 | */ | ||
614 | memset(&rxdesc, 0, sizeof(rxdesc)); | ||
615 | rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); | ||
566 | 616 | ||
567 | /* | 617 | /* |
568 | * The data behind the ieee80211 header must be | 618 | * The data behind the ieee80211 header must be |
569 | * aligned on a 4 byte boundary. | 619 | * aligned on a 4 byte boundary. |
570 | */ | 620 | */ |
621 | header_size = ieee80211_get_hdrlen_from_skb(entry->skb); | ||
571 | align = ((unsigned long)(entry->skb->data + header_size)) & 3; | 622 | align = ((unsigned long)(entry->skb->data + header_size)) & 3; |
572 | 623 | ||
573 | if (align) { | 624 | if (align) { |
574 | skb_push(entry->skb, align); | 625 | skb_push(entry->skb, align); |
575 | /* Move entire frame in 1 command */ | 626 | /* Move entire frame in 1 command */ |
576 | memmove(entry->skb->data, entry->skb->data + align, | 627 | memmove(entry->skb->data, entry->skb->data + align, |
577 | rxdesc->size); | 628 | rxdesc.size); |
578 | } | 629 | } |
579 | 630 | ||
580 | /* Update data pointers, trim buffer to correct size */ | 631 | /* Update data pointers, trim buffer to correct size */ |
581 | skb_trim(entry->skb, rxdesc->size); | 632 | skb_trim(entry->skb, rxdesc.size); |
582 | 633 | ||
583 | /* | 634 | /* |
584 | * Update RX statistics. | 635 | * Update RX statistics. |
@@ -587,10 +638,10 @@ void rt2x00lib_rxdone(struct queue_entry *entry, | |||
587 | for (i = 0; i < sband->n_bitrates; i++) { | 638 | for (i = 0; i < sband->n_bitrates; i++) { |
588 | rate = rt2x00_get_rate(sband->bitrates[i].hw_value); | 639 | rate = rt2x00_get_rate(sband->bitrates[i].hw_value); |
589 | 640 | ||
590 | if (((rxdesc->dev_flags & RXDONE_SIGNAL_PLCP) && | 641 | if (((rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && |
591 | (rate->plcp == rxdesc->signal)) || | 642 | (rate->plcp == rxdesc.signal)) || |
592 | (!(rxdesc->dev_flags & RXDONE_SIGNAL_PLCP) && | 643 | (!(rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && |
593 | (rate->bitrate == rxdesc->signal))) { | 644 | (rate->bitrate == rxdesc.signal))) { |
594 | idx = i; | 645 | idx = i; |
595 | break; | 646 | break; |
596 | } | 647 | } |
@@ -598,8 +649,8 @@ void rt2x00lib_rxdone(struct queue_entry *entry, | |||
598 | 649 | ||
599 | if (idx < 0) { | 650 | if (idx < 0) { |
600 | WARNING(rt2x00dev, "Frame received with unrecognized signal," | 651 | WARNING(rt2x00dev, "Frame received with unrecognized signal," |
601 | "signal=0x%.2x, plcp=%d.\n", rxdesc->signal, | 652 | "signal=0x%.2x, plcp=%d.\n", rxdesc.signal, |
602 | !!(rxdesc->dev_flags & RXDONE_SIGNAL_PLCP)); | 653 | !!(rxdesc.dev_flags & RXDONE_SIGNAL_PLCP)); |
603 | idx = 0; | 654 | idx = 0; |
604 | } | 655 | } |
605 | 656 | ||
@@ -607,17 +658,17 @@ void rt2x00lib_rxdone(struct queue_entry *entry, | |||
607 | * Only update link status if this is a beacon frame carrying our bssid. | 658 | * Only update link status if this is a beacon frame carrying our bssid. |
608 | */ | 659 | */ |
609 | hdr = (struct ieee80211_hdr *)entry->skb->data; | 660 | hdr = (struct ieee80211_hdr *)entry->skb->data; |
610 | fc = le16_to_cpu(hdr->frame_control); | 661 | if (ieee80211_is_beacon(hdr->frame_control) && |
611 | if (is_beacon(fc) && (rxdesc->dev_flags & RXDONE_MY_BSS)) | 662 | (rxdesc.dev_flags & RXDONE_MY_BSS)) |
612 | rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc->rssi); | 663 | rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc.rssi); |
613 | 664 | ||
614 | rt2x00dev->link.qual.rx_success++; | 665 | rt2x00dev->link.qual.rx_success++; |
615 | 666 | ||
616 | rx_status->rate_idx = idx; | 667 | rx_status->rate_idx = idx; |
617 | rx_status->qual = | 668 | rx_status->qual = |
618 | rt2x00lib_calculate_link_signal(rt2x00dev, rxdesc->rssi); | 669 | rt2x00lib_calculate_link_signal(rt2x00dev, rxdesc.rssi); |
619 | rx_status->signal = rxdesc->rssi; | 670 | rx_status->signal = rxdesc.rssi; |
620 | rx_status->flag = rxdesc->flags; | 671 | rx_status->flag = rxdesc.flags; |
621 | rx_status->antenna = rt2x00dev->link.ant.active.rx; | 672 | rx_status->antenna = rt2x00dev->link.ant.active.rx; |
622 | 673 | ||
623 | /* | 674 | /* |
@@ -626,7 +677,16 @@ void rt2x00lib_rxdone(struct queue_entry *entry, | |||
626 | */ | 677 | */ |
627 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry->skb); | 678 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry->skb); |
628 | ieee80211_rx_irqsafe(rt2x00dev->hw, entry->skb, rx_status); | 679 | ieee80211_rx_irqsafe(rt2x00dev->hw, entry->skb, rx_status); |
629 | entry->skb = NULL; | 680 | |
681 | /* | ||
682 | * Replace the skb with the freshly allocated one. | ||
683 | */ | ||
684 | entry->skb = skb; | ||
685 | entry->flags = 0; | ||
686 | |||
687 | rt2x00dev->ops->lib->init_rxentry(rt2x00dev, entry); | ||
688 | |||
689 | rt2x00queue_index_inc(entry->queue, Q_INDEX); | ||
630 | } | 690 | } |
631 | EXPORT_SYMBOL_GPL(rt2x00lib_rxdone); | 691 | EXPORT_SYMBOL_GPL(rt2x00lib_rxdone); |
632 | 692 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 558f45bf27e3..1d1f0749375e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -98,10 +98,57 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
98 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | 98 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, |
99 | struct ieee80211_conf *conf, const int force_config); | 99 | struct ieee80211_conf *conf, const int force_config); |
100 | 100 | ||
101 | /* | 101 | /** |
102 | * Queue handlers. | 102 | * DOC: Queue handlers |
103 | */ | ||
104 | |||
105 | /** | ||
106 | * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. | ||
107 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
108 | * @queue: The queue for which the skb will be applicable. | ||
109 | */ | ||
110 | struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev, | ||
111 | struct queue_entry *entry); | ||
112 | |||
113 | /** | ||
114 | * rt2x00queue_unmap_skb - Unmap a skb from DMA. | ||
115 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
116 | * @skb: The skb to unmap. | ||
117 | */ | ||
118 | void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | ||
119 | |||
120 | /** | ||
121 | * rt2x00queue_free_skb - free a skb | ||
122 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
123 | * @skb: The skb to free. | ||
124 | */ | ||
125 | void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | ||
126 | |||
127 | /** | ||
128 | * rt2x00queue_free_skb - free a skb | ||
129 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
130 | * @skb: The skb to free. | ||
131 | */ | ||
132 | void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | ||
133 | |||
134 | /** | ||
135 | * rt2x00queue_write_tx_frame - Write TX frame to hardware | ||
136 | * @queue: Queue over which the frame should be send | ||
137 | * @skb: The skb to send | ||
103 | */ | 138 | */ |
104 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb); | 139 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb); |
140 | |||
141 | /** | ||
142 | * rt2x00queue_index_inc - Index incrementation function | ||
143 | * @queue: Queue (&struct data_queue) to perform the action on. | ||
144 | * @index: Index type (&enum queue_index) to perform the action on. | ||
145 | * | ||
146 | * This function will increase the requested index on the queue, | ||
147 | * it will grab the appropriate locks and handle queue overflow events by | ||
148 | * resetting the index to the start of the queue. | ||
149 | */ | ||
150 | void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index); | ||
151 | |||
105 | void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev); | 152 | void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev); |
106 | void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev); | 153 | void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev); |
107 | int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev); | 154 | int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 8d6ad18d3890..adf2876ed8ab 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -60,12 +60,8 @@ int rt2x00pci_write_tx_data(struct queue_entry *entry) | |||
60 | * Fill in skb descriptor | 60 | * Fill in skb descriptor |
61 | */ | 61 | */ |
62 | skbdesc = get_skb_frame_desc(entry->skb); | 62 | skbdesc = get_skb_frame_desc(entry->skb); |
63 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
64 | skbdesc->desc = entry_priv->desc; | 63 | skbdesc->desc = entry_priv->desc; |
65 | skbdesc->desc_len = entry->queue->desc_size; | 64 | skbdesc->desc_len = entry->queue->desc_size; |
66 | skbdesc->entry = entry; | ||
67 | |||
68 | memcpy(entry_priv->data, entry->skb->data, entry->skb->len); | ||
69 | 65 | ||
70 | return 0; | 66 | return 0; |
71 | } | 67 | } |
@@ -80,7 +76,6 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
80 | struct queue_entry *entry; | 76 | struct queue_entry *entry; |
81 | struct queue_entry_priv_pci *entry_priv; | 77 | struct queue_entry_priv_pci *entry_priv; |
82 | struct skb_frame_desc *skbdesc; | 78 | struct skb_frame_desc *skbdesc; |
83 | struct rxdone_entry_desc rxdesc; | ||
84 | u32 word; | 79 | u32 word; |
85 | 80 | ||
86 | while (1) { | 81 | while (1) { |
@@ -91,110 +86,27 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
91 | if (rt2x00_get_field32(word, RXD_ENTRY_OWNER_NIC)) | 86 | if (rt2x00_get_field32(word, RXD_ENTRY_OWNER_NIC)) |
92 | break; | 87 | break; |
93 | 88 | ||
94 | memset(&rxdesc, 0, sizeof(rxdesc)); | ||
95 | rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); | ||
96 | |||
97 | /* | 89 | /* |
98 | * Allocate the sk_buffer and copy all data into it. | 90 | * Fill in desc fields of the skb descriptor |
99 | */ | ||
100 | entry->skb = rt2x00queue_alloc_rxskb(queue); | ||
101 | if (!entry->skb) | ||
102 | return; | ||
103 | |||
104 | memcpy(entry->skb->data, entry_priv->data, rxdesc.size); | ||
105 | skb_trim(entry->skb, rxdesc.size); | ||
106 | |||
107 | /* | ||
108 | * Fill in skb descriptor | ||
109 | */ | 91 | */ |
110 | skbdesc = get_skb_frame_desc(entry->skb); | 92 | skbdesc = get_skb_frame_desc(entry->skb); |
111 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
112 | skbdesc->desc = entry_priv->desc; | 93 | skbdesc->desc = entry_priv->desc; |
113 | skbdesc->desc_len = queue->desc_size; | 94 | skbdesc->desc_len = entry->queue->desc_size; |
114 | skbdesc->entry = entry; | ||
115 | 95 | ||
116 | /* | 96 | /* |
117 | * Send the frame to rt2x00lib for further processing. | 97 | * Send the frame to rt2x00lib for further processing. |
118 | */ | 98 | */ |
119 | rt2x00lib_rxdone(entry, &rxdesc); | 99 | rt2x00lib_rxdone(rt2x00dev, entry); |
120 | |||
121 | if (test_bit(DEVICE_ENABLED_RADIO, &queue->rt2x00dev->flags)) { | ||
122 | rt2x00_set_field32(&word, RXD_ENTRY_OWNER_NIC, 1); | ||
123 | rt2x00_desc_write(entry_priv->desc, 0, word); | ||
124 | } | ||
125 | |||
126 | rt2x00queue_index_inc(queue, Q_INDEX); | ||
127 | } | 100 | } |
128 | } | 101 | } |
129 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); | 102 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); |
130 | 103 | ||
131 | void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry, | ||
132 | struct txdone_entry_desc *txdesc) | ||
133 | { | ||
134 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | ||
135 | enum data_queue_qid qid = skb_get_queue_mapping(entry->skb); | ||
136 | u32 word; | ||
137 | |||
138 | rt2x00lib_txdone(entry, txdesc); | ||
139 | |||
140 | /* | ||
141 | * Make this entry available for reuse. | ||
142 | */ | ||
143 | entry->flags = 0; | ||
144 | |||
145 | rt2x00_desc_read(entry_priv->desc, 0, &word); | ||
146 | rt2x00_set_field32(&word, TXD_ENTRY_OWNER_NIC, 0); | ||
147 | rt2x00_set_field32(&word, TXD_ENTRY_VALID, 0); | ||
148 | rt2x00_desc_write(entry_priv->desc, 0, word); | ||
149 | |||
150 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | ||
151 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); | ||
152 | |||
153 | /* | ||
154 | * If the data queue was below the threshold before the txdone | ||
155 | * handler we must make sure the packet queue in the mac80211 stack | ||
156 | * is reenabled when the txdone handler has finished. | ||
157 | */ | ||
158 | if (!rt2x00queue_threshold(entry->queue)) | ||
159 | ieee80211_wake_queue(rt2x00dev->hw, qid); | ||
160 | |||
161 | } | ||
162 | EXPORT_SYMBOL_GPL(rt2x00pci_txdone); | ||
163 | |||
164 | /* | 104 | /* |
165 | * Device initialization handlers. | 105 | * Device initialization handlers. |
166 | */ | 106 | */ |
167 | #define desc_size(__queue) \ | ||
168 | ({ \ | ||
169 | ((__queue)->limit * (__queue)->desc_size);\ | ||
170 | }) | ||
171 | |||
172 | #define data_size(__queue) \ | ||
173 | ({ \ | ||
174 | ((__queue)->limit * (__queue)->data_size);\ | ||
175 | }) | ||
176 | |||
177 | #define dma_size(__queue) \ | ||
178 | ({ \ | ||
179 | data_size(__queue) + desc_size(__queue);\ | ||
180 | }) | ||
181 | |||
182 | #define desc_offset(__queue, __base, __i) \ | ||
183 | ({ \ | ||
184 | (__base) + data_size(__queue) + \ | ||
185 | ((__i) * (__queue)->desc_size); \ | ||
186 | }) | ||
187 | |||
188 | #define data_offset(__queue, __base, __i) \ | ||
189 | ({ \ | ||
190 | (__base) + \ | ||
191 | ((__i) * (__queue)->data_size); \ | ||
192 | }) | ||
193 | |||
194 | static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | 107 | static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, |
195 | struct data_queue *queue) | 108 | struct data_queue *queue) |
196 | { | 109 | { |
197 | struct pci_dev *pci_dev = rt2x00dev_pci(rt2x00dev); | ||
198 | struct queue_entry_priv_pci *entry_priv; | 110 | struct queue_entry_priv_pci *entry_priv; |
199 | void *addr; | 111 | void *addr; |
200 | dma_addr_t dma; | 112 | dma_addr_t dma; |
@@ -203,21 +115,21 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | |||
203 | /* | 115 | /* |
204 | * Allocate DMA memory for descriptor and buffer. | 116 | * Allocate DMA memory for descriptor and buffer. |
205 | */ | 117 | */ |
206 | addr = pci_alloc_consistent(pci_dev, dma_size(queue), &dma); | 118 | addr = dma_alloc_coherent(rt2x00dev->dev, |
119 | queue->limit * queue->desc_size, | ||
120 | &dma, GFP_KERNEL | GFP_DMA); | ||
207 | if (!addr) | 121 | if (!addr) |
208 | return -ENOMEM; | 122 | return -ENOMEM; |
209 | 123 | ||
210 | memset(addr, 0, dma_size(queue)); | 124 | memset(addr, 0, queue->limit * queue->desc_size); |
211 | 125 | ||
212 | /* | 126 | /* |
213 | * Initialize all queue entries to contain valid addresses. | 127 | * Initialize all queue entries to contain valid addresses. |
214 | */ | 128 | */ |
215 | for (i = 0; i < queue->limit; i++) { | 129 | for (i = 0; i < queue->limit; i++) { |
216 | entry_priv = queue->entries[i].priv_data; | 130 | entry_priv = queue->entries[i].priv_data; |
217 | entry_priv->desc = desc_offset(queue, addr, i); | 131 | entry_priv->desc = addr + i * queue->desc_size; |
218 | entry_priv->desc_dma = desc_offset(queue, dma, i); | 132 | entry_priv->desc_dma = dma + i * queue->desc_size; |
219 | entry_priv->data = data_offset(queue, addr, i); | ||
220 | entry_priv->data_dma = data_offset(queue, dma, i); | ||
221 | } | 133 | } |
222 | 134 | ||
223 | return 0; | 135 | return 0; |
@@ -226,19 +138,19 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | |||
226 | static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, | 138 | static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev, |
227 | struct data_queue *queue) | 139 | struct data_queue *queue) |
228 | { | 140 | { |
229 | struct pci_dev *pci_dev = rt2x00dev_pci(rt2x00dev); | ||
230 | struct queue_entry_priv_pci *entry_priv = | 141 | struct queue_entry_priv_pci *entry_priv = |
231 | queue->entries[0].priv_data; | 142 | queue->entries[0].priv_data; |
232 | 143 | ||
233 | if (entry_priv->data) | 144 | if (entry_priv->desc) |
234 | pci_free_consistent(pci_dev, dma_size(queue), | 145 | dma_free_coherent(rt2x00dev->dev, |
235 | entry_priv->data, entry_priv->data_dma); | 146 | queue->limit * queue->desc_size, |
236 | entry_priv->data = NULL; | 147 | entry_priv->desc, entry_priv->desc_dma); |
148 | entry_priv->desc = NULL; | ||
237 | } | 149 | } |
238 | 150 | ||
239 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) | 151 | int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) |
240 | { | 152 | { |
241 | struct pci_dev *pci_dev = rt2x00dev_pci(rt2x00dev); | 153 | struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev); |
242 | struct data_queue *queue; | 154 | struct data_queue *queue; |
243 | int status; | 155 | int status; |
244 | 156 | ||
@@ -279,7 +191,7 @@ void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
279 | /* | 191 | /* |
280 | * Free irq line. | 192 | * Free irq line. |
281 | */ | 193 | */ |
282 | free_irq(rt2x00dev_pci(rt2x00dev)->irq, rt2x00dev); | 194 | free_irq(to_pci_dev(rt2x00dev->dev)->irq, rt2x00dev); |
283 | 195 | ||
284 | /* | 196 | /* |
285 | * Free DMA | 197 | * Free DMA |
@@ -308,7 +220,7 @@ static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev) | |||
308 | 220 | ||
309 | static int rt2x00pci_alloc_reg(struct rt2x00_dev *rt2x00dev) | 221 | static int rt2x00pci_alloc_reg(struct rt2x00_dev *rt2x00dev) |
310 | { | 222 | { |
311 | struct pci_dev *pci_dev = rt2x00dev_pci(rt2x00dev); | 223 | struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev); |
312 | 224 | ||
313 | rt2x00dev->csr.base = ioremap(pci_resource_start(pci_dev, 0), | 225 | rt2x00dev->csr.base = ioremap(pci_resource_start(pci_dev, 0), |
314 | pci_resource_len(pci_dev, 0)); | 226 | pci_resource_len(pci_dev, 0)); |
@@ -357,7 +269,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) | |||
357 | if (pci_set_mwi(pci_dev)) | 269 | if (pci_set_mwi(pci_dev)) |
358 | ERROR_PROBE("MWI not available.\n"); | 270 | ERROR_PROBE("MWI not available.\n"); |
359 | 271 | ||
360 | if (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) { | 272 | if (dma_set_mask(&pci_dev->dev, DMA_32BIT_MASK)) { |
361 | ERROR_PROBE("PCI DMA not supported.\n"); | 273 | ERROR_PROBE("PCI DMA not supported.\n"); |
362 | retval = -EIO; | 274 | retval = -EIO; |
363 | goto exit_disable_device; | 275 | goto exit_disable_device; |
@@ -373,7 +285,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) | |||
373 | pci_set_drvdata(pci_dev, hw); | 285 | pci_set_drvdata(pci_dev, hw); |
374 | 286 | ||
375 | rt2x00dev = hw->priv; | 287 | rt2x00dev = hw->priv; |
376 | rt2x00dev->dev = pci_dev; | 288 | rt2x00dev->dev = &pci_dev->dev; |
377 | rt2x00dev->ops = ops; | 289 | rt2x00dev->ops = ops; |
378 | rt2x00dev->hw = hw; | 290 | rt2x00dev->hw = hw; |
379 | 291 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h index 87c4a0cd78db..50c6df4f81db 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.h +++ b/drivers/net/wireless/rt2x00/rt2x00pci.h | |||
@@ -107,9 +107,6 @@ int rt2x00pci_write_tx_data(struct queue_entry *entry); | |||
107 | struct queue_entry_priv_pci { | 107 | struct queue_entry_priv_pci { |
108 | __le32 *desc; | 108 | __le32 *desc; |
109 | dma_addr_t desc_dma; | 109 | dma_addr_t desc_dma; |
110 | |||
111 | void *data; | ||
112 | dma_addr_t data_dma; | ||
113 | }; | 110 | }; |
114 | 111 | ||
115 | /** | 112 | /** |
@@ -118,15 +115,6 @@ struct queue_entry_priv_pci { | |||
118 | */ | 115 | */ |
119 | void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); | 116 | void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); |
120 | 117 | ||
121 | /** | ||
122 | * rt2x00pci_txdone - Handle TX done events | ||
123 | * @rt2x00dev: Device pointer, see &struct rt2x00_dev. | ||
124 | * @entry: Entry which has completed the transmission of a frame. | ||
125 | * @desc: TX done descriptor | ||
126 | */ | ||
127 | void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry, | ||
128 | struct txdone_entry_desc *desc); | ||
129 | |||
130 | /* | 118 | /* |
131 | * Device initialization handlers. | 119 | * Device initialization handlers. |
132 | */ | 120 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 7b52039b01a6..8e86611791f0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -25,34 +25,30 @@ | |||
25 | 25 | ||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/dma-mapping.h> | ||
28 | 29 | ||
29 | #include "rt2x00.h" | 30 | #include "rt2x00.h" |
30 | #include "rt2x00lib.h" | 31 | #include "rt2x00lib.h" |
31 | 32 | ||
32 | struct sk_buff *rt2x00queue_alloc_rxskb(struct data_queue *queue) | 33 | struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev, |
34 | struct queue_entry *entry) | ||
33 | { | 35 | { |
34 | struct sk_buff *skb; | ||
35 | unsigned int frame_size; | 36 | unsigned int frame_size; |
36 | unsigned int reserved_size; | 37 | unsigned int reserved_size; |
38 | struct sk_buff *skb; | ||
39 | struct skb_frame_desc *skbdesc; | ||
37 | 40 | ||
38 | /* | 41 | /* |
39 | * The frame size includes descriptor size, because the | 42 | * The frame size includes descriptor size, because the |
40 | * hardware directly receive the frame into the skbuffer. | 43 | * hardware directly receive the frame into the skbuffer. |
41 | */ | 44 | */ |
42 | frame_size = queue->data_size + queue->desc_size; | 45 | frame_size = entry->queue->data_size + entry->queue->desc_size; |
43 | 46 | ||
44 | /* | 47 | /* |
45 | * For the allocation we should keep a few things in mind: | 48 | * Reserve a few bytes extra headroom to allow drivers some moving |
46 | * 1) 4byte alignment of 802.11 payload | 49 | * space (e.g. for alignment), while keeping the skb aligned. |
47 | * | ||
48 | * For (1) we need at most 4 bytes to guarentee the correct | ||
49 | * alignment. We are going to optimize the fact that the chance | ||
50 | * that the 802.11 header_size % 4 == 2 is much bigger then | ||
51 | * anything else. However since we need to move the frame up | ||
52 | * to 3 bytes to the front, which means we need to preallocate | ||
53 | * 6 bytes. | ||
54 | */ | 50 | */ |
55 | reserved_size = 6; | 51 | reserved_size = 8; |
56 | 52 | ||
57 | /* | 53 | /* |
58 | * Allocate skbuffer. | 54 | * Allocate skbuffer. |
@@ -64,9 +60,56 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct data_queue *queue) | |||
64 | skb_reserve(skb, reserved_size); | 60 | skb_reserve(skb, reserved_size); |
65 | skb_put(skb, frame_size); | 61 | skb_put(skb, frame_size); |
66 | 62 | ||
63 | /* | ||
64 | * Populate skbdesc. | ||
65 | */ | ||
66 | skbdesc = get_skb_frame_desc(skb); | ||
67 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
68 | skbdesc->entry = entry; | ||
69 | |||
70 | if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) { | ||
71 | skbdesc->skb_dma = dma_map_single(rt2x00dev->dev, | ||
72 | skb->data, | ||
73 | skb->len, | ||
74 | DMA_FROM_DEVICE); | ||
75 | skbdesc->flags |= SKBDESC_DMA_MAPPED_RX; | ||
76 | } | ||
77 | |||
67 | return skb; | 78 | return skb; |
68 | } | 79 | } |
69 | EXPORT_SYMBOL_GPL(rt2x00queue_alloc_rxskb); | 80 | |
81 | void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) | ||
82 | { | ||
83 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | ||
84 | |||
85 | skbdesc->skb_dma = dma_map_single(rt2x00dev->dev, skb->data, skb->len, | ||
86 | DMA_TO_DEVICE); | ||
87 | skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; | ||
88 | } | ||
89 | EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb); | ||
90 | |||
91 | void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) | ||
92 | { | ||
93 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | ||
94 | |||
95 | if (skbdesc->flags & SKBDESC_DMA_MAPPED_RX) { | ||
96 | dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len, | ||
97 | DMA_FROM_DEVICE); | ||
98 | skbdesc->flags &= ~SKBDESC_DMA_MAPPED_RX; | ||
99 | } | ||
100 | |||
101 | if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) { | ||
102 | dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len, | ||
103 | DMA_TO_DEVICE); | ||
104 | skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) | ||
109 | { | ||
110 | rt2x00queue_unmap_skb(rt2x00dev, skb); | ||
111 | dev_kfree_skb_any(skb); | ||
112 | } | ||
70 | 113 | ||
71 | void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | 114 | void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, |
72 | struct txentry_desc *txdesc) | 115 | struct txentry_desc *txdesc) |
@@ -80,7 +123,6 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
80 | unsigned int data_length; | 123 | unsigned int data_length; |
81 | unsigned int duration; | 124 | unsigned int duration; |
82 | unsigned int residual; | 125 | unsigned int residual; |
83 | u16 frame_control; | ||
84 | 126 | ||
85 | memset(txdesc, 0, sizeof(*txdesc)); | 127 | memset(txdesc, 0, sizeof(*txdesc)); |
86 | 128 | ||
@@ -96,11 +138,6 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
96 | data_length = entry->skb->len + 4; | 138 | data_length = entry->skb->len + 4; |
97 | 139 | ||
98 | /* | 140 | /* |
99 | * Read required fields from ieee80211 header. | ||
100 | */ | ||
101 | frame_control = le16_to_cpu(hdr->frame_control); | ||
102 | |||
103 | /* | ||
104 | * Check whether this frame is to be acked. | 141 | * Check whether this frame is to be acked. |
105 | */ | 142 | */ |
106 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) | 143 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) |
@@ -109,9 +146,10 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
109 | /* | 146 | /* |
110 | * Check if this is a RTS/CTS frame | 147 | * Check if this is a RTS/CTS frame |
111 | */ | 148 | */ |
112 | if (is_rts_frame(frame_control) || is_cts_frame(frame_control)) { | 149 | if (ieee80211_is_rts(hdr->frame_control) || |
150 | ieee80211_is_cts(hdr->frame_control)) { | ||
113 | __set_bit(ENTRY_TXD_BURST, &txdesc->flags); | 151 | __set_bit(ENTRY_TXD_BURST, &txdesc->flags); |
114 | if (is_rts_frame(frame_control)) | 152 | if (ieee80211_is_rts(hdr->frame_control)) |
115 | __set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags); | 153 | __set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags); |
116 | else | 154 | else |
117 | __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags); | 155 | __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags); |
@@ -139,7 +177,8 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, | |||
139 | * Beacons and probe responses require the tsf timestamp | 177 | * Beacons and probe responses require the tsf timestamp |
140 | * to be inserted into the frame. | 178 | * to be inserted into the frame. |
141 | */ | 179 | */ |
142 | if (txdesc->queue == QID_BEACON || is_probe_resp(frame_control)) | 180 | if (ieee80211_is_beacon(hdr->frame_control) || |
181 | ieee80211_is_probe_resp(hdr->frame_control)) | ||
143 | __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags); | 182 | __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags); |
144 | 183 | ||
145 | /* | 184 | /* |
@@ -236,6 +275,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) | |||
236 | { | 275 | { |
237 | struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); | 276 | struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); |
238 | struct txentry_desc txdesc; | 277 | struct txentry_desc txdesc; |
278 | struct skb_frame_desc *skbdesc; | ||
239 | 279 | ||
240 | if (unlikely(rt2x00queue_full(queue))) | 280 | if (unlikely(rt2x00queue_full(queue))) |
241 | return -EINVAL; | 281 | return -EINVAL; |
@@ -256,11 +296,21 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) | |||
256 | entry->skb = skb; | 296 | entry->skb = skb; |
257 | rt2x00queue_create_tx_descriptor(entry, &txdesc); | 297 | rt2x00queue_create_tx_descriptor(entry, &txdesc); |
258 | 298 | ||
299 | /* | ||
300 | * skb->cb array is now ours and we are free to use it. | ||
301 | */ | ||
302 | skbdesc = get_skb_frame_desc(entry->skb); | ||
303 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
304 | skbdesc->entry = entry; | ||
305 | |||
259 | if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) { | 306 | if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) { |
260 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | 307 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); |
261 | return -EIO; | 308 | return -EIO; |
262 | } | 309 | } |
263 | 310 | ||
311 | if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags)) | ||
312 | rt2x00queue_map_txskb(queue->rt2x00dev, skb); | ||
313 | |||
264 | __set_bit(ENTRY_DATA_PENDING, &entry->flags); | 314 | __set_bit(ENTRY_DATA_PENDING, &entry->flags); |
265 | 315 | ||
266 | rt2x00queue_index_inc(queue, Q_INDEX); | 316 | rt2x00queue_index_inc(queue, Q_INDEX); |
@@ -336,7 +386,6 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index) | |||
336 | 386 | ||
337 | spin_unlock_irqrestore(&queue->lock, irqflags); | 387 | spin_unlock_irqrestore(&queue->lock, irqflags); |
338 | } | 388 | } |
339 | EXPORT_SYMBOL_GPL(rt2x00queue_index_inc); | ||
340 | 389 | ||
341 | static void rt2x00queue_reset(struct data_queue *queue) | 390 | static void rt2x00queue_reset(struct data_queue *queue) |
342 | { | 391 | { |
@@ -426,12 +475,41 @@ static int rt2x00queue_alloc_entries(struct data_queue *queue, | |||
426 | return 0; | 475 | return 0; |
427 | } | 476 | } |
428 | 477 | ||
478 | static void rt2x00queue_free_skbs(struct rt2x00_dev *rt2x00dev, | ||
479 | struct data_queue *queue) | ||
480 | { | ||
481 | unsigned int i; | ||
482 | |||
483 | if (!queue->entries) | ||
484 | return; | ||
485 | |||
486 | for (i = 0; i < queue->limit; i++) { | ||
487 | if (queue->entries[i].skb) | ||
488 | rt2x00queue_free_skb(rt2x00dev, queue->entries[i].skb); | ||
489 | } | ||
490 | } | ||
491 | |||
492 | static int rt2x00queue_alloc_rxskbs(struct rt2x00_dev *rt2x00dev, | ||
493 | struct data_queue *queue) | ||
494 | { | ||
495 | unsigned int i; | ||
496 | struct sk_buff *skb; | ||
497 | |||
498 | for (i = 0; i < queue->limit; i++) { | ||
499 | skb = rt2x00queue_alloc_rxskb(rt2x00dev, &queue->entries[i]); | ||
500 | if (!skb) | ||
501 | return -ENOMEM; | ||
502 | queue->entries[i].skb = skb; | ||
503 | } | ||
504 | |||
505 | return 0; | ||
506 | } | ||
507 | |||
429 | int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev) | 508 | int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev) |
430 | { | 509 | { |
431 | struct data_queue *queue; | 510 | struct data_queue *queue; |
432 | int status; | 511 | int status; |
433 | 512 | ||
434 | |||
435 | status = rt2x00queue_alloc_entries(rt2x00dev->rx, rt2x00dev->ops->rx); | 513 | status = rt2x00queue_alloc_entries(rt2x00dev->rx, rt2x00dev->ops->rx); |
436 | if (status) | 514 | if (status) |
437 | goto exit; | 515 | goto exit; |
@@ -446,11 +524,14 @@ int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev) | |||
446 | if (status) | 524 | if (status) |
447 | goto exit; | 525 | goto exit; |
448 | 526 | ||
449 | if (!test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) | 527 | if (test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) { |
450 | return 0; | 528 | status = rt2x00queue_alloc_entries(&rt2x00dev->bcn[1], |
529 | rt2x00dev->ops->atim); | ||
530 | if (status) | ||
531 | goto exit; | ||
532 | } | ||
451 | 533 | ||
452 | status = rt2x00queue_alloc_entries(&rt2x00dev->bcn[1], | 534 | status = rt2x00queue_alloc_rxskbs(rt2x00dev, rt2x00dev->rx); |
453 | rt2x00dev->ops->atim); | ||
454 | if (status) | 535 | if (status) |
455 | goto exit; | 536 | goto exit; |
456 | 537 | ||
@@ -468,6 +549,8 @@ void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
468 | { | 549 | { |
469 | struct data_queue *queue; | 550 | struct data_queue *queue; |
470 | 551 | ||
552 | rt2x00queue_free_skbs(rt2x00dev, rt2x00dev->rx); | ||
553 | |||
471 | queue_for_each(rt2x00dev, queue) { | 554 | queue_for_each(rt2x00dev, queue) { |
472 | kfree(queue->entries); | 555 | kfree(queue->entries); |
473 | queue->entries = NULL; | 556 | queue->entries = NULL; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h index fcf52520b016..5dd9cca3c62c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h | |||
@@ -42,15 +42,18 @@ | |||
42 | /** | 42 | /** |
43 | * DOC: Number of entries per queue | 43 | * DOC: Number of entries per queue |
44 | * | 44 | * |
45 | * After research it was concluded that 12 entries in a RX and TX | 45 | * Under normal load without fragmentation 12 entries are sufficient |
46 | * queue would be sufficient. Although this is almost one third of | 46 | * without the queue being filled up to the maximum. When using fragmentation |
47 | * the amount the legacy driver allocated, the queues aren't getting | 47 | * and the queue threshold code we need to add some additional margins to |
48 | * filled to the maximum even when working with the maximum rate. | 48 | * make sure the queue will never (or only under extreme load) fill up |
49 | * completely. | ||
50 | * Since we don't use preallocated DMA having a large number of queue entries | ||
51 | * will have only minimal impact on the memory requirements for the queue. | ||
49 | */ | 52 | */ |
50 | #define RX_ENTRIES 12 | 53 | #define RX_ENTRIES 24 |
51 | #define TX_ENTRIES 12 | 54 | #define TX_ENTRIES 24 |
52 | #define BEACON_ENTRIES 1 | 55 | #define BEACON_ENTRIES 1 |
53 | #define ATIM_ENTRIES 1 | 56 | #define ATIM_ENTRIES 8 |
54 | 57 | ||
55 | /** | 58 | /** |
56 | * enum data_queue_qid: Queue identification | 59 | * enum data_queue_qid: Queue identification |
@@ -82,10 +85,13 @@ enum data_queue_qid { | |||
82 | /** | 85 | /** |
83 | * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc | 86 | * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc |
84 | * | 87 | * |
88 | * @SKBDESC_DMA_MAPPED_RX: &skb_dma field has been mapped for RX | ||
89 | * @SKBDESC_DMA_MAPPED_TX: &skb_dma field has been mapped for TX | ||
85 | */ | 90 | */ |
86 | //enum skb_frame_desc_flags { | 91 | enum skb_frame_desc_flags { |
87 | // TEMPORARILY EMPTY | 92 | SKBDESC_DMA_MAPPED_RX = (1 << 0), |
88 | //}; | 93 | SKBDESC_DMA_MAPPED_TX = (1 << 1), |
94 | }; | ||
89 | 95 | ||
90 | /** | 96 | /** |
91 | * struct skb_frame_desc: Descriptor information for the skb buffer | 97 | * struct skb_frame_desc: Descriptor information for the skb buffer |
@@ -94,19 +100,20 @@ enum data_queue_qid { | |||
94 | * this structure should not exceed the size of that array (40 bytes). | 100 | * this structure should not exceed the size of that array (40 bytes). |
95 | * | 101 | * |
96 | * @flags: Frame flags, see &enum skb_frame_desc_flags. | 102 | * @flags: Frame flags, see &enum skb_frame_desc_flags. |
97 | * @data: Pointer to data part of frame (Start of ieee80211 header). | 103 | * @desc_len: Length of the frame descriptor. |
98 | * @desc: Pointer to descriptor part of the frame. | 104 | * @desc: Pointer to descriptor part of the frame. |
99 | * Note that this pointer could point to something outside | 105 | * Note that this pointer could point to something outside |
100 | * of the scope of the skb->data pointer. | 106 | * of the scope of the skb->data pointer. |
101 | * @data_len: Length of the frame data. | 107 | * @skb_dma: (PCI-only) the DMA address associated with the sk buffer. |
102 | * @desc_len: Length of the frame descriptor. | ||
103 | * @entry: The entry to which this sk buffer belongs. | 108 | * @entry: The entry to which this sk buffer belongs. |
104 | */ | 109 | */ |
105 | struct skb_frame_desc { | 110 | struct skb_frame_desc { |
106 | unsigned int flags; | 111 | unsigned int flags; |
107 | 112 | ||
108 | void *desc; | ||
109 | unsigned int desc_len; | 113 | unsigned int desc_len; |
114 | void *desc; | ||
115 | |||
116 | dma_addr_t skb_dma; | ||
110 | 117 | ||
111 | struct queue_entry *entry; | 118 | struct queue_entry *entry; |
112 | }; | 119 | }; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c index fcef9885ab5e..207281cfa8b7 100644 --- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c +++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c | |||
@@ -45,14 +45,17 @@ static int rt2x00rfkill_toggle_radio(void *data, enum rfkill_state state) | |||
45 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | 45 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) |
46 | return 0; | 46 | return 0; |
47 | 47 | ||
48 | if (state == RFKILL_STATE_ON) { | 48 | if (state == RFKILL_STATE_UNBLOCKED) { |
49 | INFO(rt2x00dev, "Hardware button pressed, enabling radio.\n"); | 49 | INFO(rt2x00dev, "Hardware button pressed, enabling radio.\n"); |
50 | __clear_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags); | 50 | __clear_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags); |
51 | retval = rt2x00lib_enable_radio(rt2x00dev); | 51 | retval = rt2x00lib_enable_radio(rt2x00dev); |
52 | } else if (state == RFKILL_STATE_OFF) { | 52 | } else if (state == RFKILL_STATE_SOFT_BLOCKED) { |
53 | INFO(rt2x00dev, "Hardware button pressed, disabling radio.\n"); | 53 | INFO(rt2x00dev, "Hardware button pressed, disabling radio.\n"); |
54 | __set_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags); | 54 | __set_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags); |
55 | rt2x00lib_disable_radio(rt2x00dev); | 55 | rt2x00lib_disable_radio(rt2x00dev); |
56 | } else { | ||
57 | WARNING(rt2x00dev, "Received unexpected rfkill state %d.\n", | ||
58 | state); | ||
56 | } | 59 | } |
57 | 60 | ||
58 | return retval; | 61 | return retval; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 3080969ae5b3..83862e7f7aec 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -40,7 +40,7 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, | |||
40 | void *buffer, const u16 buffer_length, | 40 | void *buffer, const u16 buffer_length, |
41 | const int timeout) | 41 | const int timeout) |
42 | { | 42 | { |
43 | struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev); | 43 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
44 | int status; | 44 | int status; |
45 | unsigned int i; | 45 | unsigned int i; |
46 | unsigned int pipe = | 46 | unsigned int pipe = |
@@ -130,10 +130,9 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb) | |||
130 | struct queue_entry *entry = (struct queue_entry *)urb->context; | 130 | struct queue_entry *entry = (struct queue_entry *)urb->context; |
131 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 131 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
132 | struct txdone_entry_desc txdesc; | 132 | struct txdone_entry_desc txdesc; |
133 | enum data_queue_qid qid = skb_get_queue_mapping(entry->skb); | ||
134 | 133 | ||
135 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || | 134 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || |
136 | !__test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | 135 | !test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) |
137 | return; | 136 | return; |
138 | 137 | ||
139 | /* | 138 | /* |
@@ -157,26 +156,12 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb) | |||
157 | txdesc.retry = 0; | 156 | txdesc.retry = 0; |
158 | 157 | ||
159 | rt2x00lib_txdone(entry, &txdesc); | 158 | rt2x00lib_txdone(entry, &txdesc); |
160 | |||
161 | /* | ||
162 | * Make this entry available for reuse. | ||
163 | */ | ||
164 | entry->flags = 0; | ||
165 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); | ||
166 | |||
167 | /* | ||
168 | * If the data queue was below the threshold before the txdone | ||
169 | * handler we must make sure the packet queue in the mac80211 stack | ||
170 | * is reenabled when the txdone handler has finished. | ||
171 | */ | ||
172 | if (!rt2x00queue_threshold(entry->queue)) | ||
173 | ieee80211_wake_queue(rt2x00dev->hw, qid); | ||
174 | } | 159 | } |
175 | 160 | ||
176 | int rt2x00usb_write_tx_data(struct queue_entry *entry) | 161 | int rt2x00usb_write_tx_data(struct queue_entry *entry) |
177 | { | 162 | { |
178 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 163 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
179 | struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev); | 164 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
180 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | 165 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; |
181 | struct skb_frame_desc *skbdesc; | 166 | struct skb_frame_desc *skbdesc; |
182 | u32 length; | 167 | u32 length; |
@@ -191,10 +176,8 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry) | |||
191 | * Fill in skb descriptor | 176 | * Fill in skb descriptor |
192 | */ | 177 | */ |
193 | skbdesc = get_skb_frame_desc(entry->skb); | 178 | skbdesc = get_skb_frame_desc(entry->skb); |
194 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
195 | skbdesc->desc = entry->skb->data; | 179 | skbdesc->desc = entry->skb->data; |
196 | skbdesc->desc_len = entry->queue->desc_size; | 180 | skbdesc->desc_len = entry->queue->desc_size; |
197 | skbdesc->entry = entry; | ||
198 | 181 | ||
199 | /* | 182 | /* |
200 | * USB devices cannot blindly pass the skb->len as the | 183 | * USB devices cannot blindly pass the skb->len as the |
@@ -264,13 +247,11 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
264 | { | 247 | { |
265 | struct queue_entry *entry = (struct queue_entry *)urb->context; | 248 | struct queue_entry *entry = (struct queue_entry *)urb->context; |
266 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 249 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
267 | struct sk_buff *skb; | 250 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
268 | struct skb_frame_desc *skbdesc; | ||
269 | struct rxdone_entry_desc rxdesc; | ||
270 | u8 rxd[32]; | 251 | u8 rxd[32]; |
271 | 252 | ||
272 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || | 253 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || |
273 | !test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) | 254 | !test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) |
274 | return; | 255 | return; |
275 | 256 | ||
276 | /* | 257 | /* |
@@ -278,50 +259,22 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
278 | * to be actually valid, or if the urb is signaling | 259 | * to be actually valid, or if the urb is signaling |
279 | * a problem. | 260 | * a problem. |
280 | */ | 261 | */ |
281 | if (urb->actual_length < entry->queue->desc_size || urb->status) | 262 | if (urb->actual_length < entry->queue->desc_size || urb->status) { |
282 | goto skip_entry; | 263 | __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); |
264 | usb_submit_urb(urb, GFP_ATOMIC); | ||
265 | return; | ||
266 | } | ||
283 | 267 | ||
284 | /* | 268 | /* |
285 | * Fill in skb descriptor | 269 | * Fill in desc fields of the skb descriptor |
286 | */ | 270 | */ |
287 | skbdesc = get_skb_frame_desc(entry->skb); | ||
288 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
289 | skbdesc->entry = entry; | ||
290 | skbdesc->desc = rxd; | 271 | skbdesc->desc = rxd; |
291 | skbdesc->desc_len = entry->queue->desc_size; | 272 | skbdesc->desc_len = entry->queue->desc_size; |
292 | 273 | ||
293 | memset(&rxdesc, 0, sizeof(rxdesc)); | ||
294 | rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); | ||
295 | |||
296 | /* | ||
297 | * Allocate a new sk buffer to replace the current one. | ||
298 | * If allocation fails, we should drop the current frame | ||
299 | * so we can recycle the existing sk buffer for the new frame. | ||
300 | */ | ||
301 | skb = rt2x00queue_alloc_rxskb(entry->queue); | ||
302 | if (!skb) | ||
303 | goto skip_entry; | ||
304 | |||
305 | /* | 274 | /* |
306 | * Send the frame to rt2x00lib for further processing. | 275 | * Send the frame to rt2x00lib for further processing. |
307 | */ | 276 | */ |
308 | rt2x00lib_rxdone(entry, &rxdesc); | 277 | rt2x00lib_rxdone(rt2x00dev, entry); |
309 | |||
310 | /* | ||
311 | * Replace current entry's skb with the newly allocated one, | ||
312 | * and reinitialize the urb. | ||
313 | */ | ||
314 | entry->skb = skb; | ||
315 | urb->transfer_buffer = entry->skb->data; | ||
316 | urb->transfer_buffer_length = entry->skb->len; | ||
317 | |||
318 | skip_entry: | ||
319 | if (test_bit(DEVICE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags)) { | ||
320 | __set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | ||
321 | usb_submit_urb(urb, GFP_ATOMIC); | ||
322 | } | ||
323 | |||
324 | rt2x00queue_index_inc(entry->queue, Q_INDEX); | ||
325 | } | 278 | } |
326 | 279 | ||
327 | /* | 280 | /* |
@@ -331,6 +284,7 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
331 | { | 284 | { |
332 | struct queue_entry_priv_usb *entry_priv; | 285 | struct queue_entry_priv_usb *entry_priv; |
333 | struct queue_entry_priv_usb_bcn *bcn_priv; | 286 | struct queue_entry_priv_usb_bcn *bcn_priv; |
287 | struct data_queue *queue; | ||
334 | unsigned int i; | 288 | unsigned int i; |
335 | 289 | ||
336 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0, | 290 | rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0, |
@@ -339,9 +293,11 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) | |||
339 | /* | 293 | /* |
340 | * Cancel all queues. | 294 | * Cancel all queues. |
341 | */ | 295 | */ |
342 | for (i = 0; i < rt2x00dev->rx->limit; i++) { | 296 | queue_for_each(rt2x00dev, queue) { |
343 | entry_priv = rt2x00dev->rx->entries[i].priv_data; | 297 | for (i = 0; i < queue->limit; i++) { |
344 | usb_kill_urb(entry_priv->urb); | 298 | entry_priv = queue->entries[i].priv_data; |
299 | usb_kill_urb(entry_priv->urb); | ||
300 | } | ||
345 | } | 301 | } |
346 | 302 | ||
347 | /* | 303 | /* |
@@ -364,7 +320,7 @@ EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); | |||
364 | void rt2x00usb_init_rxentry(struct rt2x00_dev *rt2x00dev, | 320 | void rt2x00usb_init_rxentry(struct rt2x00_dev *rt2x00dev, |
365 | struct queue_entry *entry) | 321 | struct queue_entry *entry) |
366 | { | 322 | { |
367 | struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev); | 323 | struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); |
368 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; | 324 | struct queue_entry_priv_usb *entry_priv = entry->priv_data; |
369 | 325 | ||
370 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, | 326 | usb_fill_bulk_urb(entry_priv->urb, usb_dev, |
@@ -431,8 +387,6 @@ static void rt2x00usb_free_urb(struct rt2x00_dev *rt2x00dev, | |||
431 | entry_priv = queue->entries[i].priv_data; | 387 | entry_priv = queue->entries[i].priv_data; |
432 | usb_kill_urb(entry_priv->urb); | 388 | usb_kill_urb(entry_priv->urb); |
433 | usb_free_urb(entry_priv->urb); | 389 | usb_free_urb(entry_priv->urb); |
434 | if (queue->entries[i].skb) | ||
435 | kfree_skb(queue->entries[i].skb); | ||
436 | } | 390 | } |
437 | 391 | ||
438 | /* | 392 | /* |
@@ -454,10 +408,7 @@ static void rt2x00usb_free_urb(struct rt2x00_dev *rt2x00dev, | |||
454 | int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev) | 408 | int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev) |
455 | { | 409 | { |
456 | struct data_queue *queue; | 410 | struct data_queue *queue; |
457 | struct sk_buff *skb; | 411 | int status; |
458 | unsigned int entry_size; | ||
459 | unsigned int i; | ||
460 | int uninitialized_var(status); | ||
461 | 412 | ||
462 | /* | 413 | /* |
463 | * Allocate DMA | 414 | * Allocate DMA |
@@ -468,18 +419,6 @@ int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev) | |||
468 | goto exit; | 419 | goto exit; |
469 | } | 420 | } |
470 | 421 | ||
471 | /* | ||
472 | * For the RX queue, skb's should be allocated. | ||
473 | */ | ||
474 | entry_size = rt2x00dev->rx->data_size + rt2x00dev->rx->desc_size; | ||
475 | for (i = 0; i < rt2x00dev->rx->limit; i++) { | ||
476 | skb = rt2x00queue_alloc_rxskb(rt2x00dev->rx); | ||
477 | if (!skb) | ||
478 | goto exit; | ||
479 | |||
480 | rt2x00dev->rx->entries[i].skb = skb; | ||
481 | } | ||
482 | |||
483 | return 0; | 422 | return 0; |
484 | 423 | ||
485 | exit: | 424 | exit: |
@@ -558,7 +497,7 @@ int rt2x00usb_probe(struct usb_interface *usb_intf, | |||
558 | usb_set_intfdata(usb_intf, hw); | 497 | usb_set_intfdata(usb_intf, hw); |
559 | 498 | ||
560 | rt2x00dev = hw->priv; | 499 | rt2x00dev = hw->priv; |
561 | rt2x00dev->dev = usb_intf; | 500 | rt2x00dev->dev = &usb_intf->dev; |
562 | rt2x00dev->ops = ops; | 501 | rt2x00dev->ops = ops; |
563 | rt2x00dev->hw = hw; | 502 | rt2x00dev->hw = hw; |
564 | mutex_init(&rt2x00dev->usb_cache_mutex); | 503 | mutex_init(&rt2x00dev->usb_cache_mutex); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index b1187c812e7f..aad794adf52c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -26,6 +26,12 @@ | |||
26 | #ifndef RT2X00USB_H | 26 | #ifndef RT2X00USB_H |
27 | #define RT2X00USB_H | 27 | #define RT2X00USB_H |
28 | 28 | ||
29 | #define to_usb_device_intf(d) \ | ||
30 | ({ \ | ||
31 | struct usb_interface *intf = to_usb_interface(d); \ | ||
32 | interface_to_usbdev(intf); \ | ||
33 | }) | ||
34 | |||
29 | /* | 35 | /* |
30 | * This variable should be used with the | 36 | * This variable should be used with the |
31 | * usb_driver structure initialization. | 37 | * usb_driver structure initialization. |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 5b7267ece1b9..bbf1048f6400 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1030,11 +1030,12 @@ static void rt61pci_init_rxentry(struct rt2x00_dev *rt2x00dev, | |||
1030 | struct queue_entry *entry) | 1030 | struct queue_entry *entry) |
1031 | { | 1031 | { |
1032 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; | 1032 | struct queue_entry_priv_pci *entry_priv = entry->priv_data; |
1033 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
1033 | u32 word; | 1034 | u32 word; |
1034 | 1035 | ||
1035 | rt2x00_desc_read(entry_priv->desc, 5, &word); | 1036 | rt2x00_desc_read(entry_priv->desc, 5, &word); |
1036 | rt2x00_set_field32(&word, RXD_W5_BUFFER_PHYSICAL_ADDRESS, | 1037 | rt2x00_set_field32(&word, RXD_W5_BUFFER_PHYSICAL_ADDRESS, |
1037 | entry_priv->data_dma); | 1038 | skbdesc->skb_dma); |
1038 | rt2x00_desc_write(entry_priv->desc, 5, word); | 1039 | rt2x00_desc_write(entry_priv->desc, 5, word); |
1039 | 1040 | ||
1040 | rt2x00_desc_read(entry_priv->desc, 0, &word); | 1041 | rt2x00_desc_read(entry_priv->desc, 0, &word); |
@@ -1522,7 +1523,6 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1522 | struct txentry_desc *txdesc) | 1523 | struct txentry_desc *txdesc) |
1523 | { | 1524 | { |
1524 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); | 1525 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
1525 | struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data; | ||
1526 | __le32 *txd = skbdesc->desc; | 1526 | __le32 *txd = skbdesc->desc; |
1527 | u32 word; | 1527 | u32 word; |
1528 | 1528 | ||
@@ -1557,7 +1557,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1557 | 1557 | ||
1558 | rt2x00_desc_read(txd, 6, &word); | 1558 | rt2x00_desc_read(txd, 6, &word); |
1559 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, | 1559 | rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, |
1560 | entry_priv->data_dma); | 1560 | skbdesc->skb_dma); |
1561 | rt2x00_desc_write(txd, 6, word); | 1561 | rt2x00_desc_write(txd, 6, word); |
1562 | 1562 | ||
1563 | if (skbdesc->desc_len > TXINFO_SIZE) { | 1563 | if (skbdesc->desc_len > TXINFO_SIZE) { |
@@ -1767,7 +1767,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
1767 | __set_bit(TXDONE_UNKNOWN, &txdesc.flags); | 1767 | __set_bit(TXDONE_UNKNOWN, &txdesc.flags); |
1768 | txdesc.retry = 0; | 1768 | txdesc.retry = 0; |
1769 | 1769 | ||
1770 | rt2x00pci_txdone(rt2x00dev, entry_done, &txdesc); | 1770 | rt2x00lib_txdone(entry_done, &txdesc); |
1771 | entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); | 1771 | entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); |
1772 | } | 1772 | } |
1773 | 1773 | ||
@@ -1787,7 +1787,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
1787 | } | 1787 | } |
1788 | txdesc.retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT); | 1788 | txdesc.retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT); |
1789 | 1789 | ||
1790 | rt2x00pci_txdone(rt2x00dev, entry, &txdesc); | 1790 | rt2x00lib_txdone(entry, &txdesc); |
1791 | } | 1791 | } |
1792 | } | 1792 | } |
1793 | 1793 | ||
@@ -1973,7 +1973,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1973 | * To determine the RT chip we have to read the | 1973 | * To determine the RT chip we have to read the |
1974 | * PCI header of the device. | 1974 | * PCI header of the device. |
1975 | */ | 1975 | */ |
1976 | pci_read_config_word(rt2x00dev_pci(rt2x00dev), | 1976 | pci_read_config_word(to_pci_dev(rt2x00dev->dev), |
1977 | PCI_CONFIG_HEADER_DEVICE, &device); | 1977 | PCI_CONFIG_HEADER_DEVICE, &device); |
1978 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); | 1978 | value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); |
1979 | rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); | 1979 | rt2x00pci_register_read(rt2x00dev, MAC_CSR0, ®); |
@@ -2239,7 +2239,7 @@ static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2239 | IEEE80211_HW_SIGNAL_DBM; | 2239 | IEEE80211_HW_SIGNAL_DBM; |
2240 | rt2x00dev->hw->extra_tx_headroom = 0; | 2240 | rt2x00dev->hw->extra_tx_headroom = 0; |
2241 | 2241 | ||
2242 | SET_IEEE80211_DEV(rt2x00dev->hw, &rt2x00dev_pci(rt2x00dev)->dev); | 2242 | SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); |
2243 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, | 2243 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, |
2244 | rt2x00_eeprom_addr(rt2x00dev, | 2244 | rt2x00_eeprom_addr(rt2x00dev, |
2245 | EEPROM_MAC_ADDR_0)); | 2245 | EEPROM_MAC_ADDR_0)); |
@@ -2302,9 +2302,10 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
2302 | rt61pci_probe_hw_mode(rt2x00dev); | 2302 | rt61pci_probe_hw_mode(rt2x00dev); |
2303 | 2303 | ||
2304 | /* | 2304 | /* |
2305 | * This device requires firmware. | 2305 | * This device requires firmware and DMA mapped skbs. |
2306 | */ | 2306 | */ |
2307 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); | 2307 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); |
2308 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); | ||
2308 | 2309 | ||
2309 | /* | 2310 | /* |
2310 | * Set the rssi offset. | 2311 | * Set the rssi offset. |
@@ -2402,6 +2403,12 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2402 | skb->data, skb->len); | 2403 | skb->data, skb->len); |
2403 | rt61pci_kick_tx_queue(rt2x00dev, QID_BEACON); | 2404 | rt61pci_kick_tx_queue(rt2x00dev, QID_BEACON); |
2404 | 2405 | ||
2406 | /* | ||
2407 | * Clean up beacon skb. | ||
2408 | */ | ||
2409 | dev_kfree_skb_any(skb); | ||
2410 | intf->beacon->skb = NULL; | ||
2411 | |||
2405 | return 0; | 2412 | return 0; |
2406 | } | 2413 | } |
2407 | 2414 | ||
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 675ff7900eee..3ef318e098e7 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1827,7 +1827,7 @@ static void rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1827 | IEEE80211_HW_SIGNAL_DBM; | 1827 | IEEE80211_HW_SIGNAL_DBM; |
1828 | rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE; | 1828 | rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE; |
1829 | 1829 | ||
1830 | SET_IEEE80211_DEV(rt2x00dev->hw, &rt2x00dev_usb(rt2x00dev)->dev); | 1830 | SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); |
1831 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, | 1831 | SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, |
1832 | rt2x00_eeprom_addr(rt2x00dev, | 1832 | rt2x00_eeprom_addr(rt2x00dev, |
1833 | EEPROM_MAC_ADDR_0)); | 1833 | EEPROM_MAC_ADDR_0)); |
@@ -2007,6 +2007,12 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2007 | REGISTER_TIMEOUT32(skb->len)); | 2007 | REGISTER_TIMEOUT32(skb->len)); |
2008 | rt73usb_kick_tx_queue(rt2x00dev, QID_BEACON); | 2008 | rt73usb_kick_tx_queue(rt2x00dev, QID_BEACON); |
2009 | 2009 | ||
2010 | /* | ||
2011 | * Clean up the beacon skb. | ||
2012 | */ | ||
2013 | dev_kfree_skb(skb); | ||
2014 | intf->beacon->skb = NULL; | ||
2015 | |||
2010 | return 0; | 2016 | return 0; |
2011 | } | 2017 | } |
2012 | 2018 | ||