ath9k: merge a fix for tx power limit testing
[openwrt.git] / package / mac80211 / patches / 543-ath9k_move_seqno_alloc.patch
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_
4
5 }
6
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,
9 struct ath_txq *txq,
10 + struct ath_atx_tid *tid,
11 struct sk_buff *skb)
12 {
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;
18 struct ath_buf *bf;
19 struct ath_desc *ds;
20 int frm_type;
21 + u16 seqno;
22
23 bf = ath_tx_get_buffer(sc);
24 if (!bf) {
25 @@ -1737,6 +1739,13 @@ static struct ath_buf *ath_tx_setup_buff
26
27 ATH_TXBUF_RESET(bf);
28
29 + if (tid) {
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;
34 + }
35 +
36 bf->bf_flags = setup_tx_flags(skb);
37 bf->bf_mpdu = skb;
38
39 @@ -1773,15 +1782,15 @@ static struct ath_buf *ath_tx_setup_buff
40 }
41
42 /* FIXME: tx power */
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)
46 {
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;
52 - u16 seqno;
53 + struct ath_buf *bf;
54 + int ret = 0;
55 u8 tidno;
56
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);
61
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);
65 -
66 - bf->bf_state.seqno = seqno;
67 -
68 WARN_ON(tid->ac->txq != txctl->txq);
69 }
70
71 + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
72 + if (unlikely(!bf)) {
73 + ret = -ENOMEM;
74 + goto out;
75 + }
76 +
77 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && tid) {
78 /*
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);
82 }
83
84 +out:
85 spin_unlock_bh(&txctl->txq->axq_lock);
86 + return ret;
87 }
88
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;
94 - struct ath_buf *bf;
95 int padpos, padsize;
96 int frmlen = skb->len + FCS_LEN;
97 int q;
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.
100 */
101
102 - bf = ath_tx_setup_buffer(hw, txctl->txq, skb);
103 - if (unlikely(!bf))
104 - return -ENOMEM;
105 -
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
110 }
111 spin_unlock_bh(&txq->axq_lock);
112
113 - ath_tx_start_dma(sc, bf, txctl);
114 -
115 - return 0;
116 + return ath_tx_start_dma(sc, skb, txctl);
117 }
118
119 /*****************/
This page took 0.060508 seconds and 5 git commands to generate.