diff options
author | Luciano Coelho <luciano.coelho@intel.com> | 2014-10-02 15:38:04 +0300 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-10-29 12:49:13 +0200 |
commit | 7f549e2c45ba216f629aad7c463c00a3fc1ec2ea (patch) | |
tree | 510f7d2ed6c637517af66073f732d923e857a09c /drivers/net/wireless/iwlwifi/mvm/utils.c | |
parent | 3c2f3b20e4a834f1d8ae34002b22f9021a861715 (diff) | |
download | op-kernel-dev-7f549e2c45ba216f629aad7c463c00a3fc1ec2ea.zip op-kernel-dev-7f549e2c45ba216f629aad7c463c00a3fc1ec2ea.tar.gz |
iwlwifi: mvm: change the iwl_mvm_d3_iface_iterator into a generic function
Getting the BSS station vif is something that may be needed by other
parts of the code. So, instead of having an iterator specifically for
d3, change it into a generic one in utils.c. Additionally, add a
iwl_mvm_get_bss_vif() function to make it easier to retrieving it.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/utils.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/utils.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c index 8021f6e..e56e77e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/iwlwifi/mvm/utils.c @@ -734,3 +734,40 @@ bool iwl_mvm_is_idle(struct iwl_mvm *mvm) return idle; } + +struct iwl_bss_iter_data { + struct ieee80211_vif *vif; + bool error; +}; + +static void iwl_mvm_bss_iface_iterator(void *_data, u8 *mac, + struct ieee80211_vif *vif) +{ + struct iwl_bss_iter_data *data = _data; + + if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) + return; + + if (data->vif) { + data->error = true; + return; + } + + data->vif = vif; +} + +struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm) +{ + struct iwl_bss_iter_data bss_iter_data = {}; + + ieee80211_iterate_active_interfaces_atomic( + mvm->hw, IEEE80211_IFACE_ITER_NORMAL, + iwl_mvm_bss_iface_iterator, &bss_iter_data); + + if (bss_iter_data.error) { + IWL_ERR(mvm, "More than one managed interface active!\n"); + return ERR_PTR(-EINVAL); + } + + return bss_iter_data.vif; +} |