iwlwifi: clean up unused NL80211_IFTYPE_MONITOR for Monitor mode
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-tx.c
index dff60fb..58cdd32 100644 (file)
@@ -174,7 +174,7 @@ EXPORT_SYMBOL(iwl_tx_queue_free);
  * Free all buffers.
  * 0-fill, but do not free "txq" descriptor structure.
  */
-static void iwl_cmd_queue_free(struct iwl_priv *priv)
+void iwl_cmd_queue_free(struct iwl_priv *priv)
 {
        struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
        struct iwl_queue *q = &txq->q;
@@ -193,12 +193,14 @@ static void iwl_cmd_queue_free(struct iwl_priv *priv)
 
        /* De-alloc circular buffer of TFDs */
        if (txq->q.n_bd)
-               pci_free_consistent(dev, sizeof(struct iwl_tfd) *
+               pci_free_consistent(dev, priv->hw_params.tfd_size *
                                    txq->q.n_bd, txq->tfds, txq->q.dma_addr);
 
        /* 0-fill queue descriptor structure */
        memset(txq, 0, sizeof(*txq));
 }
+EXPORT_SYMBOL(iwl_cmd_queue_free);
+
 /*************** DMA-QUEUE-GENERAL-FUNCTIONS  *****
  * DMA services
  *
@@ -726,7 +728,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 
        /* drop all data frame if we are not associated */
        if (ieee80211_is_data(fc) &&
-           (priv->iw_mode != NL80211_IFTYPE_MONITOR ||
+           (!iwl_is_monitor_mode(priv) ||
            !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */
            (!iwl_is_associated(priv) ||
             ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id) ||
@@ -761,8 +763,10 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
                hdr->seq_ctrl |= cpu_to_le16(seq_number);
                seq_number += 0x10;
                /* aggregation is on for this <sta,tid> */
-               if (info->flags & IEEE80211_TX_CTL_AMPDU)
+               if (info->flags & IEEE80211_TX_CTL_AMPDU) {
                        txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
+                       swq_id = iwl_virtual_agg_queue_num(swq_id, txq_id);
+               }
                priv->stations[sta_id].tid[tid].tfds_in_queue++;
        }
 
@@ -893,7 +897,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
                        iwl_txq_update_write_ptr(priv, txq);
                        spin_unlock_irqrestore(&priv->lock, flags);
                } else {
-                       ieee80211_stop_queue(priv->hw, txq->swq_id);
+                       iwl_stop_queue(priv, txq->swq_id);
                }
        }
 
@@ -1166,8 +1170,10 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
                        __func__, ra, tid);
 
        sta_id = iwl_find_station(priv, ra);
-       if (sta_id == IWL_INVALID_STATION)
+       if (sta_id == IWL_INVALID_STATION) {
+               IWL_ERR(priv, "Start AGG on invalid station\n");
                return -ENXIO;
+       }
 
        if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) {
                IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n");
@@ -1175,8 +1181,10 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
        }
 
        txq_id = iwl_txq_ctx_activate_free(priv);
-       if (txq_id == -1)
+       if (txq_id == -1) {
+               IWL_ERR(priv, "No free aggregation queue available\n");
                return -ENXIO;
+       }
 
        spin_lock_irqsave(&priv->sta_lock, flags);
        tid_data = &priv->stations[sta_id].tid[tid];
@@ -1190,7 +1198,7 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
                return ret;
 
        if (tid_data->tfds_in_queue == 0) {
-               IWL_ERR(priv, "HW queue is empty\n");
+               IWL_DEBUG_HT(priv, "HW queue is empty\n");
                tid_data->agg.state = IWL_AGG_ON;
                ieee80211_start_tx_ba_cb_irqsafe(priv->hw, ra, tid);
        } else {
@@ -1221,8 +1229,10 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
 
        sta_id = iwl_find_station(priv, ra);
 
-       if (sta_id == IWL_INVALID_STATION)
+       if (sta_id == IWL_INVALID_STATION) {
+               IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
                return -ENXIO;
+       }
 
        if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON)
                IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n");
@@ -1429,7 +1439,7 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
                if ((iwl_queue_space(&txq->q) > txq->q.low_mark) &&
                    priv->mac80211_registered &&
                    (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA))
-                       ieee80211_wake_queue(priv->hw, txq->swq_id);
+                       iwl_wake_queue(priv, txq->swq_id);
 
                iwl_txq_check_empty(priv, sta_id, tid, scd_flow);
        }