1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -1717,17 +1717,19 @@ static void ath_buf_set_rate(struct ath_
7 -static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,
8 +static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
10 + struct ath_atx_tid *tid,
13 - struct ath_softc *sc = hw->priv;
14 struct ath_hw *ah = sc->sc_ah;
15 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
16 struct ath_frame_info *fi = get_frame_info(skb);
17 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
23 bf = ath_tx_get_buffer(sc);
25 @@ -1737,6 +1739,13 @@ static struct ath_buf *ath_tx_setup_buff
30 + seqno = tid->seq_next;
31 + hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT);
32 + INCR(tid->seq_next, IEEE80211_SEQ_MAX);
33 + bf->bf_state.seqno = seqno;
36 bf->bf_flags = setup_tx_flags(skb);
39 @@ -1773,15 +1782,15 @@ static struct ath_buf *ath_tx_setup_buff
43 -static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
44 +static int ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
45 struct ath_tx_control *txctl)
47 - struct sk_buff *skb = bf->bf_mpdu;
48 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
49 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
50 struct list_head bf_head;
51 struct ath_atx_tid *tid = NULL;
57 spin_lock_bh(&txctl->txq->axq_lock);
58 @@ -1791,15 +1800,15 @@ static void ath_tx_start_dma(struct ath_
59 IEEE80211_QOS_CTL_TID_MASK;
60 tid = ATH_AN_2_TID(txctl->an, tidno);
62 - seqno = tid->seq_next;
63 - hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT);
64 - INCR(tid->seq_next, IEEE80211_SEQ_MAX);
66 - bf->bf_state.seqno = seqno;
68 WARN_ON(tid->ac->txq != txctl->txq);
71 + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
72 + if (unlikely(!bf)) {
77 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && tid) {
79 * Try aggregation if it's a unicast data frame
80 @@ -1825,7 +1834,9 @@ static void ath_tx_start_dma(struct ath_
81 ath_tx_send_normal(sc, txctl->txq, tid, &bf_head);
85 spin_unlock_bh(&txctl->txq->axq_lock);
89 /* Upon failure caller should free skb */
90 @@ -1838,7 +1849,6 @@ int ath_tx_start(struct ieee80211_hw *hw
91 struct ieee80211_vif *vif = info->control.vif;
92 struct ath_softc *sc = hw->priv;
93 struct ath_txq *txq = txctl->txq;
96 int frmlen = skb->len + FCS_LEN;
98 @@ -1885,10 +1895,6 @@ int ath_tx_start(struct ieee80211_hw *hw
99 * info are no longer valid (overwritten by the ath_frame_info data.
102 - bf = ath_tx_setup_buffer(hw, txctl->txq, skb);
106 q = skb_get_queue_mapping(skb);
107 spin_lock_bh(&txq->axq_lock);
108 if (txq == sc->tx.txq_map[q] &&
109 @@ -1898,9 +1904,7 @@ int ath_tx_start(struct ieee80211_hw *hw
111 spin_unlock_bh(&txq->axq_lock);
113 - ath_tx_start_dma(sc, bf, txctl);
116 + return ath_tx_start_dma(sc, skb, txctl);