iwlagn: cmd_queue moves to iwl_shared
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 26 Aug 2011 06:10:40 +0000 (23:10 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 29 Aug 2011 19:25:31 +0000 (15:25 -0400)
Since it is used by all the layers, it needs to move to iwl_shared.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-prph.h
drivers/net/wireless/iwlwifi/iwl-shared.h
drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
drivers/net/wireless/iwlwifi/iwl-trans.c

index 048ccbae82f0c4e1c9c5a8ff76aa9ec584dd5319..6db90854048dcf3f0ed15cae8c62d53bba2eb31d 100644 (file)
@@ -1103,7 +1103,7 @@ int iwlagn_wait_tx_queue_empty(struct iwl_priv *priv)
 
        /* waiting for all the tx frames complete might take a while */
        for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) {
-               if (cnt == priv->cmd_queue)
+               if (cnt == priv->shrd->cmd_queue)
                        continue;
                txq = &priv->txq[cnt];
                q = &txq->q;
index e8177fb7ae2cbcc7ea36be86cae00cfa053d0af8..e61c68958b8c43c5a9774e7956d275ceaa09ea24 100644 (file)
@@ -1244,10 +1244,10 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
 
        if (ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN) {
                priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN;
-               priv->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
+               priv->shrd->cmd_queue = IWL_IPAN_CMD_QUEUE_NUM;
        } else {
                priv->sta_key_max_num = STA_KEY_MAX_NUM;
-               priv->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
+               priv->shrd->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
        }
 
        /*
index 2aeafa18579fe2365cb5fd937732b0fe762ba84f..02b70dcb93c3bd4637e9b1ba74d0355936e6e34a 100644 (file)
@@ -1818,14 +1818,14 @@ void iwl_bg_watchdog(unsigned long data)
                return;
 
        /* monitor and check for stuck cmd queue */
-       if (iwl_check_stuck_queue(priv, priv->cmd_queue))
+       if (iwl_check_stuck_queue(priv, priv->shrd->cmd_queue))
                return;
 
        /* monitor and check for other stuck queues */
        if (iwl_is_any_associated(priv)) {
                for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) {
                        /* skip as we already checked the command queue */
-                       if (cnt == priv->cmd_queue)
+                       if (cnt == priv->shrd->cmd_queue)
                                continue;
                        if (iwl_check_stuck_queue(priv, cnt))
                                return;
index 57445c22fcbc0947f4de4a844afd2cab982386ea..19a0ea9f50450a6f17a27b776bbd9e99b8e57923 100644 (file)
@@ -1237,9 +1237,6 @@ struct iwl_priv {
        /* microcode/device supports multiple contexts */
        u8 valid_contexts;
 
-       /* command queue number */
-       u8 cmd_queue;
-
        /* max number of station keys */
        u8 sta_key_max_num;
 
index 40f6dd4decff8be392a5db10922f246f848e205f..bebdd828f324ef2295e6bc92525c401792dcdc59 100644 (file)
 
 #define SCD_QUEUECHAIN_SEL_ALL(priv)   \
        (((1<<hw_params(priv).max_txq_num) - 1) &\
-       (~(1<<(priv)->cmd_queue)))
+       (~(1<<(priv)->shrd->cmd_queue)))
 
 #define SCD_BASE                       (PRPH_BASE + 0xa02c00)
 
index 483785c3fb046029e37c7c64b159bd587956f41b..05621746825adcf872032060a3f7ffc722dd8b74 100644 (file)
@@ -143,6 +143,7 @@ struct iwl_hw_params {
  *
  * @dbg_level_dev: dbg level set per device. Prevails on
  *     iwlagn_mod_params.debug_level if set (!= 0)
+ * @cmd_queue: command queue number
  * @bus: pointer to the bus layer data
  * @priv: pointer to the upper layer data
  * @hw_params: see struct iwl_hw_params
@@ -152,6 +153,8 @@ struct iwl_shared {
        u32 dbg_level_dev;
 #endif /* CONFIG_IWLWIFI_DEBUG */
 
+       u8 cmd_queue;
+
        struct iwl_bus *bus;
        struct iwl_priv *priv;
        struct iwl_hw_params hw_params;
index a6b2b1db0b1dd11051e25d24f852ce602ec4fde7..b751f52905c0bce5cca941422de7879c1be2d3f1 100644 (file)
@@ -349,7 +349,7 @@ void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv,
 
        WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX);
 
-       if (txq_id != priv->cmd_queue)
+       if (txq_id != priv->shrd->cmd_queue)
                sta_id = txq->cmd[read_ptr]->cmd.tx.sta_id;
 
        bc_ent = cpu_to_le16(1 | (sta_id << 12));
@@ -526,7 +526,7 @@ int iwl_trans_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
  */
 static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 {
-       struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue];
+       struct iwl_tx_queue *txq = &priv->txq[priv->shrd->cmd_queue];
        struct iwl_queue *q = &txq->q;
        struct iwl_device_cmd *out_cmd;
        struct iwl_cmd_meta *out_meta;
@@ -618,8 +618,9 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 
        out_cmd->hdr.cmd = cmd->id;
        out_cmd->hdr.flags = 0;
-       out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(priv->cmd_queue) |
-                                           INDEX_TO_SEQ(q->write_ptr));
+       out_cmd->hdr.sequence =
+               cpu_to_le16(QUEUE_TO_SEQ(priv->shrd->cmd_queue) |
+                                        INDEX_TO_SEQ(q->write_ptr));
 
        /* and copy the data that needs to be copied */
 
@@ -638,7 +639,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
                        get_cmd_string(out_cmd->hdr.cmd),
                        out_cmd->hdr.cmd,
                        le16_to_cpu(out_cmd->hdr.sequence), cmd_size,
-                       q->write_ptr, idx, priv->cmd_queue);
+                       q->write_ptr, idx, priv->shrd->cmd_queue);
 
        phys_addr = dma_map_single(priv->bus->dev, &out_cmd->hdr, copy_size,
                                DMA_BIDIRECTIONAL);
