sunxi: improve A20 Lime2 upload speed
[openwrt/staging/lynxis.git] / package / kernel / mac80211 / patches / 020-10-rt2x00-separte-filling-tx-status-from-rt2x00lib_txdo.patch
1 From 5edb05afebba8f488a30db29550e55c42eea6d6a Mon Sep 17 00:00:00 2001
2 From: Stanislaw Gruszka <sgruszka@redhat.com>
3 Date: Wed, 15 Feb 2017 10:25:06 +0100
4 Subject: [PATCH 10/19] rt2x00: separte filling tx status from rt2x00lib_txdone
5
6 This makes rt2x00lib_txdone a bit simpler and will allow to reuse code
7 in different variant of txdone which I'm preparing.
8
9 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
10 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
11 ---
12 drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 141 +++++++++++++------------
13 1 file changed, 76 insertions(+), 65 deletions(-)
14
15 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
16 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
17 @@ -313,73 +313,14 @@ static inline int rt2x00lib_txdone_bar_s
18 return ret;
19 }
20
21 -void rt2x00lib_txdone(struct queue_entry *entry,
22 - struct txdone_entry_desc *txdesc)
23 +static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
24 + struct ieee80211_tx_info *tx_info,
25 + struct skb_frame_desc *skbdesc,
26 + struct txdone_entry_desc *txdesc,
27 + bool success)
28 {
29 - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
30 - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
31 - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
32 - unsigned int header_length, i;
33 u8 rate_idx, rate_flags, retry_rates;
34 - u8 skbdesc_flags = skbdesc->flags;
35 - bool success;
36 -
37 - /*
38 - * Unmap the skb.
39 - */
40 - rt2x00queue_unmap_skb(entry);
41 -
42 - /*
43 - * Remove the extra tx headroom from the skb.
44 - */
45 - skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
46 -
47 - /*
48 - * Signal that the TX descriptor is no longer in the skb.
49 - */
50 - skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
51 -
52 - /*
53 - * Determine the length of 802.11 header.
54 - */
55 - header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
56 -
57 - /*
58 - * Remove L2 padding which was added during
59 - */
60 - if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
61 - rt2x00queue_remove_l2pad(entry->skb, header_length);
62 -
63 - /*
64 - * If the IV/EIV data was stripped from the frame before it was
65 - * passed to the hardware, we should now reinsert it again because
66 - * mac80211 will expect the same data to be present it the
67 - * frame as it was passed to us.
68 - */
69 - if (rt2x00_has_cap_hw_crypto(rt2x00dev))
70 - rt2x00crypto_tx_insert_iv(entry->skb, header_length);
71 -
72 - /*
73 - * Send frame to debugfs immediately, after this call is completed
74 - * we are going to overwrite the skb->cb array.
75 - */
76 - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
77 -
78 - /*
79 - * Determine if the frame has been successfully transmitted and
80 - * remove BARs from our check list while checking for their
81 - * TX status.
82 - */
83 - success =
84 - rt2x00lib_txdone_bar_status(entry) ||
85 - test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
86 - test_bit(TXDONE_UNKNOWN, &txdesc->flags);
87 -
88 - /*
89 - * Update TX statistics.
90 - */
91 - rt2x00dev->link.qual.tx_success += success;
92 - rt2x00dev->link.qual.tx_failed += !success;
93 + int i;
94
95 rate_idx = skbdesc->tx_rate_idx;
96 rate_flags = skbdesc->tx_rate_flags;
97 @@ -448,6 +389,76 @@ void rt2x00lib_txdone(struct queue_entry
98 else
99 rt2x00dev->low_level_stats.dot11RTSFailureCount++;
100 }
101 +}
102 +
103 +void rt2x00lib_txdone(struct queue_entry *entry,
104 + struct txdone_entry_desc *txdesc)
105 +{
106 + struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
107 + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
108 + struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
109 + u8 skbdesc_flags = skbdesc->flags;
110 + unsigned int header_length;
111 + bool success;
112 +
113 + /*
114 + * Unmap the skb.
115 + */
116 + rt2x00queue_unmap_skb(entry);
117 +
118 + /*
119 + * Remove the extra tx headroom from the skb.
120 + */
121 + skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
122 +
123 + /*
124 + * Signal that the TX descriptor is no longer in the skb.
125 + */
126 + skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
127 +
128 + /*
129 + * Determine the length of 802.11 header.
130 + */
131 + header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
132 +
133 + /*
134 + * Remove L2 padding which was added during
135 + */
136 + if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
137 + rt2x00queue_remove_l2pad(entry->skb, header_length);
138 +
139 + /*
140 + * If the IV/EIV data was stripped from the frame before it was
141 + * passed to the hardware, we should now reinsert it again because
142 + * mac80211 will expect the same data to be present it the
143 + * frame as it was passed to us.
144 + */
145 + if (rt2x00_has_cap_hw_crypto(rt2x00dev))
146 + rt2x00crypto_tx_insert_iv(entry->skb, header_length);
147 +
148 + /*
149 + * Send frame to debugfs immediately, after this call is completed
150 + * we are going to overwrite the skb->cb array.
151 + */
152 + rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
153 +
154 + /*
155 + * Determine if the frame has been successfully transmitted and
156 + * remove BARs from our check list while checking for their
157 + * TX status.
158 + */
159 + success =
160 + rt2x00lib_txdone_bar_status(entry) ||
161 + test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
162 + test_bit(TXDONE_UNKNOWN, &txdesc->flags);
163 +
164 + /*
165 + * Update TX statistics.
166 + */
167 + rt2x00dev->link.qual.tx_success += success;
168 + rt2x00dev->link.qual.tx_failed += !success;
169 +
170 + rt2x00lib_fill_tx_status(rt2x00dev, tx_info, skbdesc, txdesc, success);
171
172 /*
173 * Only send the status report to mac80211 when it's a frame