iwlwifi: handle shared memory Rx index access
authorRon Rindjunsky <ron.rindjunsky@intel.com>
Mon, 5 May 2008 02:22:49 +0000 (10:22 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 14 May 2008 20:29:46 +0000 (16:29 -0400)
This patch splits ucode's and driver's shared memory Rx index access to
match 4965 and 5000 offsets.

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl4965-base.c

index 866a93e3de91b1e5fcc47a878da24baf02d67f26..a475ecea90039364ec021a08ebfa9fb098ad1442 100644 (file)
@@ -2006,7 +2006,7 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
        tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(rate_plcp, rate_flags);
 }
 
-int iwl4965_hw_get_rx_read(struct iwl_priv *priv)
+static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv)
 {
        struct iwl4965_shared *s = priv->shared_virt;
        return le32_to_cpu(s->rb_closed) & 0xFFF;
@@ -2093,6 +2093,8 @@ static int iwl4965_alloc_shared_mem(struct iwl_priv *priv)
 
        memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared));
 
+       priv->rb_closed_offset = offsetof(struct iwl4965_shared, rb_closed);
+
        return 0;
 }
 
@@ -3824,6 +3826,7 @@ static struct iwl_lib_ops iwl4965_lib = {
        .set_hw_params = iwl4965_hw_set_hw_params,
        .alloc_shared_mem = iwl4965_alloc_shared_mem,
        .free_shared_mem = iwl4965_free_shared_mem,
+       .shared_mem_rx_idx = iwl4965_shared_mem_rx_idx,
        .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl,
        .disable_tx_fifo = iwl4965_disable_tx_fifo,
        .rx_handler_setup = iwl4965_rx_handler_setup,
index feffcafe1495f7cd84af4cf7c39da7ea9fa46e91..d6b91f7e0b1b25262db60c025fb543b2cbbadfa4 100644 (file)
@@ -362,6 +362,8 @@ static int iwl5000_alloc_shared_mem(struct iwl_priv *priv)
 
        memset(priv->shared_virt, 0, sizeof(struct iwl5000_shared));
 
+       priv->rb_closed_offset = offsetof(struct iwl5000_shared, rb_closed);
+
        return 0;
 }
 
@@ -374,6 +376,12 @@ static void iwl5000_free_shared_mem(struct iwl_priv *priv)
                                    priv->shared_phys);
 }
 
+static int iwl5000_shared_mem_rx_idx(struct iwl_priv *priv)
+{
+       struct iwl5000_shared *s = priv->shared_virt;
+       return le32_to_cpu(s->rb_closed) & 0xFFF;
+}
+
 /**
  * iwl5000_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
  */
@@ -466,6 +474,7 @@ static struct iwl_lib_ops iwl5000_lib = {
        .set_hw_params = iwl5000_hw_set_hw_params,
        .alloc_shared_mem = iwl5000_alloc_shared_mem,
        .free_shared_mem = iwl5000_free_shared_mem,
+       .shared_mem_rx_idx = iwl5000_shared_mem_rx_idx,
        .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
        .disable_tx_fifo = iwl5000_disable_tx_fifo,
        .apm_ops = {
index 08eccdefd72ee9e59efa2390386a2a1b0aade28b..77428db6a21d488e589b9c3dee5f69178c1573c1 100644 (file)
@@ -103,6 +103,7 @@ struct iwl_lib_ops {
        /* ucode shared memory */
        int (*alloc_shared_mem)(struct iwl_priv *priv);
        void (*free_shared_mem)(struct iwl_priv *priv);
+       int (*shared_mem_rx_idx)(struct iwl_priv *priv);
        void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv,
                                        struct iwl4965_tx_queue *txq,
                                        u16 byte_cnt);
index 25dce14c87d8bf0fddbefdeb84906f552617efd9..1683bee800d1b377ed5f2c0a5bda5d3c8799d2f9 100644 (file)
@@ -697,7 +697,6 @@ extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
 extern int iwl4965_hw_get_temperature(struct iwl_priv *priv);
 extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
                                 struct iwl4965_frame *frame, u8 rate);
-extern int iwl4965_hw_get_rx_read(struct iwl_priv *priv);
 extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
                                     struct iwl_cmd *cmd,
                                     struct ieee80211_tx_control *ctrl,
@@ -1138,6 +1137,7 @@ struct iwl_priv {
        struct iwl_hw_params hw_params;
        /* driver/uCode shared Tx Byte Counts and Rx status */
        void *shared_virt;
+       int rb_closed_offset;
        /* Physical Pointer to Tx Byte Counts and Rx status */
        dma_addr_t shared_phys;
 
index 171751e417d57be436fc48e908ca46ace862056a..a2eb90d40b7e1febda4e4d44810105e3f4386241 100644 (file)
@@ -399,8 +399,7 @@ int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
 
        /* Tell device where in DRAM to update its Rx status */
        iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG,
-                          (priv->shared_phys +
-                           offsetof(struct iwl4965_shared, rb_closed)) >> 4);
+                          (priv->shared_phys + priv->rb_closed_offset) >> 4);
 
        /* Enable Rx DMA, enable host interrupt, Rx buffer size 4k, 256 RBDs */
        iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG,
index 88f3554c0fbcefdf1002cee38efd61c1c1198f1d..09f2a6383d2dbdf1096407f6730f8be55e9e378f 100644 (file)
@@ -3095,7 +3095,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
 
        /* uCode's read index (stored in shared DRAM) indicates the last Rx
         * buffer that the driver may process (last buffer filled by ucode). */
-       r = iwl4965_hw_get_rx_read(priv);
+       r = priv->cfg->ops->lib->shared_mem_rx_idx(priv);
        i = rxq->read;
 
        /* Rx interrupt, but nothing sent from uCode */