aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2238c9f2018c..090966837f3c 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1134,6 +1134,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1134 struct iwl_rx_queue *rxq = &priv->rxq; 1134 struct iwl_rx_queue *rxq = &priv->rxq;
1135 struct list_head *element; 1135 struct list_head *element;
1136 struct iwl_rx_mem_buffer *rxb; 1136 struct iwl_rx_mem_buffer *rxb;
1137 struct sk_buff *skb;
1137 unsigned long flags; 1138 unsigned long flags;
1138 1139
1139 while (1) { 1140 while (1) {
@@ -1143,17 +1144,11 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1143 spin_unlock_irqrestore(&rxq->lock, flags); 1144 spin_unlock_irqrestore(&rxq->lock, flags);
1144 return; 1145 return;
1145 } 1146 }
1146
1147 element = rxq->rx_used.next;
1148 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1149 list_del(element);
1150 spin_unlock_irqrestore(&rxq->lock, flags); 1147 spin_unlock_irqrestore(&rxq->lock, flags);
1151 1148
1152 /* Alloc a new receive buffer */ 1149 /* Alloc a new receive buffer */
1153 rxb->skb = 1150 skb = alloc_skb(priv->hw_params.rx_buf_size, priority);
1154 alloc_skb(priv->hw_params.rx_buf_size, 1151 if (!skb) {
1155 priority);
1156 if (!rxb->skb) {
1157 if (net_ratelimit()) 1152 if (net_ratelimit())
1158 IWL_CRIT(priv, ": Can not allocate SKB buffers\n"); 1153 IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
1159 /* We don't reschedule replenish work here -- we will 1154 /* We don't reschedule replenish work here -- we will
@@ -1162,6 +1157,19 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1162 break; 1157 break;
1163 } 1158 }
1164 1159
1160 spin_lock_irqsave(&rxq->lock, flags);
1161 if (list_empty(&rxq->rx_used)) {
1162 spin_unlock_irqrestore(&rxq->lock, flags);
1163 dev_kfree_skb_any(skb);
1164 return;
1165 }
1166 element = rxq->rx_used.next;
1167 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
1168 list_del(element);
1169 spin_unlock_irqrestore(&rxq->lock, flags);
1170
1171 rxb->skb = skb;
1172
1165 /* If radiotap head is required, reserve some headroom here. 1173 /* If radiotap head is required, reserve some headroom here.
1166 * The physical head count is a variable rx_stats->phy_count. 1174 * The physical head count is a variable rx_stats->phy_count.
1167 * We reserve 4 bytes here. Plus these extra bytes, the 1175 * We reserve 4 bytes here. Plus these extra bytes, the