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>
 
        /* 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;
 
 
        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;
        }
 
        /*
 
                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;
 
        /* microcode/device supports multiple contexts */
        u8 valid_contexts;
 
-       /* command queue number */
-       u8 cmd_queue;
-
        /* max number of station keys */
        u8 sta_key_max_num;
 
 
 
 #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)
 
 
  *
  * @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
        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;
 
 
        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));
  */
 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;
 
        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 */
 
                        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);
        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;
        }
                 * 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:
 
        /* 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) {
 
        /* 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);
 
        /* 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);
        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));