7
7
* Copyright 2006-2007 Jiri Benc <[email protected] >
8
8
* Copyright 2007, Michael Wu <[email protected] >
9
9
* Copyright 2007-2010, Intel Corporation
10
- * Copyright(c) 2015 Intel Deutschland GmbH
10
+ * Copyright(c) 2015-2017 Intel Deutschland GmbH
11
11
*
12
12
* This program is free software; you can redistribute it and/or modify
13
13
* it under the terms of the GNU General Public License version 2 as
@@ -741,66 +741,64 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
741
741
ieee80211_agg_start_txq (sta , tid , true);
742
742
}
743
743
744
- void ieee80211_start_tx_ba_cb (struct ieee80211_vif * vif , u8 * ra , u16 tid )
744
+ void ieee80211_start_tx_ba_cb (struct sta_info * sta , int tid ,
745
+ struct tid_ampdu_tx * tid_tx )
745
746
{
746
- struct ieee80211_sub_if_data * sdata = vif_to_sdata ( vif ) ;
747
+ struct ieee80211_sub_if_data * sdata = sta -> sdata ;
747
748
struct ieee80211_local * local = sdata -> local ;
748
- struct sta_info * sta ;
749
- struct tid_ampdu_tx * tid_tx ;
750
749
751
- trace_api_start_tx_ba_cb (sdata , ra , tid );
750
+ if (WARN_ON (test_and_set_bit (HT_AGG_STATE_DRV_READY , & tid_tx -> state )))
751
+ return ;
752
+
753
+ if (test_bit (HT_AGG_STATE_RESPONSE_RECEIVED , & tid_tx -> state ))
754
+ ieee80211_agg_tx_operational (local , sta , tid );
755
+ }
756
+
757
+ static struct tid_ampdu_tx *
758
+ ieee80211_lookup_tid_tx (struct ieee80211_sub_if_data * sdata ,
759
+ const u8 * ra , u16 tid , struct sta_info * * sta )
760
+ {
761
+ struct tid_ampdu_tx * tid_tx ;
752
762
753
763
if (tid >= IEEE80211_NUM_TIDS ) {
754
764
ht_dbg (sdata , "Bad TID value: tid = %d (>= %d)\n" ,
755
765
tid , IEEE80211_NUM_TIDS );
756
- return ;
766
+ return NULL ;
757
767
}
758
768
759
- mutex_lock (& local -> sta_mtx );
760
- sta = sta_info_get_bss (sdata , ra );
761
- if (!sta ) {
762
- mutex_unlock (& local -> sta_mtx );
769
+ * sta = sta_info_get_bss (sdata , ra );
770
+ if (!* sta ) {
763
771
ht_dbg (sdata , "Could not find station: %pM\n" , ra );
764
- return ;
772
+ return NULL ;
765
773
}
766
774
767
- mutex_lock (& sta -> ampdu_mlme .mtx );
768
- tid_tx = rcu_dereference_protected_tid_tx (sta , tid );
775
+ tid_tx = rcu_dereference ((* sta )-> ampdu_mlme .tid_tx [tid ]);
769
776
770
- if (WARN_ON (!tid_tx )) {
777
+ if (WARN_ON (!tid_tx ))
771
778
ht_dbg (sdata , "addBA was not requested!\n" );
772
- goto unlock ;
773
- }
774
779
775
- if (WARN_ON (test_and_set_bit (HT_AGG_STATE_DRV_READY , & tid_tx -> state )))
776
- goto unlock ;
777
-
778
- if (test_bit (HT_AGG_STATE_RESPONSE_RECEIVED , & tid_tx -> state ))
779
- ieee80211_agg_tx_operational (local , sta , tid );
780
-
781
- unlock :
782
- mutex_unlock (& sta -> ampdu_mlme .mtx );
783
- mutex_unlock (& local -> sta_mtx );
780
+ return tid_tx ;
784
781
}
785
782
786
783
void ieee80211_start_tx_ba_cb_irqsafe (struct ieee80211_vif * vif ,
787
784
const u8 * ra , u16 tid )
788
785
{
789
786
struct ieee80211_sub_if_data * sdata = vif_to_sdata (vif );
790
787
struct ieee80211_local * local = sdata -> local ;
791
- struct ieee80211_ra_tid * ra_tid ;
792
- struct sk_buff * skb = dev_alloc_skb ( 0 ) ;
788
+ struct sta_info * sta ;
789
+ struct tid_ampdu_tx * tid_tx ;
793
790
794
- if (unlikely (!skb ))
795
- return ;
791
+ trace_api_start_tx_ba_cb (sdata , ra , tid );
796
792
797
- ra_tid = (struct ieee80211_ra_tid * ) & skb -> cb ;
798
- memcpy (& ra_tid -> ra , ra , ETH_ALEN );
799
- ra_tid -> tid = tid ;
793
+ rcu_read_lock ();
794
+ tid_tx = ieee80211_lookup_tid_tx (sdata , ra , tid , & sta );
795
+ if (!tid_tx )
796
+ goto out ;
800
797
801
- skb -> pkt_type = IEEE80211_SDATA_QUEUE_AGG_START ;
802
- skb_queue_tail (& sdata -> skb_queue , skb );
803
- ieee80211_queue_work (& local -> hw , & sdata -> work );
798
+ set_bit (HT_AGG_STATE_START_CB , & tid_tx -> state );
799
+ ieee80211_queue_work (& local -> hw , & sta -> ampdu_mlme .work );
800
+ out :
801
+ rcu_read_unlock ();
804
802
}
805
803
EXPORT_SYMBOL (ieee80211_start_tx_ba_cb_irqsafe );
806
804
@@ -860,37 +858,18 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid)
860
858
}
861
859
EXPORT_SYMBOL (ieee80211_stop_tx_ba_session );
862
860
863
- void ieee80211_stop_tx_ba_cb (struct ieee80211_vif * vif , u8 * ra , u8 tid )
861
+ void ieee80211_stop_tx_ba_cb (struct sta_info * sta , int tid ,
862
+ struct tid_ampdu_tx * tid_tx )
864
863
{
865
- struct ieee80211_sub_if_data * sdata = vif_to_sdata (vif );
866
- struct ieee80211_local * local = sdata -> local ;
867
- struct sta_info * sta ;
868
- struct tid_ampdu_tx * tid_tx ;
864
+ struct ieee80211_sub_if_data * sdata = sta -> sdata ;
869
865
bool send_delba = false;
870
866
871
- trace_api_stop_tx_ba_cb (sdata , ra , tid );
872
-
873
- if (tid >= IEEE80211_NUM_TIDS ) {
874
- ht_dbg (sdata , "Bad TID value: tid = %d (>= %d)\n" ,
875
- tid , IEEE80211_NUM_TIDS );
876
- return ;
877
- }
878
-
879
- ht_dbg (sdata , "Stopping Tx BA session for %pM tid %d\n" , ra , tid );
880
-
881
- mutex_lock (& local -> sta_mtx );
882
-
883
- sta = sta_info_get_bss (sdata , ra );
884
- if (!sta ) {
885
- ht_dbg (sdata , "Could not find station: %pM\n" , ra );
886
- goto unlock ;
887
- }
867
+ ht_dbg (sdata , "Stopping Tx BA session for %pM tid %d\n" ,
868
+ sta -> sta .addr , tid );
888
869
889
- mutex_lock (& sta -> ampdu_mlme .mtx );
890
870
spin_lock_bh (& sta -> lock );
891
- tid_tx = rcu_dereference_protected_tid_tx (sta , tid );
892
871
893
- if (!tid_tx || ! test_bit (HT_AGG_STATE_STOPPING , & tid_tx -> state )) {
872
+ if (!test_bit (HT_AGG_STATE_STOPPING , & tid_tx -> state )) {
894
873
ht_dbg (sdata ,
895
874
"unexpected callback to A-MPDU stop for %pM tid %d\n" ,
896
875
sta -> sta .addr , tid );
@@ -906,32 +885,29 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
906
885
spin_unlock_bh (& sta -> lock );
907
886
908
887
if (send_delba )
909
- ieee80211_send_delba (sdata , ra , tid ,
888
+ ieee80211_send_delba (sdata , sta -> sta . addr , tid ,
910
889
WLAN_BACK_INITIATOR , WLAN_REASON_QSTA_NOT_USE );
911
-
912
- mutex_unlock (& sta -> ampdu_mlme .mtx );
913
- unlock :
914
- mutex_unlock (& local -> sta_mtx );
915
890
}
916
891
917
892
void ieee80211_stop_tx_ba_cb_irqsafe (struct ieee80211_vif * vif ,
918
893
const u8 * ra , u16 tid )
919
894
{
920
895
struct ieee80211_sub_if_data * sdata = vif_to_sdata (vif );
921
896
struct ieee80211_local * local = sdata -> local ;
922
- struct ieee80211_ra_tid * ra_tid ;
923
- struct sk_buff * skb = dev_alloc_skb ( 0 ) ;
897
+ struct sta_info * sta ;
898
+ struct tid_ampdu_tx * tid_tx ;
924
899
925
- if (unlikely (!skb ))
926
- return ;
900
+ trace_api_stop_tx_ba_cb (sdata , ra , tid );
927
901
928
- ra_tid = (struct ieee80211_ra_tid * ) & skb -> cb ;
929
- memcpy (& ra_tid -> ra , ra , ETH_ALEN );
930
- ra_tid -> tid = tid ;
902
+ rcu_read_lock ();
903
+ tid_tx = ieee80211_lookup_tid_tx (sdata , ra , tid , & sta );
904
+ if (!tid_tx )
905
+ goto out ;
931
906
932
- skb -> pkt_type = IEEE80211_SDATA_QUEUE_AGG_STOP ;
933
- skb_queue_tail (& sdata -> skb_queue , skb );
934
- ieee80211_queue_work (& local -> hw , & sdata -> work );
907
+ set_bit (HT_AGG_STATE_STOP_CB , & tid_tx -> state );
908
+ ieee80211_queue_work (& local -> hw , & sta -> ampdu_mlme .work );
909
+ out :
910
+ rcu_read_unlock ();
935
911
}
936
912
EXPORT_SYMBOL (ieee80211_stop_tx_ba_cb_irqsafe );
937
913
0 commit comments