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
6 This makes rt2x00lib_txdone a bit simpler and will allow to reuse code
7 in different variant of txdone which I'm preparing.
9 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
10 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
12 drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 141 +++++++++++++------------
13 1 file changed, 76 insertions(+), 65 deletions(-)
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
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,
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;
40 - rt2x00queue_unmap_skb(entry);
43 - * Remove the extra tx headroom from the skb.
45 - skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
48 - * Signal that the TX descriptor is no longer in the skb.
50 - skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
53 - * Determine the length of 802.11 header.
55 - header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
58 - * Remove L2 padding which was added during
60 - if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
61 - rt2x00queue_remove_l2pad(entry->skb, header_length);
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.
69 - if (rt2x00_has_cap_hw_crypto(rt2x00dev))
70 - rt2x00crypto_tx_insert_iv(entry->skb, header_length);
73 - * Send frame to debugfs immediately, after this call is completed
74 - * we are going to overwrite the skb->cb array.
76 - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
79 - * Determine if the frame has been successfully transmitted and
80 - * remove BARs from our check list while checking for their
84 - rt2x00lib_txdone_bar_status(entry) ||
85 - test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
86 - test_bit(TXDONE_UNKNOWN, &txdesc->flags);
89 - * Update TX statistics.
91 - rt2x00dev->link.qual.tx_success += success;
92 - rt2x00dev->link.qual.tx_failed += !success;
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
99 rt2x00dev->low_level_stats.dot11RTSFailureCount++;
103 +void rt2x00lib_txdone(struct queue_entry *entry,
104 + struct txdone_entry_desc *txdesc)
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;
116 + rt2x00queue_unmap_skb(entry);
119 + * Remove the extra tx headroom from the skb.
121 + skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
124 + * Signal that the TX descriptor is no longer in the skb.
126 + skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
129 + * Determine the length of 802.11 header.
131 + header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
134 + * Remove L2 padding which was added during
136 + if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
137 + rt2x00queue_remove_l2pad(entry->skb, header_length);
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.
145 + if (rt2x00_has_cap_hw_crypto(rt2x00dev))
146 + rt2x00crypto_tx_insert_iv(entry->skb, header_length);
149 + * Send frame to debugfs immediately, after this call is completed
150 + * we are going to overwrite the skb->cb array.
152 + rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
155 + * Determine if the frame has been successfully transmitted and
156 + * remove BARs from our check list while checking for their
160 + rt2x00lib_txdone_bar_status(entry) ||
161 + test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
162 + test_bit(TXDONE_UNKNOWN, &txdesc->flags);
165 + * Update TX statistics.
167 + rt2x00dev->link.qual.tx_success += success;
168 + rt2x00dev->link.qual.tx_failed += !success;
170 + rt2x00lib_fill_tx_status(rt2x00dev, tx_info, skbdesc, txdesc, success);
173 * Only send the status report to mac80211 when it's a frame