summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/mvm.h
diff options
context:
space:
mode:
authorEmmanuel Grumbach2014-01-14 07:30:32 +0100
committerEmmanuel Grumbach2014-02-03 21:23:33 +0100
commitf327b04c4240cc6dbce698bea8f8e14db7fc3a8a (patch)
tree40bf61d0c1d6221c92ff732243dfd5fd1690e140 /drivers/net/wireless/iwlwifi/mvm/mvm.h
parentiwlwifi: remove obsolete TODO (diff)
downloadkernel-qcow2-linux-f327b04c4240cc6dbce698bea8f8e14db7fc3a8a.tar.gz
kernel-qcow2-linux-f327b04c4240cc6dbce698bea8f8e14db7fc3a8a.tar.xz
kernel-qcow2-linux-f327b04c4240cc6dbce698bea8f8e14db7fc3a8a.zip
iwlwifi: mvm: provide helper to fetch the iwl_mvm_sta from sta_id
We somtimes need to fetch the iwl_mvm_sta structure from a station index - provide a helper to do that. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/mvm.h')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index bf13c462a1f4..02e4bdc80de2 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -595,6 +595,24 @@ static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
}
+static inline struct iwl_mvm_sta *
+iwl_mvm_sta_from_staid_protected(struct iwl_mvm *mvm, u8 sta_id)
+{
+ struct ieee80211_sta *sta;
+
+ if (sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
+ return NULL;
+
+ sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],
+ lockdep_is_held(&mvm->mutex));
+
+ /* This can happen if the station has been removed right now */
+ if (IS_ERR_OR_NULL(sta))
+ return NULL;
+
+ return iwl_mvm_sta_from_mac80211(sta);
+}
+
extern const u8 iwl_mvm_ac_to_tx_fifo[];
struct iwl_rate_info {