iwl3945: use hw_params.rx_buf_size
authorWinkler, Tomas <tomas.winkler@intel.com>
Thu, 8 Jan 2009 18:19:57 +0000 (10:19 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 Jan 2009 21:00:14 +0000 (16:00 -0500)
This patch makes 3945 use of hw_params.rx_buf_size instead of
IWL_RX_BUF_SIZE. It also renames IWL_RX_BUF_SIZE to IWL_RX_BUF_SIZE_3K
and moves rx buffer defines into iwl-fh.h.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-3945.h
drivers/net/wireless/iwlwifi/iwl-4965-hw.h
drivers/net/wireless/iwlwifi/iwl-fh.h
drivers/net/wireless/iwlwifi/iwl3945-base.c

index db7b949020c2d9a4f01bb3920c324b00096ee87d..8a378bd1a7abf8c5aa3110e2d7f0ce21fd939f8b 100644 (file)
@@ -2485,7 +2485,7 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
                return -ENOMEM;
        }
 
-       priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE;
+       priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE_3K;
        priv->hw_params.max_pkt_size = 2342;
        priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
        priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
index be30134533595ad1b56f8f955a23d44de393e910..491313baba63468c89d3f391ac64894de62f7b30 100644 (file)
@@ -96,7 +96,6 @@ enum iwl3945_antenna {
  * else RTS for data/management frames where MPDU is larger
  *   than RTS value.
  */
-#define IWL_RX_BUF_SIZE           3000U
 #define DEFAULT_RTS_THRESHOLD     2347U
 #define MIN_RTS_THRESHOLD         0U
 #define MAX_RTS_THRESHOLD         2347U
index e751c53ae1f88cef199c4b759b3f0a4103e69ffd..ed6baa539f5028a603059a6ad7a06eefb51e8e26 100644 (file)
 
 #define IWL_DEFAULT_TX_RETRY  15
 
-#define RX_QUEUE_SIZE                         256
-#define RX_QUEUE_MASK                         255
-#define RX_QUEUE_SIZE_LOG                     8
-
-/*
- * RX related structures and functions
- */
-#define RX_FREE_BUFFERS 64
-#define RX_LOW_WATERMARK 8
-
-/* Size of one Rx buffer in host DRAM */
-#define IWL_RX_BUF_SIZE_4K (4 * 1024)
-#define IWL_RX_BUF_SIZE_8K (8 * 1024)
 
 /* Sizes and addresses for instruction and data memory (SRAM) in
  * 4965's embedded processor.  Driver access is via HBUS_TARG_MEM_* regs. */
index a72aa1b32c8a94c02a70e0a05b51a46d61c10bdd..ad5a24ecc2de03baca4c21301a6caca389717ef6 100644 (file)
  */
 #define FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN   (0x00000002)
 
+#define RX_QUEUE_SIZE                         256
+#define RX_QUEUE_MASK                         255
+#define RX_QUEUE_SIZE_LOG                     8
+
+/*
+ * RX related structures and functions
+ */
+#define RX_FREE_BUFFERS 64
+#define RX_LOW_WATERMARK 8
+
+/* Size of one Rx buffer in host DRAM */
+#define IWL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */
+#define IWL_RX_BUF_SIZE_4K (4 * 1024)
+#define IWL_RX_BUF_SIZE_8K (8 * 1024)
+
 /**
  * struct iwl_rb_status - reseve buffer status
  *     host memory mapped FH registers
index e05a9d604b9bb5097a003ceb0bd76f3347ca8f59..d145002d0a69e0b1de5cab0af57ed59eb932b893 100644 (file)
@@ -3281,7 +3281,8 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv)
 
                /* Alloc a new receive buffer */
                rxb->skb =
-                   alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC);
+                   alloc_skb(priv->hw_params.rx_buf_size,
+                               __GFP_NOWARN | GFP_ATOMIC);
                if (!rxb->skb) {
                        if (net_ratelimit())
                                IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
@@ -3303,9 +3304,10 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv)
                list_del(element);
 
                /* Get physical address of RB/SKB */
-               rxb->real_dma_addr =
-                   pci_map_single(priv->pci_dev, rxb->skb->data,
-                                  IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+               rxb->real_dma_addr = pci_map_single(priv->pci_dev,
+                                               rxb->skb->data,
+                                               priv->hw_params.rx_buf_size,
+                                               PCI_DMA_FROMDEVICE);
                list_add_tail(&rxb->list, &rxq->rx_free);
                rxq->free_count++;
        }
@@ -3454,7 +3456,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
                rxq->queue[i] = NULL;
 
                pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->real_dma_addr,
-                                           IWL_RX_BUF_SIZE,
+                                           priv->hw_params.rx_buf_size,
                                            PCI_DMA_FROMDEVICE);
                pkt = (struct iwl_rx_packet *)rxb->skb->data;
 
@@ -3504,7 +3506,8 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
                }
 
                pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
-                                IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+                               priv->hw_params.rx_buf_size,
+                               PCI_DMA_FROMDEVICE);
                spin_lock_irqsave(&rxq->lock, flags);
                list_add_tail(&rxb->list, &priv->rxq.rx_used);
                spin_unlock_irqrestore(&rxq->lock, flags);