Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2004 - 2008 rt2x00 SourceForge Project |
| 3 | <http://rt2x00.serialmonkey.com> |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the |
| 17 | Free Software Foundation, Inc., |
| 18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | Module: rt2x00lib |
| 23 | Abstract: rt2x00 queue specific routines. |
| 24 | */ |
| 25 | |
| 26 | #include <linux/kernel.h> |
| 27 | #include <linux/module.h> |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 28 | #include <linux/dma-mapping.h> |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 29 | |
| 30 | #include "rt2x00.h" |
| 31 | #include "rt2x00lib.h" |
| 32 | |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 33 | struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev, |
| 34 | struct queue_entry *entry) |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 35 | { |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 36 | unsigned int frame_size; |
| 37 | unsigned int reserved_size; |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 38 | struct sk_buff *skb; |
| 39 | struct skb_frame_desc *skbdesc; |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 40 | |
| 41 | /* |
| 42 | * The frame size includes descriptor size, because the |
| 43 | * hardware directly receive the frame into the skbuffer. |
| 44 | */ |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 45 | frame_size = entry->queue->data_size + entry->queue->desc_size; |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 46 | |
| 47 | /* |
Ivo van Doorn | ff35239 | 2008-07-04 14:56:07 +0200 | [diff] [blame] | 48 | * The payload should be aligned to a 4-byte boundary, |
| 49 | * this means we need at least 3 bytes for moving the frame |
| 50 | * into the correct offset. |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 51 | */ |
Ivo van Doorn | ff35239 | 2008-07-04 14:56:07 +0200 | [diff] [blame] | 52 | reserved_size = 4; |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 53 | |
| 54 | /* |
| 55 | * Allocate skbuffer. |
| 56 | */ |
| 57 | skb = dev_alloc_skb(frame_size + reserved_size); |
| 58 | if (!skb) |
| 59 | return NULL; |
| 60 | |
| 61 | skb_reserve(skb, reserved_size); |
| 62 | skb_put(skb, frame_size); |
| 63 | |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 64 | /* |
| 65 | * Populate skbdesc. |
| 66 | */ |
| 67 | skbdesc = get_skb_frame_desc(skb); |
| 68 | memset(skbdesc, 0, sizeof(*skbdesc)); |
| 69 | skbdesc->entry = entry; |
| 70 | |
| 71 | if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags)) { |
| 72 | skbdesc->skb_dma = dma_map_single(rt2x00dev->dev, |
| 73 | skb->data, |
| 74 | skb->len, |
| 75 | DMA_FROM_DEVICE); |
| 76 | skbdesc->flags |= SKBDESC_DMA_MAPPED_RX; |
| 77 | } |
| 78 | |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 79 | return skb; |
| 80 | } |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 81 | |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 82 | void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 83 | { |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 84 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
| 85 | |
| 86 | skbdesc->skb_dma = dma_map_single(rt2x00dev->dev, skb->data, skb->len, |
| 87 | DMA_TO_DEVICE); |
| 88 | skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; |
| 89 | } |
| 90 | EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb); |
| 91 | |
| 92 | void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) |
| 93 | { |
| 94 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); |
| 95 | |
| 96 | if (skbdesc->flags & SKBDESC_DMA_MAPPED_RX) { |
| 97 | dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len, |
| 98 | DMA_FROM_DEVICE); |
| 99 | skbdesc->flags &= ~SKBDESC_DMA_MAPPED_RX; |
| 100 | } |
| 101 | |
| 102 | if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) { |
| 103 | dma_unmap_single(rt2x00dev->dev, skbdesc->skb_dma, skb->len, |
| 104 | DMA_TO_DEVICE); |
| 105 | skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; |
| 106 | } |
| 107 | } |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 108 | |
| 109 | void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) |
| 110 | { |
Ivo van Doorn | 9a61319 | 2008-07-05 15:11:57 +0200 | [diff] [blame] | 111 | if (!skb) |
| 112 | return; |
| 113 | |
Ivo van Doorn | 61243d8 | 2008-06-20 22:10:53 +0200 | [diff] [blame] | 114 | rt2x00queue_unmap_skb(rt2x00dev, skb); |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 115 | dev_kfree_skb_any(skb); |
| 116 | } |
Gertjan van Wingerde | 239c249 | 2008-06-06 22:54:12 +0200 | [diff] [blame] | 117 | |
Ivo van Doorn | bd88a78 | 2008-07-09 15:12:44 +0200 | [diff] [blame] | 118 | static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, |
| 119 | struct txentry_desc *txdesc) |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 120 | { |
Johannes Berg | 2e92e6f | 2008-05-15 12:55:27 +0200 | [diff] [blame] | 121 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 122 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); |
Ivo van Doorn | 5adf6d6 | 2008-07-20 18:03:38 +0200 | [diff] [blame] | 123 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 124 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; |
Johannes Berg | 2e92e6f | 2008-05-15 12:55:27 +0200 | [diff] [blame] | 125 | struct ieee80211_rate *rate = |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 126 | ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 127 | const struct rt2x00_rate *hwrate; |
| 128 | unsigned int data_length; |
| 129 | unsigned int duration; |
| 130 | unsigned int residual; |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 131 | |
| 132 | memset(txdesc, 0, sizeof(*txdesc)); |
| 133 | |
| 134 | /* |
| 135 | * Initialize information from queue |
| 136 | */ |
| 137 | txdesc->queue = entry->queue->qid; |
| 138 | txdesc->cw_min = entry->queue->cw_min; |
| 139 | txdesc->cw_max = entry->queue->cw_max; |
| 140 | txdesc->aifs = entry->queue->aifs; |
| 141 | |
| 142 | /* Data length should be extended with 4 bytes for CRC */ |
| 143 | data_length = entry->skb->len + 4; |
| 144 | |
| 145 | /* |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 146 | * Check whether this frame is to be acked. |
| 147 | */ |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 148 | if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 149 | __set_bit(ENTRY_TXD_ACK, &txdesc->flags); |
| 150 | |
| 151 | /* |
| 152 | * Check if this is a RTS/CTS frame |
| 153 | */ |
Ivo van Doorn | ac10446 | 2008-06-16 19:54:57 +0200 | [diff] [blame] | 154 | if (ieee80211_is_rts(hdr->frame_control) || |
| 155 | ieee80211_is_cts(hdr->frame_control)) { |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 156 | __set_bit(ENTRY_TXD_BURST, &txdesc->flags); |
Ivo van Doorn | ac10446 | 2008-06-16 19:54:57 +0200 | [diff] [blame] | 157 | if (ieee80211_is_rts(hdr->frame_control)) |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 158 | __set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags); |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 159 | else |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 160 | __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags); |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 161 | if (tx_info->control.rts_cts_rate_idx >= 0) |
Johannes Berg | 2e92e6f | 2008-05-15 12:55:27 +0200 | [diff] [blame] | 162 | rate = |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 163 | ieee80211_get_rts_cts_rate(rt2x00dev->hw, tx_info); |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | /* |
| 167 | * Determine retry information. |
| 168 | */ |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 169 | txdesc->retry_limit = tx_info->control.retry_limit; |
| 170 | if (tx_info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT) |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 171 | __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags); |
| 172 | |
| 173 | /* |
| 174 | * Check if more fragments are pending |
| 175 | */ |
Harvey Harrison | 8b7b1e0 | 2008-06-11 14:21:56 -0700 | [diff] [blame] | 176 | if (ieee80211_has_morefrags(hdr->frame_control)) { |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 177 | __set_bit(ENTRY_TXD_BURST, &txdesc->flags); |
| 178 | __set_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags); |
| 179 | } |
| 180 | |
| 181 | /* |
| 182 | * Beacons and probe responses require the tsf timestamp |
| 183 | * to be inserted into the frame. |
| 184 | */ |
Ivo van Doorn | ac10446 | 2008-06-16 19:54:57 +0200 | [diff] [blame] | 185 | if (ieee80211_is_beacon(hdr->frame_control) || |
| 186 | ieee80211_is_probe_resp(hdr->frame_control)) |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 187 | __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags); |
| 188 | |
| 189 | /* |
| 190 | * Determine with what IFS priority this frame should be send. |
| 191 | * Set ifs to IFS_SIFS when the this is not the first fragment, |
| 192 | * or this fragment came after RTS/CTS. |
| 193 | */ |
| 194 | if (test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)) { |
| 195 | txdesc->ifs = IFS_SIFS; |
Johannes Berg | e039fa4 | 2008-05-15 12:55:29 +0200 | [diff] [blame] | 196 | } else if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) { |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 197 | __set_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags); |
| 198 | txdesc->ifs = IFS_BACKOFF; |
| 199 | } else { |
| 200 | txdesc->ifs = IFS_SIFS; |
| 201 | } |
| 202 | |
| 203 | /* |
Ivo van Doorn | 5adf6d6 | 2008-07-20 18:03:38 +0200 | [diff] [blame] | 204 | * Hardware should insert sequence counter. |
| 205 | * FIXME: We insert a software sequence counter first for |
| 206 | * hardware that doesn't support hardware sequence counting. |
| 207 | * |
| 208 | * This is wrong because beacons are not getting sequence |
| 209 | * numbers assigned properly. |
| 210 | * |
| 211 | * A secondary problem exists for drivers that cannot toggle |
| 212 | * sequence counting per-frame, since those will override the |
| 213 | * sequence counter given by mac80211. |
| 214 | */ |
| 215 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
| 216 | spin_lock(&intf->lock); |
| 217 | |
| 218 | if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) |
| 219 | intf->seqno += 0x10; |
| 220 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); |
| 221 | hdr->seq_ctrl |= cpu_to_le16(intf->seqno); |
| 222 | |
| 223 | spin_unlock(&intf->lock); |
| 224 | |
| 225 | __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); |
| 226 | } |
| 227 | |
| 228 | /* |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 229 | * PLCP setup |
| 230 | * Length calculation depends on OFDM/CCK rate. |
| 231 | */ |
| 232 | hwrate = rt2x00_get_rate(rate->hw_value); |
| 233 | txdesc->signal = hwrate->plcp; |
| 234 | txdesc->service = 0x04; |
| 235 | |
| 236 | if (hwrate->flags & DEV_RATE_OFDM) { |
| 237 | __set_bit(ENTRY_TXD_OFDM_RATE, &txdesc->flags); |
| 238 | |
| 239 | txdesc->length_high = (data_length >> 6) & 0x3f; |
| 240 | txdesc->length_low = data_length & 0x3f; |
| 241 | } else { |
| 242 | /* |
| 243 | * Convert length to microseconds. |
| 244 | */ |
| 245 | residual = get_duration_res(data_length, hwrate->bitrate); |
| 246 | duration = get_duration(data_length, hwrate->bitrate); |
| 247 | |
| 248 | if (residual != 0) { |
| 249 | duration++; |
| 250 | |
| 251 | /* |
| 252 | * Check if we need to set the Length Extension |
| 253 | */ |
| 254 | if (hwrate->bitrate == 110 && residual <= 30) |
| 255 | txdesc->service |= 0x80; |
| 256 | } |
| 257 | |
| 258 | txdesc->length_high = (duration >> 8) & 0xff; |
| 259 | txdesc->length_low = duration & 0xff; |
| 260 | |
| 261 | /* |
| 262 | * When preamble is enabled we should set the |
| 263 | * preamble bit for the signal. |
| 264 | */ |
| 265 | if (rt2x00_get_rate_preamble(rate->hw_value)) |
| 266 | txdesc->signal |= 0x08; |
| 267 | } |
| 268 | } |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 269 | |
Ivo van Doorn | bd88a78 | 2008-07-09 15:12:44 +0200 | [diff] [blame] | 270 | static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, |
| 271 | struct txentry_desc *txdesc) |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 272 | { |
Ivo van Doorn | b869767 | 2008-06-06 22:53:14 +0200 | [diff] [blame] | 273 | struct data_queue *queue = entry->queue; |
| 274 | struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 275 | |
| 276 | rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc); |
| 277 | |
| 278 | /* |
| 279 | * All processing on the frame has been completed, this means |
| 280 | * it is now ready to be dumped to userspace through debugfs. |
| 281 | */ |
| 282 | rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb); |
| 283 | |
| 284 | /* |
Ivo van Doorn | b869767 | 2008-06-06 22:53:14 +0200 | [diff] [blame] | 285 | * Check if we need to kick the queue, there are however a few rules |
| 286 | * 1) Don't kick beacon queue |
| 287 | * 2) Don't kick unless this is the last in frame in a burst. |
| 288 | * When the burst flag is set, this frame is always followed |
| 289 | * by another frame which in some way are related to eachother. |
| 290 | * This is true for fragments, RTS or CTS-to-self frames. |
| 291 | * 3) Rule 2 can be broken when the available entries |
| 292 | * in the queue are less then a certain threshold. |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 293 | */ |
Ivo van Doorn | b869767 | 2008-06-06 22:53:14 +0200 | [diff] [blame] | 294 | if (entry->queue->qid == QID_BEACON) |
| 295 | return; |
| 296 | |
| 297 | if (rt2x00queue_threshold(queue) || |
| 298 | !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) |
| 299 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid); |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 300 | } |
Ivo van Doorn | 7050ec8 | 2008-05-10 13:46:13 +0200 | [diff] [blame] | 301 | |
Ivo van Doorn | 6db3786 | 2008-06-06 22:50:28 +0200 | [diff] [blame] | 302 | int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) |
| 303 | { |
| 304 | struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); |
| 305 | struct txentry_desc txdesc; |
Ivo van Doorn | d74f5ba | 2008-06-16 19:56:54 +0200 | [diff] [blame] | 306 | struct skb_frame_desc *skbdesc; |
Ivo van Doorn | 6db3786 | 2008-06-06 22:50:28 +0200 | [diff] [blame] | 307 | |
| 308 | if (unlikely(rt2x00queue_full(queue))) |
| 309 | return -EINVAL; |
| 310 | |
| 311 | if (__test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) { |
| 312 | ERROR(queue->rt2x00dev, |
| 313 | "Arrived at non-free entry in the non-full queue %d.\n" |
| 314 | "Please file bug report to %s.\n", |
| 315 | queue->qid, DRV_PROJECT); |
| 316 | return -EINVAL; |
| 317 | } |
| 318 | |
| 319 | /* |
| 320 | * Copy all TX descriptor information into txdesc, |
| 321 | * after that we are free to use the skb->cb array |
| 322 | * for our information. |
| 323 | */ |
| 324 | entry->skb = skb; |
| 325 | rt2x00queue_create_tx_descriptor(entry, &txdesc); |
| 326 | |
Ivo van Doorn | d74f5ba | 2008-06-16 19:56:54 +0200 | [diff] [blame] | 327 | /* |
| 328 | * skb->cb array is now ours and we are free to use it. |
| 329 | */ |
| 330 | skbdesc = get_skb_frame_desc(entry->skb); |
| 331 | memset(skbdesc, 0, sizeof(*skbdesc)); |
| 332 | skbdesc->entry = entry; |
| 333 | |
Ivo van Doorn | 6db3786 | 2008-06-06 22:50:28 +0200 | [diff] [blame] | 334 | if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry))) { |
| 335 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); |
| 336 | return -EIO; |
| 337 | } |
| 338 | |
Ivo van Doorn | d74f5ba | 2008-06-16 19:56:54 +0200 | [diff] [blame] | 339 | if (test_bit(DRIVER_REQUIRE_DMA, &queue->rt2x00dev->flags)) |
| 340 | rt2x00queue_map_txskb(queue->rt2x00dev, skb); |
| 341 | |
Ivo van Doorn | 6db3786 | 2008-06-06 22:50:28 +0200 | [diff] [blame] | 342 | __set_bit(ENTRY_DATA_PENDING, &entry->flags); |
| 343 | |
| 344 | rt2x00queue_index_inc(queue, Q_INDEX); |
| 345 | rt2x00queue_write_tx_descriptor(entry, &txdesc); |
| 346 | |
| 347 | return 0; |
| 348 | } |
| 349 | |
Ivo van Doorn | bd88a78 | 2008-07-09 15:12:44 +0200 | [diff] [blame] | 350 | int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, |
| 351 | struct ieee80211_vif *vif) |
| 352 | { |
| 353 | struct rt2x00_intf *intf = vif_to_intf(vif); |
| 354 | struct skb_frame_desc *skbdesc; |
| 355 | struct txentry_desc txdesc; |
| 356 | __le32 desc[16]; |
| 357 | |
| 358 | if (unlikely(!intf->beacon)) |
| 359 | return -ENOBUFS; |
| 360 | |
| 361 | intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif); |
| 362 | if (!intf->beacon->skb) |
| 363 | return -ENOMEM; |
| 364 | |
| 365 | /* |
| 366 | * Copy all TX descriptor information into txdesc, |
| 367 | * after that we are free to use the skb->cb array |
| 368 | * for our information. |
| 369 | */ |
| 370 | rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc); |
| 371 | |
| 372 | /* |
| 373 | * For the descriptor we use a local array from where the |
| 374 | * driver can move it to the correct location required for |
| 375 | * the hardware. |
| 376 | */ |
| 377 | memset(desc, 0, sizeof(desc)); |
| 378 | |
| 379 | /* |
| 380 | * Fill in skb descriptor |
| 381 | */ |
| 382 | skbdesc = get_skb_frame_desc(intf->beacon->skb); |
| 383 | memset(skbdesc, 0, sizeof(*skbdesc)); |
| 384 | skbdesc->desc = desc; |
| 385 | skbdesc->desc_len = intf->beacon->queue->desc_size; |
| 386 | skbdesc->entry = intf->beacon; |
| 387 | |
| 388 | /* |
| 389 | * Write TX descriptor into reserved room in front of the beacon. |
| 390 | */ |
| 391 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); |
| 392 | |
| 393 | /* |
| 394 | * Send beacon to hardware. |
| 395 | * Also enable beacon generation, which might have been disabled |
| 396 | * by the driver during the config_beacon() callback function. |
| 397 | */ |
| 398 | rt2x00dev->ops->lib->write_beacon(intf->beacon); |
| 399 | rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON); |
| 400 | |
| 401 | return 0; |
| 402 | } |
| 403 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 404 | struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, |
Ivo van Doorn | e58c6ac | 2008-04-21 19:00:47 +0200 | [diff] [blame] | 405 | const enum data_queue_qid queue) |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 406 | { |
| 407 | int atim = test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); |
| 408 | |
Gertjan van Wingerde | 61448f8 | 2008-05-10 13:43:33 +0200 | [diff] [blame] | 409 | if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx) |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 410 | return &rt2x00dev->tx[queue]; |
| 411 | |
| 412 | if (!rt2x00dev->bcn) |
| 413 | return NULL; |
| 414 | |
Ivo van Doorn | e58c6ac | 2008-04-21 19:00:47 +0200 | [diff] [blame] | 415 | if (queue == QID_BEACON) |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 416 | return &rt2x00dev->bcn[0]; |
Ivo van Doorn | e58c6ac | 2008-04-21 19:00:47 +0200 | [diff] [blame] | 417 | else if (queue == QID_ATIM && atim) |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 418 | return &rt2x00dev->bcn[1]; |
| 419 | |
| 420 | return NULL; |
| 421 | } |
| 422 | EXPORT_SYMBOL_GPL(rt2x00queue_get_queue); |
| 423 | |
| 424 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, |
| 425 | enum queue_index index) |
| 426 | { |
| 427 | struct queue_entry *entry; |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 428 | unsigned long irqflags; |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 429 | |
| 430 | if (unlikely(index >= Q_INDEX_MAX)) { |
| 431 | ERROR(queue->rt2x00dev, |
| 432 | "Entry requested from invalid index type (%d)\n", index); |
| 433 | return NULL; |
| 434 | } |
| 435 | |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 436 | spin_lock_irqsave(&queue->lock, irqflags); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 437 | |
| 438 | entry = &queue->entries[queue->index[index]]; |
| 439 | |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 440 | spin_unlock_irqrestore(&queue->lock, irqflags); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 441 | |
| 442 | return entry; |
| 443 | } |
| 444 | EXPORT_SYMBOL_GPL(rt2x00queue_get_entry); |
| 445 | |
| 446 | void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index) |
| 447 | { |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 448 | unsigned long irqflags; |
| 449 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 450 | if (unlikely(index >= Q_INDEX_MAX)) { |
| 451 | ERROR(queue->rt2x00dev, |
| 452 | "Index change on invalid index type (%d)\n", index); |
| 453 | return; |
| 454 | } |
| 455 | |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 456 | spin_lock_irqsave(&queue->lock, irqflags); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 457 | |
| 458 | queue->index[index]++; |
| 459 | if (queue->index[index] >= queue->limit) |
| 460 | queue->index[index] = 0; |
| 461 | |
Ivo van Doorn | 10b6b80 | 2008-02-03 15:55:21 +0100 | [diff] [blame] | 462 | if (index == Q_INDEX) { |
| 463 | queue->length++; |
| 464 | } else if (index == Q_INDEX_DONE) { |
| 465 | queue->length--; |
| 466 | queue->count ++; |
| 467 | } |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 468 | |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 469 | spin_unlock_irqrestore(&queue->lock, irqflags); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 470 | } |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 471 | |
| 472 | static void rt2x00queue_reset(struct data_queue *queue) |
| 473 | { |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 474 | unsigned long irqflags; |
| 475 | |
| 476 | spin_lock_irqsave(&queue->lock, irqflags); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 477 | |
| 478 | queue->count = 0; |
| 479 | queue->length = 0; |
| 480 | memset(queue->index, 0, sizeof(queue->index)); |
| 481 | |
Ivo van Doorn | 5f46c4d | 2008-03-09 22:44:30 +0100 | [diff] [blame] | 482 | spin_unlock_irqrestore(&queue->lock, irqflags); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev) |
| 486 | { |
| 487 | struct data_queue *queue = rt2x00dev->rx; |
| 488 | unsigned int i; |
| 489 | |
| 490 | rt2x00queue_reset(queue); |
| 491 | |
| 492 | if (!rt2x00dev->ops->lib->init_rxentry) |
| 493 | return; |
| 494 | |
Ivo van Doorn | 9c0ab71 | 2008-07-21 19:06:02 +0200 | [diff] [blame^] | 495 | for (i = 0; i < queue->limit; i++) { |
| 496 | queue->entries[i].flags = 0; |
| 497 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 498 | rt2x00dev->ops->lib->init_rxentry(rt2x00dev, |
| 499 | &queue->entries[i]); |
Ivo van Doorn | 9c0ab71 | 2008-07-21 19:06:02 +0200 | [diff] [blame^] | 500 | } |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev) |
| 504 | { |
| 505 | struct data_queue *queue; |
| 506 | unsigned int i; |
| 507 | |
| 508 | txall_queue_for_each(rt2x00dev, queue) { |
| 509 | rt2x00queue_reset(queue); |
| 510 | |
| 511 | if (!rt2x00dev->ops->lib->init_txentry) |
| 512 | continue; |
| 513 | |
Ivo van Doorn | 9c0ab71 | 2008-07-21 19:06:02 +0200 | [diff] [blame^] | 514 | for (i = 0; i < queue->limit; i++) { |
| 515 | queue->entries[i].flags = 0; |
| 516 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 517 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, |
| 518 | &queue->entries[i]); |
Ivo van Doorn | 9c0ab71 | 2008-07-21 19:06:02 +0200 | [diff] [blame^] | 519 | } |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 520 | } |
| 521 | } |
| 522 | |
| 523 | static int rt2x00queue_alloc_entries(struct data_queue *queue, |
| 524 | const struct data_queue_desc *qdesc) |
| 525 | { |
| 526 | struct queue_entry *entries; |
| 527 | unsigned int entry_size; |
| 528 | unsigned int i; |
| 529 | |
| 530 | rt2x00queue_reset(queue); |
| 531 | |
| 532 | queue->limit = qdesc->entry_num; |
Ivo van Doorn | b869767 | 2008-06-06 22:53:14 +0200 | [diff] [blame] | 533 | queue->threshold = DIV_ROUND_UP(qdesc->entry_num, 10); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 534 | queue->data_size = qdesc->data_size; |
| 535 | queue->desc_size = qdesc->desc_size; |
| 536 | |
| 537 | /* |
| 538 | * Allocate all queue entries. |
| 539 | */ |
| 540 | entry_size = sizeof(*entries) + qdesc->priv_size; |
| 541 | entries = kzalloc(queue->limit * entry_size, GFP_KERNEL); |
| 542 | if (!entries) |
| 543 | return -ENOMEM; |
| 544 | |
| 545 | #define QUEUE_ENTRY_PRIV_OFFSET(__base, __index, __limit, __esize, __psize) \ |
Adam Baker | 231be4e | 2008-02-10 22:48:19 +0100 | [diff] [blame] | 546 | ( ((char *)(__base)) + ((__limit) * (__esize)) + \ |
| 547 | ((__index) * (__psize)) ) |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 548 | |
| 549 | for (i = 0; i < queue->limit; i++) { |
| 550 | entries[i].flags = 0; |
| 551 | entries[i].queue = queue; |
| 552 | entries[i].skb = NULL; |
| 553 | entries[i].entry_idx = i; |
| 554 | entries[i].priv_data = |
| 555 | QUEUE_ENTRY_PRIV_OFFSET(entries, i, queue->limit, |
| 556 | sizeof(*entries), qdesc->priv_size); |
| 557 | } |
| 558 | |
| 559 | #undef QUEUE_ENTRY_PRIV_OFFSET |
| 560 | |
| 561 | queue->entries = entries; |
| 562 | |
| 563 | return 0; |
| 564 | } |
| 565 | |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 566 | static void rt2x00queue_free_skbs(struct rt2x00_dev *rt2x00dev, |
| 567 | struct data_queue *queue) |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 568 | { |
| 569 | unsigned int i; |
| 570 | |
| 571 | if (!queue->entries) |
| 572 | return; |
| 573 | |
| 574 | for (i = 0; i < queue->limit; i++) { |
| 575 | if (queue->entries[i].skb) |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 576 | rt2x00queue_free_skb(rt2x00dev, queue->entries[i].skb); |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 577 | } |
| 578 | } |
| 579 | |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 580 | static int rt2x00queue_alloc_rxskbs(struct rt2x00_dev *rt2x00dev, |
| 581 | struct data_queue *queue) |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 582 | { |
| 583 | unsigned int i; |
| 584 | struct sk_buff *skb; |
| 585 | |
| 586 | for (i = 0; i < queue->limit; i++) { |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 587 | skb = rt2x00queue_alloc_rxskb(rt2x00dev, &queue->entries[i]); |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 588 | if (!skb) |
Ivo van Doorn | 61243d8 | 2008-06-20 22:10:53 +0200 | [diff] [blame] | 589 | return -ENOMEM; |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 590 | queue->entries[i].skb = skb; |
| 591 | } |
| 592 | |
| 593 | return 0; |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 594 | } |
| 595 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 596 | int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev) |
| 597 | { |
| 598 | struct data_queue *queue; |
| 599 | int status; |
| 600 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 601 | status = rt2x00queue_alloc_entries(rt2x00dev->rx, rt2x00dev->ops->rx); |
| 602 | if (status) |
| 603 | goto exit; |
| 604 | |
| 605 | tx_queue_for_each(rt2x00dev, queue) { |
| 606 | status = rt2x00queue_alloc_entries(queue, rt2x00dev->ops->tx); |
| 607 | if (status) |
| 608 | goto exit; |
| 609 | } |
| 610 | |
| 611 | status = rt2x00queue_alloc_entries(rt2x00dev->bcn, rt2x00dev->ops->bcn); |
| 612 | if (status) |
| 613 | goto exit; |
| 614 | |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 615 | if (test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) { |
| 616 | status = rt2x00queue_alloc_entries(&rt2x00dev->bcn[1], |
| 617 | rt2x00dev->ops->atim); |
| 618 | if (status) |
| 619 | goto exit; |
| 620 | } |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 621 | |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 622 | status = rt2x00queue_alloc_rxskbs(rt2x00dev, rt2x00dev->rx); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 623 | if (status) |
| 624 | goto exit; |
| 625 | |
| 626 | return 0; |
| 627 | |
| 628 | exit: |
| 629 | ERROR(rt2x00dev, "Queue entries allocation failed.\n"); |
| 630 | |
| 631 | rt2x00queue_uninitialize(rt2x00dev); |
| 632 | |
| 633 | return status; |
| 634 | } |
| 635 | |
| 636 | void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev) |
| 637 | { |
| 638 | struct data_queue *queue; |
| 639 | |
Gertjan van Wingerde | c4da004 | 2008-06-16 19:56:31 +0200 | [diff] [blame] | 640 | rt2x00queue_free_skbs(rt2x00dev, rt2x00dev->rx); |
Gertjan van Wingerde | 30caa6e | 2008-06-16 19:56:08 +0200 | [diff] [blame] | 641 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 642 | queue_for_each(rt2x00dev, queue) { |
| 643 | kfree(queue->entries); |
| 644 | queue->entries = NULL; |
| 645 | } |
| 646 | } |
| 647 | |
Ivo van Doorn | 8f53927 | 2008-02-10 22:51:41 +0100 | [diff] [blame] | 648 | static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev, |
| 649 | struct data_queue *queue, enum data_queue_qid qid) |
| 650 | { |
| 651 | spin_lock_init(&queue->lock); |
| 652 | |
| 653 | queue->rt2x00dev = rt2x00dev; |
| 654 | queue->qid = qid; |
| 655 | queue->aifs = 2; |
| 656 | queue->cw_min = 5; |
| 657 | queue->cw_max = 10; |
| 658 | } |
| 659 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 660 | int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev) |
| 661 | { |
| 662 | struct data_queue *queue; |
| 663 | enum data_queue_qid qid; |
| 664 | unsigned int req_atim = |
| 665 | !!test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags); |
| 666 | |
| 667 | /* |
| 668 | * We need the following queues: |
| 669 | * RX: 1 |
Gertjan van Wingerde | 61448f8 | 2008-05-10 13:43:33 +0200 | [diff] [blame] | 670 | * TX: ops->tx_queues |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 671 | * Beacon: 1 |
| 672 | * Atim: 1 (if required) |
| 673 | */ |
Gertjan van Wingerde | 61448f8 | 2008-05-10 13:43:33 +0200 | [diff] [blame] | 674 | rt2x00dev->data_queues = 2 + rt2x00dev->ops->tx_queues + req_atim; |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 675 | |
| 676 | queue = kzalloc(rt2x00dev->data_queues * sizeof(*queue), GFP_KERNEL); |
| 677 | if (!queue) { |
| 678 | ERROR(rt2x00dev, "Queue allocation failed.\n"); |
| 679 | return -ENOMEM; |
| 680 | } |
| 681 | |
| 682 | /* |
| 683 | * Initialize pointers |
| 684 | */ |
| 685 | rt2x00dev->rx = queue; |
| 686 | rt2x00dev->tx = &queue[1]; |
Gertjan van Wingerde | 61448f8 | 2008-05-10 13:43:33 +0200 | [diff] [blame] | 687 | rt2x00dev->bcn = &queue[1 + rt2x00dev->ops->tx_queues]; |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 688 | |
| 689 | /* |
| 690 | * Initialize queue parameters. |
| 691 | * RX: qid = QID_RX |
| 692 | * TX: qid = QID_AC_BE + index |
| 693 | * TX: cw_min: 2^5 = 32. |
| 694 | * TX: cw_max: 2^10 = 1024. |
Ivo van Doorn | 565a019 | 2008-06-03 20:29:05 +0200 | [diff] [blame] | 695 | * BCN: qid = QID_BEACON |
| 696 | * ATIM: qid = QID_ATIM |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 697 | */ |
Ivo van Doorn | 8f53927 | 2008-02-10 22:51:41 +0100 | [diff] [blame] | 698 | rt2x00queue_init(rt2x00dev, rt2x00dev->rx, QID_RX); |
| 699 | |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 700 | qid = QID_AC_BE; |
Ivo van Doorn | 8f53927 | 2008-02-10 22:51:41 +0100 | [diff] [blame] | 701 | tx_queue_for_each(rt2x00dev, queue) |
| 702 | rt2x00queue_init(rt2x00dev, queue, qid++); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 703 | |
Ivo van Doorn | 565a019 | 2008-06-03 20:29:05 +0200 | [diff] [blame] | 704 | rt2x00queue_init(rt2x00dev, &rt2x00dev->bcn[0], QID_BEACON); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 705 | if (req_atim) |
Ivo van Doorn | 565a019 | 2008-06-03 20:29:05 +0200 | [diff] [blame] | 706 | rt2x00queue_init(rt2x00dev, &rt2x00dev->bcn[1], QID_ATIM); |
Ivo van Doorn | 181d690 | 2008-02-05 16:42:23 -0500 | [diff] [blame] | 707 | |
| 708 | return 0; |
| 709 | } |
| 710 | |
| 711 | void rt2x00queue_free(struct rt2x00_dev *rt2x00dev) |
| 712 | { |
| 713 | kfree(rt2x00dev->rx); |
| 714 | rt2x00dev->rx = NULL; |
| 715 | rt2x00dev->tx = NULL; |
| 716 | rt2x00dev->bcn = NULL; |
| 717 | } |