iwlwifi: mvm: clean up invalid station handling
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 19 Mar 2013 14:16:00 +0000 (16:16 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 3 Apr 2013 20:49:54 +0000 (22:49 +0200)
Using IWL_MVM_STATION_COUNT and IWL_INVALID_STATION together
isn't a good idea as they have different values. Always use
IWL_MVM_STATION_COUNT for an invalid station in MVM and move
the definition of the IWL_INVALID_STATION constant into the
DVM driver to avoid making such mistakes again. The one use
in the transport code can be hard-coded to -1 instead as the
station ID is passed as an integer there.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/dvm/agn.h
drivers/net/wireless/iwlwifi/iwl-trans.h
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/sta.c
drivers/net/wireless/iwlwifi/mvm/tx.c
drivers/net/wireless/iwlwifi/mvm/utils.c
drivers/net/wireless/iwlwifi/pcie/tx.c

index 019d433900ef516ef9759b35a09cd5834b9cd485..76b762e4870302bebc22562042fd2cc09776e1b3 100644 (file)
@@ -73,6 +73,8 @@
 /* AUX (TX during scan dwell) queue */
 #define IWL_AUX_QUEUE          10
 
+#define IWL_INVALID_STATION    255
+
 /* device operations */
 extern struct iwl_lib_ops iwl1000_lib;
 extern struct iwl_lib_ops iwl2000_lib;
index 7f9c254292a809e1e58c929467a01189b77638e5..7a13790b5bfe5e20feb8db54edd2fc4ef738187d 100644 (file)
@@ -305,7 +305,6 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r)
  * currently supports
  */
 #define IWL_MAX_HW_QUEUES              32
-#define IWL_INVALID_STATION    255
 #define IWL_MAX_TID_COUNT      8
 #define IWL_FRAME_LIMIT        64
 
@@ -682,7 +681,7 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
 static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue,
                                           int fifo)
 {
-       iwl_trans_txq_enable(trans, queue, fifo, IWL_INVALID_STATION,
+       iwl_trans_txq_enable(trans, queue, fifo, -1,
                             IWL_MAX_TID_COUNT, IWL_FRAME_LIMIT, 0);
 }
 
index c0043fca836d7e666db40112db2c5c4f7a8db355..fe031608fd912ce67201358a187031a09c8cb549 100644 (file)
@@ -940,7 +940,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
                 */
                break;
        case STA_NOTIFY_AWAKE:
-               if (WARN_ON(mvmsta->sta_id == IWL_INVALID_STATION))
+               if (WARN_ON(mvmsta->sta_id == IWL_MVM_STATION_COUNT))
                        break;
                iwl_mvm_sta_modify_ps_wake(mvm, sta);
                break;
index 4d872d69577fe17b02a0670a7e0f36791ffd2bcc..0fd96e4da4613457746e11909945e6716c21c47e 100644 (file)
@@ -945,7 +945,7 @@ static u8 iwl_mvm_get_key_sta_id(struct ieee80211_vif *vif,
            mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT)
                return mvmvif->ap_sta_id;
 
-       return IWL_INVALID_STATION;
+       return IWL_MVM_STATION_COUNT;
 }
 
 static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm,
@@ -1093,7 +1093,7 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
 
        /* Get the station id from the mvm local station table */
        sta_id = iwl_mvm_get_key_sta_id(vif, sta);
-       if (sta_id == IWL_INVALID_STATION) {
+       if (sta_id == IWL_MVM_STATION_COUNT) {
                IWL_ERR(mvm, "Failed to find station id\n");
                return -EINVAL;
        }
@@ -1188,7 +1188,7 @@ int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm,
                return -ENOENT;
        }
 
-       if (sta_id == IWL_INVALID_STATION) {
+       if (sta_id == IWL_MVM_STATION_COUNT) {
                IWL_DEBUG_WEP(mvm, "station non-existent, early return.\n");
                return 0;
        }
@@ -1254,7 +1254,7 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm,
        struct iwl_mvm_sta *mvm_sta;
        u8 sta_id = iwl_mvm_get_key_sta_id(vif, sta);
 
-       if (WARN_ON_ONCE(sta_id == IWL_INVALID_STATION))
+       if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT))
                return;
 
        rcu_read_lock();
index c7456af8434d3fc69e40bf3cb8eb69ffc1e13aaf..3fed01ed1fb896fb45d24e229f6adbec29a8a1ec 100644 (file)
@@ -365,7 +365,7 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
        if (WARN_ON_ONCE(!mvmsta))
                return -1;
 
-       if (WARN_ON_ONCE(mvmsta->sta_id == IWL_INVALID_STATION))
+       if (WARN_ON_ONCE(mvmsta->sta_id == IWL_MVM_STATION_COUNT))
                return -1;
 
        dev_cmd = iwl_mvm_set_tx_params(mvm, skb, sta, mvmsta->sta_id);
index e308ad93aa9e1556cf18c4ce5eef3ef7ed5aa7bb..0cc8d8c0d39372f22752130dea146fc8b8e5ffd8 100644 (file)
@@ -462,7 +462,7 @@ int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq,
                .data = { lq, },
        };
 
-       if (WARN_ON(lq->sta_id == IWL_INVALID_STATION))
+       if (WARN_ON(lq->sta_id == IWL_MVM_STATION_COUNT))
                return -EINVAL;
 
        if (WARN_ON(init && (cmd.flags & CMD_ASYNC)))
index a4508c2fa92b89fa4376f8c53d1bed4078fe8fe2..a0bbb0df4ae4eb735a0b77981d6cd4adcd748b1e 100644 (file)
@@ -1063,7 +1063,7 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
                iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id));
 
        /* If this queue is mapped to a certain station: it is an AGG queue */
-       if (sta_id != IWL_INVALID_STATION) {
+       if (sta_id >= 0) {
                u16 ra_tid = BUILD_RAxTID(sta_id, tid);
 
                /* Map receiver-address / traffic-ID to this queue */