iwlwifi: always build swq_id as virtual queue ID
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-tx.c
index 3290b15..90659bc 100644 (file)
@@ -49,30 +49,39 @@ void iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
        if (txq->need_update == 0)
                return;
 
-       /* if we're trying to save power */
-       if (test_bit(STATUS_POWER_PMI, &priv->status)) {
-               /* wake up nic if it's powered down ...
-                * uCode will wake up, and interrupt us again, so next
-                * time we'll skip this part. */
-               reg = iwl_read32(priv, CSR_UCODE_DRV_GP1);
-
-               if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
-                       IWL_DEBUG_INFO(priv, "Tx queue %d requesting wakeup, GP1 = 0x%x\n",
-                                     txq_id, reg);
-                       iwl_set_bit(priv, CSR_GP_CNTRL,
-                                   CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-                       return;
-               }
-
-               iwl_write_direct32(priv, HBUS_TARG_WRPTR,
-                                    txq->q.write_ptr | (txq_id << 8));
-
-       /* else not in power-save mode, uCode will never sleep when we're
-        * trying to tx (during RFKILL, we're not trying to tx). */
-       } else
+       if (priv->cfg->base_params->shadow_reg_enable) {
+               /* shadow register enabled */
                iwl_write32(priv, HBUS_TARG_WRPTR,
                            txq->q.write_ptr | (txq_id << 8));
+       } else {
+               /* if we're trying to save power */
+               if (test_bit(STATUS_POWER_PMI, &priv->status)) {
+                       /* wake up nic if it's powered down ...
+                        * uCode will wake up, and interrupt us again, so next
+                        * time we'll skip this part. */
+                       reg = iwl_read32(priv, CSR_UCODE_DRV_GP1);
+
+                       if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
+                               IWL_DEBUG_INFO(priv,
+                                       "Tx queue %d requesting wakeup,"
+                                       " GP1 = 0x%x\n", txq_id, reg);
+                               iwl_set_bit(priv, CSR_GP_CNTRL,
+                                       CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+                               return;
+                       }
+
+                       iwl_write_direct32(priv, HBUS_TARG_WRPTR,
+                                    txq->q.write_ptr | (txq_id << 8));
 
+               /*
+                * else not in power-save mode,
+                * uCode will never sleep when we're
+                * trying to tx (during RFKILL, we're not trying to tx).
+                */
+               } else
+                       iwl_write32(priv, HBUS_TARG_WRPTR,
+                                   txq->q.write_ptr | (txq_id << 8));
+       }
        txq->need_update = 0;
 }
 EXPORT_SYMBOL(iwl_txq_update_write_ptr);
@@ -350,13 +359,12 @@ int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
        txq->need_update = 0;
 
        /*
-        * Aggregation TX queues will get their ID when aggregation begins;
-        * they overwrite the setting done here. The command FIFO doesn't
-        * need an swq_id so don't set one to catch errors, all others can
-        * be set up to the identity mapping.
+        * For the default queues 0-3, set up the swq_id
+        * already -- all others need to get one later
+        * (if they need one at all).
         */
-       if (txq_id != priv->cmd_queue)
-               txq->swq_id = txq_id;
+       if (txq_id < 4)
+               iwl_set_swq_id(txq, txq_id, txq_id);
 
        /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
         * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
@@ -636,41 +644,3 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
        meta->flags = 0;
 }
 EXPORT_SYMBOL(iwl_tx_cmd_complete);
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-#define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x
-#define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x
-
-const char *iwl_get_tx_fail_reason(u32 status)
-{
-       switch (status & TX_STATUS_MSK) {
-       case TX_STATUS_SUCCESS:
-               return "SUCCESS";
-               TX_STATUS_POSTPONE(DELAY);
-               TX_STATUS_POSTPONE(FEW_BYTES);
-               TX_STATUS_POSTPONE(BT_PRIO);
-               TX_STATUS_POSTPONE(QUIET_PERIOD);
-               TX_STATUS_POSTPONE(CALC_TTAK);
-               TX_STATUS_FAIL(INTERNAL_CROSSED_RETRY);
-               TX_STATUS_FAIL(SHORT_LIMIT);
-               TX_STATUS_FAIL(LONG_LIMIT);
-               TX_STATUS_FAIL(FIFO_UNDERRUN);
-               TX_STATUS_FAIL(DRAIN_FLOW);
-               TX_STATUS_FAIL(RFKILL_FLUSH);
-               TX_STATUS_FAIL(LIFE_EXPIRE);
-               TX_STATUS_FAIL(DEST_PS);
-               TX_STATUS_FAIL(HOST_ABORTED);
-               TX_STATUS_FAIL(BT_RETRY);
-               TX_STATUS_FAIL(STA_INVALID);
-               TX_STATUS_FAIL(FRAG_DROPPED);
-               TX_STATUS_FAIL(TID_DISABLE);
-               TX_STATUS_FAIL(FIFO_FLUSHED);
-               TX_STATUS_FAIL(INSUFFICIENT_CF_POLL);
-               TX_STATUS_FAIL(PASSIVE_NO_RX);
-               TX_STATUS_FAIL(NO_BEACON_ON_RADAR);
-       }
-
-       return "UNKNOWN";
-}
-EXPORT_SYMBOL(iwl_get_tx_fail_reason);
-#endif /* CONFIG_IWLWIFI_DEBUG */