diff options
author | Sara Sharon <sara.sharon@intel.com> | 2016-04-10 08:51:54 -0400 |
---|---|---|
committer | Luca Coelho <luciano.coelho@intel.com> | 2016-05-10 15:34:04 -0400 |
commit | 13303c0fb1481e40377d072a29570e005e7bd032 (patch) | |
tree | 500e217b7348e158f05a1319d9a38bbfe069de10 /drivers/net/wireless/intel/iwlwifi/mvm | |
parent | ce1f27787d493bc28d2f523a3b4c9f72aa9cee7d (diff) |
iwlwifi: mvm: use helpers to get iwl_mvm_sta
Getting the mvm station out of station id requires dereferencing
the station id to get ieee80211_sta, then checking for pointer
validity and only then extract mvm station out.
Given that there are helpers to do it - use them instead of
duplicating the code whenever we need only mvm station.
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 7 |
6 files changed, 14 insertions, 31 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c index e3561bbc2468..4fdc3dad3e85 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c | |||
@@ -1804,7 +1804,6 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1804 | struct iwl_wowlan_status *fw_status; | 1804 | struct iwl_wowlan_status *fw_status; |
1805 | int i; | 1805 | int i; |
1806 | bool keep; | 1806 | bool keep; |
1807 | struct ieee80211_sta *ap_sta; | ||
1808 | struct iwl_mvm_sta *mvm_ap_sta; | 1807 | struct iwl_mvm_sta *mvm_ap_sta; |
1809 | 1808 | ||
1810 | fw_status = iwl_mvm_get_wakeup_status(mvm, vif); | 1809 | fw_status = iwl_mvm_get_wakeup_status(mvm, vif); |
@@ -1823,13 +1822,10 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, | |||
1823 | status.wake_packet = fw_status->wake_packet; | 1822 | status.wake_packet = fw_status->wake_packet; |
1824 | 1823 | ||
1825 | /* still at hard-coded place 0 for D3 image */ | 1824 | /* still at hard-coded place 0 for D3 image */ |
1826 | ap_sta = rcu_dereference_protected( | 1825 | mvm_ap_sta = iwl_mvm_sta_from_staid_protected(mvm, 0); |
1827 | mvm->fw_id_to_mac_id[0], | 1826 | if (!mvm_ap_sta) |
1828 | lockdep_is_held(&mvm->mutex)); | ||
1829 | if (IS_ERR_OR_NULL(ap_sta)) | ||
1830 | goto out_free; | 1827 | goto out_free; |
1831 | 1828 | ||
1832 | mvm_ap_sta = iwl_mvm_sta_from_mac80211(ap_sta); | ||
1833 | for (i = 0; i < IWL_MAX_TID_COUNT; i++) { | 1829 | for (i = 0; i < IWL_MAX_TID_COUNT; i++) { |
1834 | u16 seq = status.qos_seq_ctr[i]; | 1830 | u16 seq = status.qos_seq_ctr[i]; |
1835 | /* firmware stores last-used value, we store next value */ | 1831 | /* firmware stores last-used value, we store next value */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c index fb96bc00f022..b23271755daf 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c | |||
@@ -281,13 +281,10 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file, | |||
281 | 281 | ||
282 | if (vif->type == NL80211_IFTYPE_STATION && | 282 | if (vif->type == NL80211_IFTYPE_STATION && |
283 | ap_sta_id != IWL_MVM_STATION_COUNT) { | 283 | ap_sta_id != IWL_MVM_STATION_COUNT) { |
284 | struct ieee80211_sta *sta; | 284 | struct iwl_mvm_sta *mvm_sta; |
285 | |||
286 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[ap_sta_id], | ||
287 | lockdep_is_held(&mvm->mutex)); | ||
288 | if (!IS_ERR_OR_NULL(sta)) { | ||
289 | struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta); | ||
290 | 285 | ||
286 | mvm_sta = iwl_mvm_sta_from_staid_protected(mvm, ap_sta_id); | ||
287 | if (mvm_sta) { | ||
291 | pos += scnprintf(buf+pos, bufsz-pos, | 288 | pos += scnprintf(buf+pos, bufsz-pos, |
292 | "ap_sta_id %d - reduced Tx power %d\n", | 289 | "ap_sta_id %d - reduced Tx power %d\n", |
293 | ap_sta_id, | 290 | ap_sta_id, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 2ba13691b481..6f91c5bdfd62 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c | |||
@@ -1210,7 +1210,6 @@ static bool iwl_mvm_disallow_offloading(struct iwl_mvm *mvm, | |||
1210 | struct iwl_d0i3_iter_data *iter_data) | 1210 | struct iwl_d0i3_iter_data *iter_data) |
1211 | { | 1211 | { |
1212 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 1212 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
1213 | struct ieee80211_sta *ap_sta; | ||
1214 | struct iwl_mvm_sta *mvmsta; | 1213 | struct iwl_mvm_sta *mvmsta; |
1215 | u32 available_tids = 0; | 1214 | u32 available_tids = 0; |
1216 | u8 tid; | 1215 | u8 tid; |
@@ -1219,11 +1218,10 @@ static bool iwl_mvm_disallow_offloading(struct iwl_mvm *mvm, | |||
1219 | mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)) | 1218 | mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)) |
1220 | return false; | 1219 | return false; |
1221 | 1220 | ||
1222 | ap_sta = rcu_dereference(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id]); | 1221 | mvmsta = iwl_mvm_sta_from_staid_rcu(mvm, mvmvif->ap_sta_id); |
1223 | if (IS_ERR_OR_NULL(ap_sta)) | 1222 | if (!mvmsta) |
1224 | return false; | 1223 | return false; |
1225 | 1224 | ||
1226 | mvmsta = iwl_mvm_sta_from_mac80211(ap_sta); | ||
1227 | spin_lock_bh(&mvmsta->lock); | 1225 | spin_lock_bh(&mvmsta->lock); |
1228 | for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) { | 1226 | for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) { |
1229 | struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; | 1227 | struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index e7f1da56d82d..855684ace030 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | |||
@@ -1756,17 +1756,12 @@ static struct iwl_mvm_sta *iwl_mvm_get_key_sta(struct iwl_mvm *mvm, | |||
1756 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { | 1756 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { |
1757 | u8 sta_id = mvmvif->ap_sta_id; | 1757 | u8 sta_id = mvmvif->ap_sta_id; |
1758 | 1758 | ||
1759 | sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id], | ||
1760 | lockdep_is_held(&mvm->mutex)); | ||
1761 | /* | 1759 | /* |
1762 | * It is possible that the 'sta' parameter is NULL, | 1760 | * It is possible that the 'sta' parameter is NULL, |
1763 | * for example when a GTK is removed - the sta_id will then | 1761 | * for example when a GTK is removed - the sta_id will then |
1764 | * be the AP ID, and no station was passed by mac80211. | 1762 | * be the AP ID, and no station was passed by mac80211. |
1765 | */ | 1763 | */ |
1766 | if (IS_ERR_OR_NULL(sta)) | 1764 | return iwl_mvm_sta_from_staid_protected(mvm, sta_id); |
1767 | return NULL; | ||
1768 | |||
1769 | return iwl_mvm_sta_from_mac80211(sta); | ||
1770 | } | 1765 | } |
1771 | 1766 | ||
1772 | return NULL; | 1767 | return NULL; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c index eb3f460ce1b6..58fc7b3c711c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c | |||
@@ -359,16 +359,14 @@ static void iwl_mvm_tt_smps_iterator(void *_data, u8 *mac, | |||
359 | 359 | ||
360 | static void iwl_mvm_tt_tx_protection(struct iwl_mvm *mvm, bool enable) | 360 | static void iwl_mvm_tt_tx_protection(struct iwl_mvm *mvm, bool enable) |
361 | { | 361 | { |
362 | struct ieee80211_sta *sta; | ||
363 | struct iwl_mvm_sta *mvmsta; | 362 | struct iwl_mvm_sta *mvmsta; |
364 | int i, err; | 363 | int i, err; |
365 | 364 | ||
366 | for (i = 0; i < IWL_MVM_STATION_COUNT; i++) { | 365 | for (i = 0; i < IWL_MVM_STATION_COUNT; i++) { |
367 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], | 366 | mvmsta = iwl_mvm_sta_from_staid_protected(mvm, i); |
368 | lockdep_is_held(&mvm->mutex)); | 367 | if (!mvmsta) |
369 | if (IS_ERR_OR_NULL(sta)) | ||
370 | continue; | 368 | continue; |
371 | mvmsta = iwl_mvm_sta_from_mac80211(sta); | 369 | |
372 | if (enable == mvmsta->tt_tx_protection) | 370 | if (enable == mvmsta->tt_tx_protection) |
373 | continue; | 371 | continue; |
374 | err = iwl_mvm_tx_protection(mvm, mvmsta, enable); | 372 | err = iwl_mvm_tx_protection(mvm, mvmsta, enable); |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index 3b645683d233..ff615b92e4ef 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c | |||
@@ -1464,7 +1464,7 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm, | |||
1464 | int sta_id = IWL_MVM_TX_RES_GET_RA(tx_resp->ra_tid); | 1464 | int sta_id = IWL_MVM_TX_RES_GET_RA(tx_resp->ra_tid); |
1465 | int tid = IWL_MVM_TX_RES_GET_TID(tx_resp->ra_tid); | 1465 | int tid = IWL_MVM_TX_RES_GET_TID(tx_resp->ra_tid); |
1466 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); | 1466 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); |
1467 | struct ieee80211_sta *sta; | 1467 | struct iwl_mvm_sta *mvmsta; |
1468 | 1468 | ||
1469 | if (WARN_ON_ONCE(SEQ_TO_QUEUE(sequence) < mvm->first_agg_queue)) | 1469 | if (WARN_ON_ONCE(SEQ_TO_QUEUE(sequence) < mvm->first_agg_queue)) |
1470 | return; | 1470 | return; |
@@ -1476,10 +1476,9 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm, | |||
1476 | 1476 | ||
1477 | rcu_read_lock(); | 1477 | rcu_read_lock(); |
1478 | 1478 | ||
1479 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | 1479 | mvmsta = iwl_mvm_sta_from_staid_rcu(mvm, sta_id); |
1480 | 1480 | ||
1481 | if (!WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) { | 1481 | if (!WARN_ON_ONCE(!mvmsta)) { |
1482 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | ||
1483 | mvmsta->tid_data[tid].rate_n_flags = | 1482 | mvmsta->tid_data[tid].rate_n_flags = |
1484 | le32_to_cpu(tx_resp->initial_rate); | 1483 | le32_to_cpu(tx_resp->initial_rate); |
1485 | mvmsta->tid_data[tid].tx_time = | 1484 | mvmsta->tid_data[tid].tx_time = |