aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-14 12:20:04 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2013-12-09 15:29:44 -0500
commit5b577a90fb3d86447ee86f8e0c6ddbd5da2ef8c9 (patch)
treee17091422320172704d9fd7c9f8b37bc5095f306
parenta7b8b2ca916ca4ecf248fa12275eeceff510ad22 (diff)
iwlwifi: mvm: add iwl_mvm_sta_from_mac80211
This is just a helper function to go from the mac80211 station struct to our internal one, to later allow us to avoid temporary 'mvmsta' variables. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/bt-coex.c8
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c12
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.h6
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tt.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c10
6 files changed, 23 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
index 75c3e0b6e077..468a4ba49a06 100644
--- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
@@ -514,7 +514,7 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
514 if (IS_ERR_OR_NULL(sta)) 514 if (IS_ERR_OR_NULL(sta))
515 return 0; 515 return 0;
516 516
517 mvmsta = (void *)sta->drv_priv; 517 mvmsta = iwl_mvm_sta_from_mac80211(sta);
518 518
519 /* nothing to do */ 519 /* nothing to do */
520 if (mvmsta->bt_reduced_txpower == enable) 520 if (mvmsta->bt_reduced_txpower == enable)
@@ -846,7 +846,7 @@ static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac,
846 if (IS_ERR_OR_NULL(sta)) 846 if (IS_ERR_OR_NULL(sta))
847 return; 847 return;
848 848
849 mvmsta = (void *)sta->drv_priv; 849 mvmsta = iwl_mvm_sta_from_mac80211(sta);
850 850
851 data->num_bss_ifaces++; 851 data->num_bss_ifaces++;
852 852
@@ -917,7 +917,7 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
917u16 iwl_mvm_bt_coex_agg_time_limit(struct iwl_mvm *mvm, 917u16 iwl_mvm_bt_coex_agg_time_limit(struct iwl_mvm *mvm,
918 struct ieee80211_sta *sta) 918 struct ieee80211_sta *sta)
919{ 919{
920 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 920 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
921 enum iwl_bt_coex_lut_type lut_type; 921 enum iwl_bt_coex_lut_type lut_type;
922 922
923 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < 923 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
@@ -936,7 +936,7 @@ u16 iwl_mvm_bt_coex_agg_time_limit(struct iwl_mvm *mvm,
936bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, 936bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
937 struct ieee80211_sta *sta) 937 struct ieee80211_sta *sta)
938{ 938{
939 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 939 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
940 940
941 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < 941 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
942 BT_HIGH_TRAFFIC) 942 BT_HIGH_TRAFFIC)
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index f8bf15c2b2dd..6b3273d82157 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -1091,7 +1091,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
1091 struct ieee80211_sta *sta) 1091 struct ieee80211_sta *sta)
1092{ 1092{
1093 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 1093 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1094 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 1094 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
1095 1095
1096 switch (cmd) { 1096 switch (cmd) {
1097 case STA_NOTIFY_SLEEP: 1097 case STA_NOTIFY_SLEEP:
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index c89232c8aa79..7a5b7473eafa 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -840,7 +840,7 @@ static const u8 tid_to_ac[] = {
840int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 840int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
841 struct ieee80211_sta *sta, u16 tid, u16 *ssn) 841 struct ieee80211_sta *sta, u16 tid, u16 *ssn)
842{ 842{
843 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 843 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
844 struct iwl_mvm_tid_data *tid_data; 844 struct iwl_mvm_tid_data *tid_data;
845 int txq_id; 845 int txq_id;
846 846
@@ -895,7 +895,7 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
895int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 895int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
896 struct ieee80211_sta *sta, u16 tid, u8 buf_size) 896 struct ieee80211_sta *sta, u16 tid, u8 buf_size)
897{ 897{
898 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 898 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
899 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; 899 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid];
900 int queue, fifo, ret; 900 int queue, fifo, ret;
901 u16 ssn; 901 u16 ssn;
@@ -951,7 +951,7 @@ int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
951int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 951int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
952 struct ieee80211_sta *sta, u16 tid) 952 struct ieee80211_sta *sta, u16 tid)
953{ 953{
954 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 954 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
955 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; 955 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid];
956 u16 txq_id; 956 u16 txq_id;
957 int err; 957 int err;
@@ -1023,7 +1023,7 @@ int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1023int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1023int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1024 struct ieee80211_sta *sta, u16 tid) 1024 struct ieee80211_sta *sta, u16 tid)
1025{ 1025{
1026 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 1026 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
1027 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; 1027 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid];
1028 u16 txq_id; 1028 u16 txq_id;
1029 enum iwl_mvm_agg_state old_state; 1029 enum iwl_mvm_agg_state old_state;
@@ -1416,7 +1416,7 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm,
1416void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, 1416void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm,
1417 struct ieee80211_sta *sta) 1417 struct ieee80211_sta *sta)
1418{ 1418{
1419 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 1419 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
1420 struct iwl_mvm_add_sta_cmd_v6 cmd = { 1420 struct iwl_mvm_add_sta_cmd_v6 cmd = {
1421 .add_modify = STA_MODE_MODIFY, 1421 .add_modify = STA_MODE_MODIFY,
1422 .sta_id = mvmsta->sta_id, 1422 .sta_id = mvmsta->sta_id,
@@ -1438,7 +1438,7 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm,
1438 u16 sleep_state_flags = 1438 u16 sleep_state_flags =
1439 (reason == IEEE80211_FRAME_RELEASE_UAPSD) ? 1439 (reason == IEEE80211_FRAME_RELEASE_UAPSD) ?
1440 STA_SLEEP_STATE_UAPSD : STA_SLEEP_STATE_PS_POLL; 1440 STA_SLEEP_STATE_UAPSD : STA_SLEEP_STATE_PS_POLL;
1441 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 1441 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
1442 struct iwl_mvm_add_sta_cmd_v6 cmd = { 1442 struct iwl_mvm_add_sta_cmd_v6 cmd = {
1443 .add_modify = STA_MODE_MODIFY, 1443 .add_modify = STA_MODE_MODIFY,
1444 .sta_id = mvmsta->sta_id, 1444 .sta_id = mvmsta->sta_id,
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h b/drivers/net/wireless/iwlwifi/mvm/sta.h
index 4dfc359a4bdd..b34941148a98 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.h
@@ -298,6 +298,12 @@ struct iwl_mvm_sta {
298 bool tt_tx_protection; 298 bool tt_tx_protection;
299}; 299};
300 300
301static inline struct iwl_mvm_sta *
302iwl_mvm_sta_from_mac80211(struct ieee80211_sta *sta)
303{
304 return (void *)sta->drv_priv;
305}
306
301/** 307/**
302 * struct iwl_mvm_int_sta - representation of an internal station (auxiliary or 308 * struct iwl_mvm_int_sta - representation of an internal station (auxiliary or
303 * broadcast) 309 * broadcast)
diff --git a/drivers/net/wireless/iwlwifi/mvm/tt.c b/drivers/net/wireless/iwlwifi/mvm/tt.c
index 1f3282dff513..18be04da8e3f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tt.c
@@ -388,7 +388,7 @@ static void iwl_mvm_tt_tx_protection(struct iwl_mvm *mvm, bool enable)
388 lockdep_is_held(&mvm->mutex)); 388 lockdep_is_held(&mvm->mutex));
389 if (IS_ERR_OR_NULL(sta)) 389 if (IS_ERR_OR_NULL(sta))
390 continue; 390 continue;
391 mvmsta = (void *)sta->drv_priv; 391 mvmsta = iwl_mvm_sta_from_mac80211(sta);
392 if (enable == mvmsta->tt_tx_protection) 392 if (enable == mvmsta->tt_tx_protection)
393 continue; 393 continue;
394 err = iwl_mvm_tx_protection(mvm, mvmsta, enable); 394 err = iwl_mvm_tx_protection(mvm, mvmsta, enable);
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 1f1945806421..d87649ac88e1 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -362,7 +362,7 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
362 u8 txq_id = info->hw_queue; 362 u8 txq_id = info->hw_queue;
363 bool is_data_qos = false, is_ampdu = false; 363 bool is_data_qos = false, is_ampdu = false;
364 364
365 mvmsta = (void *)sta->drv_priv; 365 mvmsta = iwl_mvm_sta_from_mac80211(sta);
366 fc = hdr->frame_control; 366 fc = hdr->frame_control;
367 367
368 if (WARN_ON_ONCE(!mvmsta)) 368 if (WARN_ON_ONCE(!mvmsta))
@@ -433,7 +433,7 @@ drop:
433static void iwl_mvm_check_ratid_empty(struct iwl_mvm *mvm, 433static void iwl_mvm_check_ratid_empty(struct iwl_mvm *mvm,
434 struct ieee80211_sta *sta, u8 tid) 434 struct ieee80211_sta *sta, u8 tid)
435{ 435{
436 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 436 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
437 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; 437 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid];
438 struct ieee80211_vif *vif = mvmsta->vif; 438 struct ieee80211_vif *vif = mvmsta->vif;
439 439
@@ -663,7 +663,7 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
663 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); 663 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
664 664
665 if (!IS_ERR_OR_NULL(sta)) { 665 if (!IS_ERR_OR_NULL(sta)) {
666 mvmsta = (void *)sta->drv_priv; 666 mvmsta = iwl_mvm_sta_from_mac80211(sta);
667 667
668 if (tid != IWL_TID_NON_QOS) { 668 if (tid != IWL_TID_NON_QOS) {
669 struct iwl_mvm_tid_data *tid_data = 669 struct iwl_mvm_tid_data *tid_data =
@@ -794,7 +794,7 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm,
794 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); 794 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
795 795
796 if (!WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) { 796 if (!WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) {
797 struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; 797 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
798 mvmsta->tid_data[tid].rate_n_flags = 798 mvmsta->tid_data[tid].rate_n_flags =
799 le32_to_cpu(tx_resp->initial_rate); 799 le32_to_cpu(tx_resp->initial_rate);
800 } 800 }
@@ -850,7 +850,7 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
850 return 0; 850 return 0;
851 } 851 }
852 852
853 mvmsta = (void *)sta->drv_priv; 853 mvmsta = iwl_mvm_sta_from_mac80211(sta);
854 tid_data = &mvmsta->tid_data[tid]; 854 tid_data = &mvmsta->tid_data[tid];
855 855
856 if (WARN_ONCE(tid_data->txq_id != scd_flow, "Q %d, tid %d, flow %d", 856 if (WARN_ONCE(tid_data->txq_id != scd_flow, "Q %d, tid %d, flow %d",