rpms/kernel/devel linux-2.6-iwlwifi-use-GFP_KERNEL-to-allocate-Rx-SKB-memory.patch, NONE, 1.1 kernel.spec, 1.1166, 1.1167 linux-2.6-hostap-skb-cb-hack.patch, 1.1, NONE linux-2.6-iwl3945-ibss-tsf-fix.patch, 1.1, NONE linux-2.6-iwlagn-downgrade-BUG_ON-in-interrupt.patch, 1.1, NONE linux-2.6-iwlwifi-use-dma_alloc_coherent.patch, 1.3, NONE

John W. Linville linville at fedoraproject.org
Wed Dec 17 16:44:26 UTC 2008


Author: linville

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9348

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-iwlwifi-use-GFP_KERNEL-to-allocate-Rx-SKB-memory.patch 
Removed Files:
	linux-2.6-hostap-skb-cb-hack.patch 
	linux-2.6-iwl3945-ibss-tsf-fix.patch 
	linux-2.6-iwlagn-downgrade-BUG_ON-in-interrupt.patch 
	linux-2.6-iwlwifi-use-dma_alloc_coherent.patch 
Log Message:
iwlwifi: use GFP_KERNEL to allocate Rx SKB memory

linux-2.6-iwlwifi-use-GFP_KERNEL-to-allocate-Rx-SKB-memory.patch:

--- NEW FILE linux-2.6-iwlwifi-use-GFP_KERNEL-to-allocate-Rx-SKB-memory.patch ---
>From yi.zhu at intel.com Wed Dec 17 03:59:54 2008
Return-path: <yi.zhu at intel.com>
Envelope-to: linville at tuxdriver.com
Delivery-date: Wed, 17 Dec 2008 03:59:54 -0500
Received: from mga01.intel.com ([192.55.52.88])
	by smtp.tuxdriver.com with esmtp (Exim 4.63)
	(envelope-from <yi.zhu at intel.com>)
	id 1LCsG1-0002ki-Sg
	for linville at tuxdriver.com; Wed, 17 Dec 2008 03:59:54 -0500
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
  by fmsmga101.fm.intel.com with ESMTP; 17 Dec 2008 00:51:15 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="4.36,236,1228118400"; 
   d="scan'208";a="650475770"
Received: from santarosa.sh.intel.com (HELO localhost.localdomain) ([10.239.48.28])
  by fmsmga001.fm.intel.com with ESMTP; 17 Dec 2008 01:00:20 -0800
From: Zhu Yi <yi.zhu at intel.com>
To: linville at tuxdriver.com
Cc: linux-wireless at vger.kernel.org, ipw3945-devel at lists.sourceforge.net, Zhu Yi <yi.zhu at intel.com>
Subject: [PATCH 7/8] iwlwifi: use GFP_KERNEL to allocate Rx SKB memory
Date: Wed, 17 Dec 2008 16:52:33 +0800
Message-Id: <1229503954-30347-8-git-send-email-yi.zhu at intel.com>
X-Mailer: git-send-email 1.5.3.6
In-Reply-To: <1229503954-30347-7-git-send-email-yi.zhu at intel.com>
References: <1229503954-30347-1-git-send-email-yi.zhu at intel.com>
 <1229503954-30347-2-git-send-email-yi.zhu at intel.com>
 <1229503954-30347-3-git-send-email-yi.zhu at intel.com>
 <1229503954-30347-4-git-send-email-yi.zhu at intel.com>
 <1229503954-30347-5-git-send-email-yi.zhu at intel.com>
 <1229503954-30347-6-git-send-email-yi.zhu at intel.com>
 <1229503954-30347-7-git-send-email-yi.zhu at intel.com>
X-Spam-Score: -4.0 (----)
X-Spam-Status: No
Status: RO
Content-Length: 3920
Lines: 138

Previously we allocate Rx SKB with GFP_ATOMIC flag. This is because we need
to hold a spinlock to protect the two rx_used and rx_free lists operation
in the rxq.

	spin_lock();
	...
	element = rxq->rx_used.next;
	element->skb = alloc_skb(..., GFP_ATOMIC);
	list_del(element);
	list_add_tail(&element->list, &rxq->rx_free);
	...
	spin_unlock();

After spliting the rx_used delete and rx_free insert into two operations,
we don't require the skb allocation in an atomic context any more (the
function itself is scheduled in a workqueue).

	spin_lock();
	...
	element = rxq->rx_used.next;
	list_del(element);
	...
	spin_unlock();
	...
	element->skb = alloc_skb(..., GFP_KERNEL);
	...
	spin_lock()
	...
	list_add_tail(&element->list, &rxq->rx_free);
	...
	spin_unlock();

This patch should fix the "iwlagn: Can not allocate SKB buffers" warning
we see recently.

Signed-off-by: Zhu Yi <yi.zhu at intel.com>
Acked-by: Tomas Winkler <tomas.winkler at intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c |   12 +-----------
 drivers/net/wireless/iwlwifi/iwl-rx.c  |   29 +++++++++++++++++++----------
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index d0fb7a3..8102815 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1112,16 +1112,6 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv)
 	priv->cfg->ops->lib->rx_handler_setup(priv);
 }
 
