@@ -194,12 +194,15 @@ static inline u16 ar9170_get_seq(struct sk_buff *skb)
194194 return ar9170_get_seq_h ((void * ) txc -> frame_data );
195195}
196196
197+ static inline u16 ar9170_get_tid_h (struct ieee80211_hdr * hdr )
198+ {
199+ return (ieee80211_get_qos_ctl (hdr ))[0 ] & IEEE80211_QOS_CTL_TID_MASK ;
200+ }
201+
197202static inline u16 ar9170_get_tid (struct sk_buff * skb )
198203{
199204 struct ar9170_tx_control * txc = (void * ) skb -> data ;
200- struct ieee80211_hdr * hdr = (void * ) txc -> frame_data ;
201-
202- return (ieee80211_get_qos_ctl (hdr ))[0 ] & IEEE80211_QOS_CTL_TID_MASK ;
205+ return ar9170_get_tid_h ((struct ieee80211_hdr * ) txc -> frame_data );
203206}
204207
205208#define GET_NEXT_SEQ (seq ) ((seq + 1) & 0x0fff)
@@ -213,10 +216,10 @@ static void ar9170_print_txheader(struct ar9170 *ar, struct sk_buff *skb)
213216 struct ar9170_tx_info * arinfo = (void * ) txinfo -> rate_driver_data ;
214217 struct ieee80211_hdr * hdr = (void * ) txc -> frame_data ;
215218
216- printk (KERN_DEBUG "%s: => FRAME [skb:%p, q:%d, DA:[%pM] flags:%x s:%d "
219+ printk (KERN_DEBUG "%s: => FRAME [skb:%p, q:%d, DA:[%pM] s:%d "
217220 "mac_ctrl:%04x, phy_ctrl:%08x, timeout:[%d ms]]\n" ,
218221 wiphy_name (ar -> hw -> wiphy ), skb , skb_get_queue_mapping (skb ),
219- ieee80211_get_DA (hdr ), arinfo -> flags , ar9170_get_seq_h (hdr ),
222+ ieee80211_get_DA (hdr ), ar9170_get_seq_h (hdr ),
220223 le16_to_cpu (txc -> mac_control ), le32_to_cpu (txc -> phy_control ),
221224 jiffies_to_msecs (arinfo -> timeout - jiffies ));
222225}
@@ -430,7 +433,7 @@ void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb)
430433 spin_lock_irqsave (& ar -> tx_stats_lock , flags );
431434 ar -> tx_stats [queue ].len -- ;
432435
433- if (skb_queue_empty ( & ar -> tx_pending [queue ]) ) {
436+ if (ar -> tx_stats [queue ]. len < AR9170_NUM_TX_LIMIT_SOFT ) {
434437#ifdef AR9170_QUEUE_STOP_DEBUG
435438 printk (KERN_DEBUG "%s: wake queue %d\n" ,
436439 wiphy_name (ar -> hw -> wiphy ), queue );
@@ -440,22 +443,17 @@ void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb)
440443 }
441444 spin_unlock_irqrestore (& ar -> tx_stats_lock , flags );
442445
443- if (arinfo -> flags & AR9170_TX_FLAG_BLOCK_ACK ) {
444- ar9170_tx_ampdu_callback (ar , skb );
445- } else if (arinfo -> flags & AR9170_TX_FLAG_WAIT_FOR_ACK ) {
446- arinfo -> timeout = jiffies +
447- msecs_to_jiffies (AR9170_TX_TIMEOUT );
448-
449- skb_queue_tail (& ar -> tx_status [queue ], skb );
450- } else if (arinfo -> flags & AR9170_TX_FLAG_NO_ACK ) {
446+ if (info -> flags & IEEE80211_TX_CTL_NO_ACK ) {
451447 ar9170_tx_status (ar , skb , AR9170_TX_STATUS_FAILED );
452448 } else {
453- #ifdef AR9170_QUEUE_DEBUG
454- printk (KERN_DEBUG "%s: unsupported frame flags!\n" ,
455- wiphy_name (ar -> hw -> wiphy ));
456- ar9170_print_txheader (ar , skb );
457- #endif /* AR9170_QUEUE_DEBUG */
458- dev_kfree_skb_any (skb );
449+ if (info -> flags & IEEE80211_TX_CTL_AMPDU ) {
450+ ar9170_tx_ampdu_callback (ar , skb );
451+ } else {
452+ arinfo -> timeout = jiffies +
453+ msecs_to_jiffies (AR9170_TX_TIMEOUT );
454+
455+ skb_queue_tail (& ar -> tx_status [queue ], skb );
456+ }
459457 }
460458
461459 if (!ar -> tx_stats [queue ].len &&
@@ -1407,17 +1405,6 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
14071405
14081406 if (!(info -> flags & IEEE80211_TX_CTL_NO_ACK ) &&
14091407 (is_valid_ether_addr (ieee80211_get_DA (hdr )))) {
1410- if (info -> flags & IEEE80211_TX_CTL_AMPDU ) {
1411- if (unlikely (!info -> control .sta ))
1412- goto err_out ;
1413-
1414- txc -> mac_control |= cpu_to_le16 (AR9170_TX_MAC_AGGR );
1415- arinfo -> flags = AR9170_TX_FLAG_BLOCK_ACK ;
1416-
1417- goto out ;
1418- }
1419-
1420- txc -> mac_control |= cpu_to_le16 (AR9170_TX_MAC_RATE_PROBE );
14211408 /*
14221409 * WARNING:
14231410 * Putting the QoS queue bits into an unexplored territory is
@@ -1431,12 +1418,17 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
14311418
14321419 txc -> phy_control |=
14331420 cpu_to_le32 (queue << AR9170_TX_PHY_QOS_SHIFT );
1434- arinfo -> flags = AR9170_TX_FLAG_WAIT_FOR_ACK ;
1435- } else {
1436- arinfo -> flags = AR9170_TX_FLAG_NO_ACK ;
1421+
1422+ if (info -> flags & IEEE80211_TX_CTL_AMPDU ) {
1423+ if (unlikely (!info -> control .sta ))
1424+ goto err_out ;
1425+
1426+ txc -> mac_control |= cpu_to_le16 (AR9170_TX_MAC_AGGR );
1427+ } else {
1428+ txc -> mac_control |= cpu_to_le16 (AR9170_TX_MAC_RATE_PROBE );
1429+ }
14371430 }
14381431
1439- out :
14401432 return 0 ;
14411433
14421434err_out :
@@ -1671,8 +1663,7 @@ static bool ar9170_tx_ampdu(struct ar9170 *ar)
16711663 * tell the FW/HW that this is the last frame,
16721664 * that way it will wait for the immediate block ack.
16731665 */
1674- if (likely (skb_peek_tail (& agg )))
1675- ar9170_tx_indicate_immba (ar , skb_peek_tail (& agg ));
1666+ ar9170_tx_indicate_immba (ar , skb_peek_tail (& agg ));
16761667
16771668#ifdef AR9170_TXAGG_DEBUG
16781669 printk (KERN_DEBUG "%s: generated A-MPDU looks like this:\n" ,
@@ -1716,6 +1707,21 @@ static void ar9170_tx(struct ar9170 *ar)
17161707
17171708 for (i = 0 ; i < __AR9170_NUM_TXQ ; i ++ ) {
17181709 spin_lock_irqsave (& ar -> tx_stats_lock , flags );
1710+ frames = min (ar -> tx_stats [i ].limit - ar -> tx_stats [i ].len ,
1711+ skb_queue_len (& ar -> tx_pending [i ]));
1712+
1713+ if (remaining_space < frames ) {
1714+ #ifdef AR9170_QUEUE_DEBUG
1715+ printk (KERN_DEBUG "%s: tx quota reached queue:%d, "
1716+ "remaining slots:%d, needed:%d\n" ,
1717+ wiphy_name (ar -> hw -> wiphy ), i , remaining_space ,
1718+ frames );
1719+ #endif /* AR9170_QUEUE_DEBUG */
1720+ frames = remaining_space ;
1721+ }
1722+
1723+ ar -> tx_stats [i ].len += frames ;
1724+ ar -> tx_stats [i ].count += frames ;
17191725 if (ar -> tx_stats [i ].len >= ar -> tx_stats [i ].limit ) {
17201726#ifdef AR9170_QUEUE_DEBUG
17211727 printk (KERN_DEBUG "%s: queue %d full\n" ,
@@ -1733,25 +1739,8 @@ static void ar9170_tx(struct ar9170 *ar)
17331739 __ar9170_dump_txstats (ar );
17341740#endif /* AR9170_QUEUE_STOP_DEBUG */
17351741 ieee80211_stop_queue (ar -> hw , i );
1736- spin_unlock_irqrestore (& ar -> tx_stats_lock , flags );
1737- continue ;
17381742 }
17391743
1740- frames = min (ar -> tx_stats [i ].limit - ar -> tx_stats [i ].len ,
1741- skb_queue_len (& ar -> tx_pending [i ]));
1742-
1743- if (remaining_space < frames ) {
1744- #ifdef AR9170_QUEUE_DEBUG
1745- printk (KERN_DEBUG "%s: tx quota reached queue:%d, "
1746- "remaining slots:%d, needed:%d\n" ,
1747- wiphy_name (ar -> hw -> wiphy ), i , remaining_space ,
1748- frames );
1749- #endif /* AR9170_QUEUE_DEBUG */
1750- frames = remaining_space ;
1751- }
1752-
1753- ar -> tx_stats [i ].len += frames ;
1754- ar -> tx_stats [i ].count += frames ;
17551744 spin_unlock_irqrestore (& ar -> tx_stats_lock , flags );
17561745
17571746 if (!frames )
@@ -1773,7 +1762,7 @@ static void ar9170_tx(struct ar9170 *ar)
17731762 arinfo -> timeout = jiffies +
17741763 msecs_to_jiffies (AR9170_TX_TIMEOUT );
17751764
1776- if (arinfo -> flags == AR9170_TX_FLAG_BLOCK_ACK )
1765+ if (info -> flags & IEEE80211_TX_CTL_AMPDU )
17771766 atomic_inc (& ar -> tx_ampdu_pending );
17781767
17791768#ifdef AR9170_QUEUE_DEBUG
@@ -1784,7 +1773,7 @@ static void ar9170_tx(struct ar9170 *ar)
17841773
17851774 err = ar -> tx (ar , skb );
17861775 if (unlikely (err )) {
1787- if (arinfo -> flags == AR9170_TX_FLAG_BLOCK_ACK )
1776+ if (info -> flags & IEEE80211_TX_CTL_AMPDU )
17881777 atomic_dec (& ar -> tx_ampdu_pending );
17891778
17901779 frames_failed ++ ;
@@ -2366,7 +2355,6 @@ static void ar9170_sta_notify(struct ieee80211_hw *hw,
23662355 sta_info -> agg [i ].state = AR9170_TID_STATE_SHUTDOWN ;
23672356 sta_info -> agg [i ].active = false;
23682357 sta_info -> agg [i ].ssn = 0 ;
2369- sta_info -> agg [i ].retry = 0 ;
23702358 sta_info -> agg [i ].tid = i ;
23712359 INIT_LIST_HEAD (& sta_info -> agg [i ].list );
23722360 skb_queue_head_init (& sta_info -> agg [i ].queue );
0 commit comments