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 diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
16 index dd6678109b7e..b5d90fefc96b 100644
17 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
18 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
19 @@ -313,73 +313,14 @@ static inline int rt2x00lib_txdone_bar_status(struct queue_entry *entry)
23 -void rt2x00lib_txdone(struct queue_entry *entry,
24 - struct txdone_entry_desc *txdesc)
25 +static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
26 + struct ieee80211_tx_info *tx_info,
27 + struct skb_frame_desc *skbdesc,
28 + struct txdone_entry_desc *txdesc,
31 - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
32 - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
33 - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
34 - unsigned int header_length, i;
35 u8 rate_idx, rate_flags, retry_rates;
36 - u8 skbdesc_flags = skbdesc->flags;
42 - rt2x00queue_unmap_skb(entry);
45 - * Remove the extra tx headroom from the skb.
47 - skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
50 - * Signal that the TX descriptor is no longer in the skb.
52 - skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
55 - * Determine the length of 802.11 header.
57 - header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
60 - * Remove L2 padding which was added during
62 - if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
63 - rt2x00queue_remove_l2pad(entry->skb, header_length);
66 - * If the IV/EIV data was stripped from the frame before it was
67 - * passed to the hardware, we should now reinsert it again because
68 - * mac80211 will expect the same data to be present it the
69 - * frame as it was passed to us.
71 - if (rt2x00_has_cap_hw_crypto(rt2x00dev))
72 - rt2x00crypto_tx_insert_iv(entry->skb, header_length);
75 - * Send frame to debugfs immediately, after this call is completed
76 - * we are going to overwrite the skb->cb array.
78 - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
81 - * Determine if the frame has been successfully transmitted and
82 - * remove BARs from our check list while checking for their
86 - rt2x00lib_txdone_bar_status(entry) ||
87 - test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
88 - test_bit(TXDONE_UNKNOWN, &txdesc->flags);
91 - * Update TX statistics.
93 - rt2x00dev->link.qual.tx_success += success;
94 - rt2x00dev->link.qual.tx_failed += !success;
97 rate_idx = skbdesc->tx_rate_idx;
98 rate_flags = skbdesc->tx_rate_flags;
99 @@ -448,6 +389,76 @@ void rt2x00lib_txdone(struct queue_entry *entry,
101 rt2x00dev->low_level_stats.dot11RTSFailureCount++;
105 +void rt2x00lib_txdone(struct queue_entry *entry,
106 + struct txdone_entry_desc *txdesc)
108 + struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
109 + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
110 + struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
111 + u8 skbdesc_flags = skbdesc->flags;
112 + unsigned int header_length;
118 + rt2x00queue_unmap_skb(entry);
121 + * Remove the extra tx headroom from the skb.
123 + skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
126 + * Signal that the TX descriptor is no longer in the skb.
128 + skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
131 + * Determine the length of 802.11 header.
133 + header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
136 + * Remove L2 padding which was added during
138 + if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
139 + rt2x00queue_remove_l2pad(entry->skb, header_length);
142 + * If the IV/EIV data was stripped from the frame before it was
143 + * passed to the hardware, we should now reinsert it again because
144 + * mac80211 will expect the same data to be present it the
145 + * frame as it was passed to us.
147 + if (rt2x00_has_cap_hw_crypto(rt2x00dev))
148 + rt2x00crypto_tx_insert_iv(entry->skb, header_length);
151 + * Send frame to debugfs immediately, after this call is completed
152 + * we are going to overwrite the skb->cb array.
154 + rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
157 + * Determine if the frame has been successfully transmitted and
158 + * remove BARs from our check list while checking for their
162 + rt2x00lib_txdone_bar_status(entry) ||
163 + test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
164 + test_bit(TXDONE_UNKNOWN, &txdesc->flags);
167 + * Update TX statistics.
169 + rt2x00dev->link.qual.tx_success += success;
170 + rt2x00dev->link.qual.tx_failed += !success;
172 + rt2x00lib_fill_tx_status(rt2x00dev, tx_info, skbdesc, txdesc, success);
175 * Only send the status report to mac80211 when it's a frame