diff options
author | Gertjan van Wingerde <gwingerde@kpnplanet.nl> | 2008-06-16 13:56:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-26 16:49:16 -0400 |
commit | c4da004857056e6ee034c4110ccdcba659077b7e (patch) | |
tree | 641f8d9ddab7b8b6ba41fefc57a517abce15e8e6 /drivers/net/wireless/rt2x00/rt2x00usb.c | |
parent | 30caa6e3d586442f7c3ad081260ee1b22bb123de (diff) |
rt2x00: Replace statically allocated DMA buffers with mapped skb's.
The current PCI drivers require a lot of pre-allocated DMA buffers. Reduce this
by using dynamically mapped skb's (using pci_map_single) instead of the pre-
allocated DMA buffers that are allocated at device start-up time.
At the same time move common RX path code into rt2x00lib from rt2x00pci and
rt2x00usb, as the RX paths now are now almost the same.
Signed-off-by: Gertjan van Wingerde <gwingerde@kpnplanet.nl>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00usb.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 29dba86c8cf0..552f0e94f800 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -266,9 +266,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
266 | { | 266 | { |
267 | struct queue_entry *entry = (struct queue_entry *)urb->context; | 267 | struct queue_entry *entry = (struct queue_entry *)urb->context; |
268 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 268 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
269 | struct sk_buff *skb; | 269 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); |
270 | struct skb_frame_desc *skbdesc; | ||
271 | struct rxdone_entry_desc rxdesc; | ||
272 | u8 rxd[32]; | 270 | u8 rxd[32]; |
273 | 271 | ||
274 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || | 272 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || |
@@ -284,36 +282,19 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) | |||
284 | goto skip_entry; | 282 | goto skip_entry; |
285 | 283 | ||
286 | /* | 284 | /* |
287 | * Fill in skb descriptor | 285 | * Fill in desc fields of the skb descriptor |
288 | */ | 286 | */ |
289 | skbdesc = get_skb_frame_desc(entry->skb); | ||
290 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
291 | skbdesc->entry = entry; | ||
292 | skbdesc->desc = rxd; | 287 | skbdesc->desc = rxd; |
293 | skbdesc->desc_len = entry->queue->desc_size; | 288 | skbdesc->desc_len = entry->queue->desc_size; |
294 | 289 | ||
295 | memset(&rxdesc, 0, sizeof(rxdesc)); | ||
296 | rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); | ||
297 | |||
298 | /* | ||
299 | * Allocate a new sk buffer to replace the current one. | ||
300 | * If allocation fails, we should drop the current frame | ||
301 | * so we can recycle the existing sk buffer for the new frame. | ||
302 | */ | ||
303 | skb = rt2x00queue_alloc_skb(entry->queue); | ||
304 | if (!skb) | ||
305 | goto skip_entry; | ||
306 | |||
307 | /* | 290 | /* |
308 | * Send the frame to rt2x00lib for further processing. | 291 | * Send the frame to rt2x00lib for further processing. |
309 | */ | 292 | */ |
310 | rt2x00lib_rxdone(entry, &rxdesc); | 293 | rt2x00lib_rxdone(rt2x00dev, entry); |
311 | 294 | ||
312 | /* | 295 | /* |
313 | * Replace current entry's skb with the newly allocated one, | 296 | * Reinitialize the urb. |
314 | * and reinitialize the urb. | ||
315 | */ | 297 | */ |
316 | entry->skb = skb; | ||
317 | urb->transfer_buffer = entry->skb->data; | 298 | urb->transfer_buffer = entry->skb->data; |
318 | urb->transfer_buffer_length = entry->skb->len; | 299 | urb->transfer_buffer_length = entry->skb->len; |
319 | 300 | ||