-/*
- * this should be called while priv->lock is locked
-*/
-static void __iwl_rx_replenish(struct iwl_priv *priv)
-{
-	iwl_rx_allocate(priv);
-	iwl_rx_queue_restock(priv);
-}
-
-
 /**
  * iwl_rx_handle - Main entry function for receiving responses from uCode
  *
@@ -1230,7 +1220,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
 			count++;
 			if (count >= 8) {
 				priv->rxq.read = i;
-				__iwl_rx_replenish(priv);
+				iwl_rx_queue_restock(priv);
 				count = 0;
 			}
 		}
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 919a775..c5f1aa0 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)
 	struct list_head *element;
 	struct iwl_rx_mem_buffer *rxb;
 	unsigned long flags;
-	spin_lock_irqsave(&rxq->lock, flags);
-	while (!list_empty(&rxq->rx_used)) {
+
+	while (1) {
+		spin_lock_irqsave(&rxq->lock, flags);
+
+		if (list_empty(&rxq->rx_used)) {
+			spin_unlock_irqrestore(&rxq->lock, flags);
+			return;
+		}
 		element = rxq->rx_used.next;
 		rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
+		list_del(element);
+
+		spin_unlock_irqrestore(&rxq->lock, flags);
 
 		/* Alloc a new receive buffer */
 		rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
-				__GFP_NOWARN | GFP_ATOMIC);
+				     GFP_KERNEL);
 		if (!rxb->skb) {
-			if (net_ratelimit())
-				printk(KERN_CRIT DRV_NAME
-				       ": Can not allocate SKB buffers\n");
+			printk(KERN_CRIT DRV_NAME
+				   "Can not allocate SKB buffers\n");
 			/* We don't reschedule replenish work here -- we will
 			 * call the restock method and if it still needs
 			 * more buffers it will schedule replenish */
 			break;
 		}
-		priv->alloc_rxb_skb++;
-		list_del(element);
 
 		/* Get physical address of RB/SKB */
 		rxb->real_dma_addr = pci_map_single(
@@ -276,12 +282,15 @@ void iwl_rx_allocate(struct iwl_priv *priv)
 		rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256);
 		skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr);
 
+		spin_lock_irqsave(&rxq->lock, flags);
+
 		list_add_tail(&rxb->list, &rxq->rx_free);
 		rxq->free_count++;
+		priv->alloc_rxb_skb++;
+
+		spin_unlock_irqrestore(&rxq->lock, flags);
 	}
-	spin_unlock_irqrestore(&rxq->lock, flags);
 }
-EXPORT_SYMBOL(iwl_rx_allocate);
 
 void iwl_rx_replenish(struct iwl_priv *priv)
 {
-- 
1.5.3.6





Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1166
retrieving revision 1.1167
diff -u -r1.1166 -r1.1167
--- kernel.spec	16 Dec 2008 18:09:39 -0000	1.1166
+++ kernel.spec	17 Dec 2008 16:43:55 -0000	1.1167
@@ -626,10 +626,7 @@
 
 Patch670: linux-2.6-ata-quirk.patch
 
-#Patch680: linux-2.6-iwlwifi-use-dma_alloc_coherent.patch
-Patch681: linux-2.6-iwlagn-downgrade-BUG_ON-in-interrupt.patch
-Patch682: linux-2.6-iwl3945-ibss-tsf-fix.patch
-Patch683: linux-2.6-hostap-skb-cb-hack.patch
+Patch680: linux-2.6-iwlwifi-use-GFP_KERNEL-to-allocate-Rx-SKB-memory.patch
 
 Patch690: linux-2.6-at76.patch
 
@@ -1143,14 +1140,8 @@
 # ia64 ata quirk
 ApplyPatch linux-2.6-ata-quirk.patch
 
-# fix spot's iwlwifi, hopefully...
-#ApplyPatch linux-2.6-iwlwifi-use-dma_alloc_coherent.patch
-# make jarod's iwl4965 not panic near N APs, hopefully
-#ApplyPatch linux-2.6-iwlagn-downgrade-BUG_ON-in-interrupt.patch
-# iwl3945 fix for stable ad-hoc mode connections (#459401)
-#ApplyPatch linux-2.6-iwl3945-ibss-tsf-fix.patch
-# hostap hack to still work w/ quetionable skb->cb usage
-#ApplyPatch linux-2.6-hostap-skb-cb-hack.patch
+# iwlwifi: use GFP_KERNEL to allocate Rx SKB memory
+ApplyPatch linux-2.6-iwlwifi-use-GFP_KERNEL-to-allocate-Rx-SKB-memory.patch
 
 # Add misc wireless bits from upstream wireless tree
 ApplyPatch linux-2.6-at76.patch
@@ -1772,6 +1763,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Wed Dec 17 2008 John W. Linville <linville at redhat.com>
+- iwlwifi: use GFP_KERNEL to allocate Rx SKB memory
+
 * Tue Dec 16 2008 Dave Jones <davej at redhat.com>
 - 2.6.28-rc8-git4
 


--- linux-2.6-hostap-skb-cb-hack.patch DELETED ---


--- linux-2.6-iwl3945-ibss-tsf-fix.patch DELETED ---


--- linux-2.6-iwlagn-downgrade-BUG_ON-in-interrupt.patch DELETED ---


--- linux-2.6-iwlwifi-use-dma_alloc_coherent.patch DELETED ---




More information about the fedora-extras-commits mailing list