]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/mac80211/agg-tx.c
mac80211: add improved HW queue control
[karo-tx-linux.git] / net / mac80211 / agg-tx.c
index 9628a1892441e68fd2aa0883ebed291b4316bb11..5b7053c58732f47e8dad0faf92256c8b6e7dc44f 100644 (file)
@@ -286,25 +286,25 @@ static inline int ieee80211_ac_from_tid(int tid)
  * a global "agg_queue_stop" refcount.
  */
 static void __acquires(agg_queue)
-ieee80211_stop_queue_agg(struct ieee80211_local *local, int tid)
+ieee80211_stop_queue_agg(struct ieee80211_sub_if_data *sdata, int tid)
 {
-       int queue = ieee80211_ac_from_tid(tid);
+       int queue = sdata->vif.hw_queue[ieee80211_ac_from_tid(tid)];
 
-       if (atomic_inc_return(&local->agg_queue_stop[queue]) == 1)
+       if (atomic_inc_return(&sdata->local->agg_queue_stop[queue]) == 1)
                ieee80211_stop_queue_by_reason(
-                       &local->hw, queue,
+                       &sdata->local->hw, queue,
                        IEEE80211_QUEUE_STOP_REASON_AGGREGATION);
        __acquire(agg_queue);
 }
 
 static void __releases(agg_queue)
-ieee80211_wake_queue_agg(struct ieee80211_local *local, int tid)
+ieee80211_wake_queue_agg(struct ieee80211_sub_if_data *sdata, int tid)
 {
-       int queue = ieee80211_ac_from_tid(tid);
+       int queue = sdata->vif.hw_queue[ieee80211_ac_from_tid(tid)];
 
-       if (atomic_dec_return(&local->agg_queue_stop[queue]) == 0)
+       if (atomic_dec_return(&sdata->local->agg_queue_stop[queue]) == 0)
                ieee80211_wake_queue_by_reason(
-                       &local->hw, queue,
+                       &sdata->local->hw, queue,
                        IEEE80211_QUEUE_STOP_REASON_AGGREGATION);
        __release(agg_queue);
 }
@@ -314,13 +314,14 @@ ieee80211_wake_queue_agg(struct ieee80211_local *local, int tid)
  * requires a call to ieee80211_agg_splice_finish later
  */
 static void __acquires(agg_queue)
-ieee80211_agg_splice_packets(struct ieee80211_local *local,
+ieee80211_agg_splice_packets(struct ieee80211_sub_if_data *sdata,
                             struct tid_ampdu_tx *tid_tx, u16 tid)
 {
-       int queue = ieee80211_ac_from_tid(tid);
+       struct ieee80211_local *local = sdata->local;
+       int queue = sdata->vif.hw_queue[ieee80211_ac_from_tid(tid)];
        unsigned long flags;
 
-       ieee80211_stop_queue_agg(local, tid);
+       ieee80211_stop_queue_agg(sdata, tid);
 
        if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates"
                          " from the pending queue\n", tid))
@@ -336,9 +337,9 @@ ieee80211_agg_splice_packets(struct ieee80211_local *local,
 }
 
 static void __releases(agg_queue)
-ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid)
+ieee80211_agg_splice_finish(struct ieee80211_sub_if_data *sdata, u16 tid)
 {
-       ieee80211_wake_queue_agg(local, tid);
+       ieee80211_wake_queue_agg(sdata, tid);
 }
 
 void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
@@ -376,9 +377,9 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
                                        " tid %d\n", tid);
 #endif
                spin_lock_bh(&sta->lock);
-               ieee80211_agg_splice_packets(local, tid_tx, tid);
+               ieee80211_agg_splice_packets(sdata, tid_tx, tid);
                ieee80211_assign_tid_tx(sta, tid, NULL);
-               ieee80211_agg_splice_finish(local, tid);
+               ieee80211_agg_splice_finish(sdata, tid);
                spin_unlock_bh(&sta->lock);
 
                kfree_rcu(tid_tx, rcu_head);
@@ -598,14 +599,14 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
         */
        spin_lock_bh(&sta->lock);
 
-       ieee80211_agg_splice_packets(local, tid_tx, tid);
+       ieee80211_agg_splice_packets(sta->sdata, tid_tx, tid);
        /*
         * Now mark as operational. This will be visible
         * in the TX path, and lets it go lock-free in
         * the common case.
         */
        set_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state);
-       ieee80211_agg_splice_finish(local, tid);
+       ieee80211_agg_splice_finish(sta->sdata, tid);
 
        spin_unlock_bh(&sta->lock);
 }
@@ -790,12 +791,12 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
         * more.
         */
 
-       ieee80211_agg_splice_packets(local, tid_tx, tid);
+       ieee80211_agg_splice_packets(sta->sdata, tid_tx, tid);
 
        /* future packets must not find the tid_tx struct any more */
        ieee80211_assign_tid_tx(sta, tid, NULL);
 
-       ieee80211_agg_splice_finish(local, tid);
+       ieee80211_agg_splice_finish(sta->sdata, tid);
 
        kfree_rcu(tid_tx, rcu_head);