sunxi: improve A20 Lime2 upload speed
[openwrt/staging/lynxis.git] / package / kernel / mac80211 / patches / 020-11-rt2x00-separte-clearing-entry-from-rt2x00lib_txdone.patch
1 From 56646adf9cd60b488ddc5633a2d9aa1f30efa5db Mon Sep 17 00:00:00 2001
2 From: Stanislaw Gruszka <sgruszka@redhat.com>
3 Date: Wed, 15 Feb 2017 10:25:07 +0100
4 Subject: [PATCH 11/19] rt2x00: separte clearing entry from rt2x00lib_txdone
5
6 This makes rt2x00lib_txdone a bit simpler and will allow to reuse
7 code 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 | 51 +++++++++++++++-----------
13 1 file changed, 29 insertions(+), 22 deletions(-)
14
15 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
16 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
17 @@ -391,6 +391,32 @@ static void rt2x00lib_fill_tx_status(str
18 }
19 }
20
21 +static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
22 + struct queue_entry *entry)
23 +{
24 + /*
25 + * Make this entry available for reuse.
26 + */
27 + entry->skb = NULL;
28 + entry->flags = 0;
29 +
30 + rt2x00dev->ops->lib->clear_entry(entry);
31 +
32 + rt2x00queue_index_inc(entry, Q_INDEX_DONE);
33 +
34 + /*
35 + * If the data queue was below the threshold before the txdone
36 + * handler we must make sure the packet queue in the mac80211 stack
37 + * is reenabled when the txdone handler has finished. This has to be
38 + * serialized with rt2x00mac_tx(), otherwise we can wake up queue
39 + * before it was stopped.
40 + */
41 + spin_lock_bh(&entry->queue->tx_lock);
42 + if (!rt2x00queue_threshold(entry->queue))
43 + rt2x00queue_unpause_queue(entry->queue);
44 + spin_unlock_bh(&entry->queue->tx_lock);
45 +}
46 +
47 void rt2x00lib_txdone(struct queue_entry *entry,
48 struct txdone_entry_desc *txdesc)
49 {
50 @@ -471,30 +497,11 @@ void rt2x00lib_txdone(struct queue_entry
51 ieee80211_tx_status(rt2x00dev->hw, entry->skb);
52 else
53 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
54 - } else
55 + } else {
56 dev_kfree_skb_any(entry->skb);
57 + }
58
59 - /*
60 - * Make this entry available for reuse.
61 - */
62 - entry->skb = NULL;
63 - entry->flags = 0;
64 -
65 - rt2x00dev->ops->lib->clear_entry(entry);
66 -
67 - rt2x00queue_index_inc(entry, Q_INDEX_DONE);
68 -
69 - /*
70 - * If the data queue was below the threshold before the txdone
71 - * handler we must make sure the packet queue in the mac80211 stack
72 - * is reenabled when the txdone handler has finished. This has to be
73 - * serialized with rt2x00mac_tx(), otherwise we can wake up queue
74 - * before it was stopped.
75 - */
76 - spin_lock_bh(&entry->queue->tx_lock);
77 - if (!rt2x00queue_threshold(entry->queue))
78 - rt2x00queue_unpause_queue(entry->queue);
79 - spin_unlock_bh(&entry->queue->tx_lock);
80 + rt2x00lib_clear_entry(rt2x00dev, entry);
81 }
82 EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
83