diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-rx.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rx.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 919a775121e4..c5f1aa0feac8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -244,25 +244,31 @@ void iwl_rx_allocate(struct iwl_priv *priv) | |||
244 | struct list_head *element; | 244 | struct list_head *element; |
245 | struct iwl_rx_mem_buffer *rxb; | 245 | struct iwl_rx_mem_buffer *rxb; |
246 | unsigned long flags; | 246 | unsigned long flags; |
247 | spin_lock_irqsave(&rxq->lock, flags); | 247 | |
248 | while (!list_empty(&rxq->rx_used)) { | 248 | while (1) { |
249 | spin_lock_irqsave(&rxq->lock, flags); | ||
250 | |||
251 | if (list_empty(&rxq->rx_used)) { | ||
252 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
253 | return; | ||
254 | } | ||
249 | element = rxq->rx_used.next; | 255 | element = rxq->rx_used.next; |
250 | rxb = list_entry(element, struct iwl_rx_mem_buffer, list); | 256 | rxb = list_entry(element, struct iwl_rx_mem_buffer, list); |
257 | list_del(element); | ||
258 | |||
259 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
251 | 260 | ||
252 | /* Alloc a new receive buffer */ | 261 | /* Alloc a new receive buffer */ |
253 | rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256, | 262 | rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256, |
254 | __GFP_NOWARN | GFP_ATOMIC); | 263 | GFP_KERNEL); |
255 | if (!rxb->skb) { | 264 | if (!rxb->skb) { |
256 | if (net_ratelimit()) | 265 | printk(KERN_CRIT DRV_NAME |
257 | printk(KERN_CRIT DRV_NAME | 266 | "Can not allocate SKB buffers\n"); |
258 | ": Can not allocate SKB buffers\n"); | ||
259 | /* We don't reschedule replenish work here -- we will | 267 | /* We don't reschedule replenish work here -- we will |
260 | * call the restock method and if it still needs | 268 | * call the restock method and if it still needs |
261 | * more buffers it will schedule replenish */ | 269 | * more buffers it will schedule replenish */ |
262 | break; | 270 | break; |
263 | } | 271 | } |
264 | priv->alloc_rxb_skb++; | ||
265 | list_del(element); | ||
266 | 272 | ||
267 | /* Get physical address of RB/SKB */ | 273 | /* Get physical address of RB/SKB */ |
268 | rxb->real_dma_addr = pci_map_single( | 274 | rxb->real_dma_addr = pci_map_single( |
@@ -276,12 +282,15 @@ void iwl_rx_allocate(struct iwl_priv *priv) | |||
276 | rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256); | 282 | rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256); |
277 | skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr); | 283 | skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr); |
278 | 284 | ||
285 | spin_lock_irqsave(&rxq->lock, flags); | ||
286 | |||
279 | list_add_tail(&rxb->list, &rxq->rx_free); | 287 | list_add_tail(&rxb->list, &rxq->rx_free); |
280 | rxq->free_count++; | 288 | rxq->free_count++; |
289 | priv->alloc_rxb_skb++; | ||
290 | |||
291 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
281 | } | 292 | } |
282 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
283 | } | 293 | } |
284 | EXPORT_SYMBOL(iwl_rx_allocate); | ||
285 | 294 | ||
286 | void iwl_rx_replenish(struct iwl_priv *priv) | 295 | void iwl_rx_replenish(struct iwl_priv *priv) |
287 | { | 296 | { |