@@ -752,17 +753,17 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
        int cmd_index;
        struct iwl_device_cmd *cmd;
        struct iwl_cmd_meta *meta;
-       struct iwl_tx_queue *txq = &priv->txq[priv->cmd_queue];
+       struct iwl_tx_queue *txq = &priv->txq[priv->shrd->cmd_queue];
        unsigned long flags;
 
        /* If a Tx command is being handled and it isn't in the actual
         * command queue then there a command routing bug has been introduced
         * in the queue management code. */
-       if (WARN(txq_id != priv->cmd_queue,
+       if (WARN(txq_id != priv->shrd->cmd_queue,
                 "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n",
-                 txq_id, priv->cmd_queue, sequence,
-                 priv->txq[priv->cmd_queue].q.read_ptr,
-                 priv->txq[priv->cmd_queue].q.write_ptr)) {
+                 txq_id, priv->shrd->cmd_queue, sequence,
+                 priv->txq[priv->shrd->cmd_queue].q.read_ptr,
+                 priv->txq[priv->shrd->cmd_queue].q.write_ptr)) {
                iwl_print_hex_error(priv, pkt, 32);
                return;
        }
@@ -1002,7 +1003,7 @@ cancel:
                 * in later, it will possibly set an invalid
                 * address (cmd->meta.source).
                 */
-               priv->txq[priv->cmd_queue].meta[cmd_idx].flags &=
+               priv->txq[priv->shrd->cmd_queue].meta[cmd_idx].flags &=
                                                        ~CMD_WANT_SKB;
        }
 fail:
index 92128383cae7efd2cfa70ded7ef9cbdbf218a32e..7a689df994967d2378e26faf99118ded60356357 100644 (file)
@@ -311,7 +311,7 @@ static int iwl_trans_txq_alloc(struct iwl_priv *priv, struct iwl_tx_queue *txq,
        /* Alloc driver data array and TFD circular buffer */
        /* Driver private data, only for Tx (not command) queues,
         * not shared with device. */
-       if (txq_id != priv->cmd_queue) {
+       if (txq_id != priv->shrd->cmd_queue) {
                txq->txb = kzalloc(sizeof(txq->txb[0]) *
                                   TFD_QUEUE_SIZE_MAX, GFP_KERNEL);
                if (!txq->txb) {
@@ -515,7 +515,7 @@ static int iwl_trans_tx_alloc(struct iwl_priv *priv)
 
        /* Alloc and init all Tx queues, including the command queue (#4/#9) */
        for (txq_id = 0; txq_id < hw_params(priv).max_txq_num; txq_id++) {
-               slots_num = (txq_id == priv->cmd_queue) ?
+               slots_num = (txq_id == priv->shrd->cmd_queue) ?
                                        TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
                ret = iwl_trans_txq_alloc(priv, &priv->txq[txq_id], slots_num,
                                       txq_id);
@@ -558,7 +558,7 @@ static int iwl_tx_init(struct iwl_priv *priv)
 
        /* Alloc and init all Tx queues, including the command queue (#4/#9) */
        for (txq_id = 0; txq_id < hw_params(priv).max_txq_num; txq_id++) {
-               slots_num = (txq_id == priv->cmd_queue) ?
+               slots_num = (txq_id == priv->shrd->cmd_queue) ?
                                        TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
                ret = iwl_trans_txq_init(priv, &priv->txq[txq_id], slots_num,
                                       txq_id);
@@ -841,7 +841,7 @@ static void iwl_trans_tx_start(struct iwl_priv *priv)
        else
                queue_to_fifo = iwlagn_default_queue_to_tx_fifo;
 
-       iwl_trans_set_wr_ptrs(priv, priv->cmd_queue, 0);
+       iwl_trans_set_wr_ptrs(priv, priv->shrd->cmd_queue, 0);
 
        /* make sure all queue are not stopped */
        memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));