mac80211: rt2x00: import upstream changes and rebase our patches
[lede.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 diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
16 index b5d90fefc96b..03b368ac9cb6 100644
17 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
18 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
19 @@ -391,6 +391,32 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
20         }
21  }
22  
23 +static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
24 +                                 struct queue_entry *entry)
25 +{
26 +       /*
27 +        * Make this entry available for reuse.
28 +        */
29 +       entry->skb = NULL;
30 +       entry->flags = 0;
31 +
32 +       rt2x00dev->ops->lib->clear_entry(entry);
33 +
34 +       rt2x00queue_index_inc(entry, Q_INDEX_DONE);
35 +
36 +       /*
37 +        * If the data queue was below the threshold before the txdone
38 +        * handler we must make sure the packet queue in the mac80211 stack
39 +        * is reenabled when the txdone handler has finished. This has to be
40 +        * serialized with rt2x00mac_tx(), otherwise we can wake up queue
41 +        * before it was stopped.
42 +        */
43 +       spin_lock_bh(&entry->queue->tx_lock);
44 +       if (!rt2x00queue_threshold(entry->queue))
45 +               rt2x00queue_unpause_queue(entry->queue);
46 +       spin_unlock_bh(&entry->queue->tx_lock);
47 +}
48 +
49  void rt2x00lib_txdone(struct queue_entry *entry,
50                       struct txdone_entry_desc *txdesc)
51  {
52 @@ -471,30 +497,11 @@ void rt2x00lib_txdone(struct queue_entry *entry,
53                         ieee80211_tx_status(rt2x00dev->hw, entry->skb);
54                 else
55                         ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
56 -       } else
57 +       } else {
58                 dev_kfree_skb_any(entry->skb);
59 +       }
60  
61 -       /*
62 -        * Make this entry available for reuse.
63 -        */
64 -       entry->skb = NULL;
65 -       entry->flags = 0;
66 -
67 -       rt2x00dev->ops->lib->clear_entry(entry);
68 -
69 -       rt2x00queue_index_inc(entry, Q_INDEX_DONE);
70 -
71 -       /*
72 -        * If the data queue was below the threshold before the txdone
73 -        * handler we must make sure the packet queue in the mac80211 stack
74 -        * is reenabled when the txdone handler has finished. This has to be
75 -        * serialized with rt2x00mac_tx(), otherwise we can wake up queue
76 -        * before it was stopped.
77 -        */
78 -       spin_lock_bh(&entry->queue->tx_lock);
79 -       if (!rt2x00queue_threshold(entry->queue))
80 -               rt2x00queue_unpause_queue(entry->queue);
81 -       spin_unlock_bh(&entry->queue->tx_lock);
82 +       rt2x00lib_clear_entry(rt2x00dev, entry);
83  }
84  EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
85  
86 -- 
87 2.12.1
88