mac80211: brcmsmac: do a read after write when writing objmem to device.
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 566-ath9k_use_ieee80211_free_txskb.patch
1 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3 @@ -66,8 +66,7 @@ static void ath_tx_update_baw(struct ath
4 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
5 struct ath_txq *txq,
6 struct ath_atx_tid *tid,
7 - struct sk_buff *skb,
8 - bool dequeue);
9 + struct sk_buff *skb);
10
11 enum {
12 MCS_HT20,
13 @@ -176,7 +175,15 @@ static void ath_tx_flush_tid(struct ath_
14 fi = get_frame_info(skb);
15 bf = fi->bf;
16
17 - if (bf && fi->retries) {
18 + if (!bf) {
19 + bf = ath_tx_setup_buffer(sc, txq, tid, skb);
20 + if (!bf) {
21 + ieee80211_free_txskb(sc->hw, skb);
22 + continue;
23 + }
24 + }
25 +
26 + if (fi->retries) {
27 list_add_tail(&bf->list, &bf_head);
28 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
29 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
30 @@ -789,10 +796,13 @@ static enum ATH_AGGR_STATUS ath_tx_form_
31 fi = get_frame_info(skb);
32 bf = fi->bf;
33 if (!fi->bf)
34 - bf = ath_tx_setup_buffer(sc, txq, tid, skb, true);
35 + bf = ath_tx_setup_buffer(sc, txq, tid, skb);
36
37 - if (!bf)
38 + if (!bf) {
39 + __skb_unlink(skb, &tid->buf_q);
40 + ieee80211_free_txskb(sc->hw, skb);
41 continue;
42 + }
43
44 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
45 seqno = bf->bf_state.seqno;
46 @@ -1735,9 +1745,11 @@ static void ath_tx_send_ampdu(struct ath
47 return;
48 }
49
50 - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
51 - if (!bf)
52 + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
53 + if (!bf) {
54 + ieee80211_free_txskb(sc->hw, skb);
55 return;
56 + }
57
58 bf->bf_state.bf_type = BUF_AMPDU;
59 INIT_LIST_HEAD(&bf_head);
60 @@ -1761,11 +1773,6 @@ static void ath_tx_send_normal(struct at
61 struct ath_buf *bf;
62
63 bf = fi->bf;
64 - if (!bf)
65 - bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
66 -
67 - if (!bf)
68 - return;
69
70 INIT_LIST_HEAD(&bf_head);
71 list_add_tail(&bf->list, &bf_head);
72 @@ -1839,8 +1846,7 @@ u8 ath_txchainmask_reduction(struct ath_
73 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
74 struct ath_txq *txq,
75 struct ath_atx_tid *tid,
76 - struct sk_buff *skb,
77 - bool dequeue)
78 + struct sk_buff *skb)
79 {
80 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
81 struct ath_frame_info *fi = get_frame_info(skb);
82 @@ -1852,7 +1858,7 @@ static struct ath_buf *ath_tx_setup_buff
83 bf = ath_tx_get_buffer(sc);
84 if (!bf) {
85 ath_dbg(common, XMIT, "TX buffers are full\n");
86 - goto error;
87 + return NULL;
88 }
89
90 ATH_TXBUF_RESET(bf);
91 @@ -1881,18 +1887,12 @@ static struct ath_buf *ath_tx_setup_buff
92 ath_err(ath9k_hw_common(sc->sc_ah),
93 "dma_mapping_error() on TX\n");
94 ath_tx_return_buffer(sc, bf);
95 - goto error;
96 + return NULL;
97 }
98
99 fi->bf = bf;
100
101 return bf;
102 -
103 -error:
104 - if (dequeue)
105 - __skb_unlink(skb, &tid->buf_q);
106 - dev_kfree_skb_any(skb);
107 - return NULL;
108 }
109
110 /* FIXME: tx power */
111 @@ -1921,9 +1921,14 @@ static void ath_tx_start_dma(struct ath_
112 */
113 ath_tx_send_ampdu(sc, tid, skb, txctl);
114 } else {
115 - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
116 - if (!bf)
117 + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
118 + if (!bf) {
119 + if (txctl->paprd)
120 + dev_kfree_skb_any(skb);
121 + else
122 + ieee80211_free_txskb(sc->hw, skb);
123 return;
124 + }
125
126 bf->bf_state.bfs_paprd = txctl->paprd;
127
128 --- a/drivers/net/wireless/ath/ath9k/main.c
129 +++ b/drivers/net/wireless/ath/ath9k/main.c
130 @@ -775,7 +775,7 @@ static void ath9k_tx(struct ieee80211_hw
131
132 return;
133 exit:
134 - dev_kfree_skb_any(skb);
135 + ieee80211_free_txskb(hw, skb);
136 }
137
138 static void ath9k_stop(struct ieee80211_hw *hw)
139 --- a/drivers/net/wireless/ath/ath9k/beacon.c
140 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
141 @@ -120,7 +120,7 @@ static void ath9k_tx_cabq(struct ieee802
142
143 if (ath_tx_start(hw, skb, &txctl) != 0) {
144 ath_dbg(common, XMIT, "CABQ TX failed\n");
145 - dev_kfree_skb_any(skb);
146 + ieee80211_free_txskb(hw, skb);
147 }
148 }
149