diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2013-03-19 10:16:00 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-04-03 16:49:54 -0400 |
commit | 881acd8987f6633280247087219df465de784a69 (patch) | |
tree | ce3db162cafa616b531b2fed188096287618eec9 /drivers/net/wireless/iwlwifi | |
parent | 20ecf9fd3bebc4147e2996c08a75d6f0229b90df (diff) |
iwlwifi: mvm: clean up invalid station handling
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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/dvm/agn.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/sta.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/tx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/utils.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/tx.c | 2 |
7 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h index 019d433900ef..76b762e48703 100644 --- a/drivers/net/wireless/iwlwifi/dvm/agn.h +++ b/drivers/net/wireless/iwlwifi/dvm/agn.h | |||
@@ -73,6 +73,8 @@ | |||
73 | /* AUX (TX during scan dwell) queue */ | 73 | /* AUX (TX during scan dwell) queue */ |
74 | #define IWL_AUX_QUEUE 10 | 74 | #define IWL_AUX_QUEUE 10 |
75 | 75 | ||
76 | #define IWL_INVALID_STATION 255 | ||
77 | |||
76 | /* device operations */ | 78 | /* device operations */ |
77 | extern struct iwl_lib_ops iwl1000_lib; | 79 | extern struct iwl_lib_ops iwl1000_lib; |
78 | extern struct iwl_lib_ops iwl2000_lib; | 80 | extern struct iwl_lib_ops iwl2000_lib; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 7f9c254292a8..7a13790b5bfe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -305,7 +305,6 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r) | |||
305 | * currently supports | 305 | * currently supports |
306 | */ | 306 | */ |
307 | #define IWL_MAX_HW_QUEUES 32 | 307 | #define IWL_MAX_HW_QUEUES 32 |
308 | #define IWL_INVALID_STATION 255 | ||
309 | #define IWL_MAX_TID_COUNT 8 | 308 | #define IWL_MAX_TID_COUNT 8 |
310 | #define IWL_FRAME_LIMIT 64 | 309 | #define IWL_FRAME_LIMIT 64 |
311 | 310 | ||
@@ -682,7 +681,7 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue, | |||
682 | static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, | 681 | static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, |
683 | int fifo) | 682 | int fifo) |
684 | { | 683 | { |
685 | iwl_trans_txq_enable(trans, queue, fifo, IWL_INVALID_STATION, | 684 | iwl_trans_txq_enable(trans, queue, fifo, -1, |
686 | IWL_MAX_TID_COUNT, IWL_FRAME_LIMIT, 0); | 685 | IWL_MAX_TID_COUNT, IWL_FRAME_LIMIT, 0); |
687 | } | 686 | } |
688 | 687 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index c0043fca836d..fe031608fd91 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -940,7 +940,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, | |||
940 | */ | 940 | */ |
941 | break; | 941 | break; |
942 | case STA_NOTIFY_AWAKE: | 942 | case STA_NOTIFY_AWAKE: |
943 | if (WARN_ON(mvmsta->sta_id == IWL_INVALID_STATION)) | 943 | if (WARN_ON(mvmsta->sta_id == IWL_MVM_STATION_COUNT)) |
944 | break; | 944 | break; |
945 | iwl_mvm_sta_modify_ps_wake(mvm, sta); | 945 | iwl_mvm_sta_modify_ps_wake(mvm, sta); |
946 | break; | 946 | break; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 4d872d69577f..0fd96e4da461 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -945,7 +945,7 @@ static u8 iwl_mvm_get_key_sta_id(struct ieee80211_vif *vif, | |||
945 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) | 945 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) |
946 | return mvmvif->ap_sta_id; | 946 | return mvmvif->ap_sta_id; |
947 | 947 | ||
948 | return IWL_INVALID_STATION; | 948 | return IWL_MVM_STATION_COUNT; |
949 | } | 949 | } |
950 | 950 | ||
951 | static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, | 951 | 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, | |||
1093 | 1093 | ||
1094 | /* Get the station id from the mvm local station table */ | 1094 | /* Get the station id from the mvm local station table */ |
1095 | sta_id = iwl_mvm_get_key_sta_id(vif, sta); | 1095 | sta_id = iwl_mvm_get_key_sta_id(vif, sta); |
1096 | if (sta_id == IWL_INVALID_STATION) { | 1096 | if (sta_id == IWL_MVM_STATION_COUNT) { |
1097 | IWL_ERR(mvm, "Failed to find station id\n"); | 1097 | IWL_ERR(mvm, "Failed to find station id\n"); |
1098 | return -EINVAL; | 1098 | return -EINVAL; |
1099 | } | 1099 | } |
@@ -1188,7 +1188,7 @@ int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, | |||
1188 | return -ENOENT; | 1188 | return -ENOENT; |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | if (sta_id == IWL_INVALID_STATION) { | 1191 | if (sta_id == IWL_MVM_STATION_COUNT) { |
1192 | IWL_DEBUG_WEP(mvm, "station non-existent, early return.\n"); | 1192 | IWL_DEBUG_WEP(mvm, "station non-existent, early return.\n"); |
1193 | return 0; | 1193 | return 0; |
1194 | } | 1194 | } |
@@ -1254,7 +1254,7 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, | |||
1254 | struct iwl_mvm_sta *mvm_sta; | 1254 | struct iwl_mvm_sta *mvm_sta; |
1255 | u8 sta_id = iwl_mvm_get_key_sta_id(vif, sta); | 1255 | u8 sta_id = iwl_mvm_get_key_sta_id(vif, sta); |
1256 | 1256 | ||
1257 | if (WARN_ON_ONCE(sta_id == IWL_INVALID_STATION)) | 1257 | if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT)) |
1258 | return; | 1258 | return; |
1259 | 1259 | ||
1260 | rcu_read_lock(); | 1260 | rcu_read_lock(); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index c7456af8434d..3fed01ed1fb8 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -365,7 +365,7 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
365 | if (WARN_ON_ONCE(!mvmsta)) | 365 | if (WARN_ON_ONCE(!mvmsta)) |
366 | return -1; | 366 | return -1; |
367 | 367 | ||
368 | if (WARN_ON_ONCE(mvmsta->sta_id == IWL_INVALID_STATION)) | 368 | if (WARN_ON_ONCE(mvmsta->sta_id == IWL_MVM_STATION_COUNT)) |
369 | return -1; | 369 | return -1; |
370 | 370 | ||
371 | dev_cmd = iwl_mvm_set_tx_params(mvm, skb, sta, mvmsta->sta_id); | 371 | dev_cmd = iwl_mvm_set_tx_params(mvm, skb, sta, mvmsta->sta_id); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c index e308ad93aa9e..0cc8d8c0d393 100644 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/iwlwifi/mvm/utils.c | |||
@@ -462,7 +462,7 @@ int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, | |||
462 | .data = { lq, }, | 462 | .data = { lq, }, |
463 | }; | 463 | }; |
464 | 464 | ||
465 | if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) | 465 | if (WARN_ON(lq->sta_id == IWL_MVM_STATION_COUNT)) |
466 | return -EINVAL; | 466 | return -EINVAL; |
467 | 467 | ||
468 | if (WARN_ON(init && (cmd.flags & CMD_ASYNC))) | 468 | if (WARN_ON(init && (cmd.flags & CMD_ASYNC))) |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index a4508c2fa92b..a0bbb0df4ae4 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -1063,7 +1063,7 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, | |||
1063 | iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id)); | 1063 | iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id)); |
1064 | 1064 | ||
1065 | /* If this queue is mapped to a certain station: it is an AGG queue */ | 1065 | /* If this queue is mapped to a certain station: it is an AGG queue */ |
1066 | if (sta_id != IWL_INVALID_STATION) { | 1066 | if (sta_id >= 0) { |
1067 | u16 ra_tid = BUILD_RAxTID(sta_id, tid); | 1067 | u16 ra_tid = BUILD_RAxTID(sta_id, tid); |
1068 | 1068 | ||
1069 | /* Map receiver-address / traffic-ID to this queue */ | 1069 | /* Map receiver-address / traffic-ID to this queue */ |