@@ -3807,6 +3807,36 @@ static inline s32 ieee80211_sta_deficit(struct sta_info *sta, u8 ac)
3807
3807
return air_info -> deficit - atomic_read (& air_info -> aql_tx_pending );
3808
3808
}
3809
3809
3810
+ static void
3811
+ ieee80211_txq_set_active (struct txq_info * txqi )
3812
+ {
3813
+ struct sta_info * sta ;
3814
+
3815
+ if (!txqi -> txq .sta )
3816
+ return ;
3817
+
3818
+ sta = container_of (txqi -> txq .sta , struct sta_info , sta );
3819
+ sta -> airtime [txqi -> txq .ac ].last_active = (u32 )jiffies ;
3820
+ }
3821
+
3822
+ static bool
3823
+ ieee80211_txq_keep_active (struct txq_info * txqi )
3824
+ {
3825
+ struct sta_info * sta ;
3826
+ u32 diff ;
3827
+
3828
+ if (!txqi -> txq .sta )
3829
+ return false;
3830
+
3831
+ sta = container_of (txqi -> txq .sta , struct sta_info , sta );
3832
+ if (ieee80211_sta_deficit (sta , txqi -> txq .ac ) >= 0 )
3833
+ return false;
3834
+
3835
+ diff = (u32 )jiffies - sta -> airtime [txqi -> txq .ac ].last_active ;
3836
+
3837
+ return diff <= AIRTIME_ACTIVE_DURATION ;
3838
+ }
3839
+
3810
3840
struct ieee80211_txq * ieee80211_next_txq (struct ieee80211_hw * hw , u8 ac )
3811
3841
{
3812
3842
struct ieee80211_local * local = hw_to_local (hw );
@@ -3853,7 +3883,6 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
3853
3883
}
3854
3884
}
3855
3885
3856
-
3857
3886
if (txqi -> schedule_round == local -> schedule_round [ac ])
3858
3887
goto out ;
3859
3888
@@ -3873,27 +3902,30 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw,
3873
3902
{
3874
3903
struct ieee80211_local * local = hw_to_local (hw );
3875
3904
struct txq_info * txqi = to_txq_info (txq );
3905
+ bool has_queue ;
3876
3906
3877
3907
spin_lock_bh (& local -> active_txq_lock [txq -> ac ]);
3878
3908
3909
+ has_queue = force || txq_has_queue (txq );
3879
3910
if (list_empty (& txqi -> schedule_order ) &&
3880
- (force || !skb_queue_empty (& txqi -> frags ) ||
3881
- txqi -> tin .backlog_packets )) {
3911
+ (has_queue || ieee80211_txq_keep_active (txqi ))) {
3882
3912
/* If airtime accounting is active, always enqueue STAs at the
3883
3913
* head of the list to ensure that they only get moved to the
3884
3914
* back by the airtime DRR scheduler once they have a negative
3885
3915
* deficit. A station that already has a negative deficit will
3886
3916
* get immediately moved to the back of the list on the next
3887
3917
* call to ieee80211_next_txq().
3888
3918
*/
3889
- if (txqi -> txq .sta && local -> airtime_flags &&
3919
+ if (txqi -> txq .sta && local -> airtime_flags && has_queue &&
3890
3920
wiphy_ext_feature_isset (local -> hw .wiphy ,
3891
3921
NL80211_EXT_FEATURE_AIRTIME_FAIRNESS ))
3892
3922
list_add (& txqi -> schedule_order ,
3893
3923
& local -> active_txqs [txq -> ac ]);
3894
3924
else
3895
3925
list_add_tail (& txqi -> schedule_order ,
3896
3926
& local -> active_txqs [txq -> ac ]);
3927
+ if (has_queue )
3928
+ ieee80211_txq_set_active (txqi );
3897
3929
}
3898
3930
3899
3931
spin_unlock_bh (& local -> active_txq_lock [txq -> ac ]);
0 commit comments