openwrtv4/package/kernel/mac80211/patches/020-11-rt2x00-separte-clearing-entry-from-rt2x00lib_txdone.patch
Daniel Golle 399d5cf532 mac80211: rt2x00: import upstream changes and rebase our patches
Some of our local patches have been accepted upstream. And there are
some more relevant changes (mostly for rt2800usb). Import them and
rebase our remaining local patches on top.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2017-03-30 18:31:02 +02:00

88 lines
2.8 KiB
Diff

From 56646adf9cd60b488ddc5633a2d9aa1f30efa5db Mon Sep 17 00:00:00 2001
From: Stanislaw Gruszka <sgruszka@redhat.com>
Date: Wed, 15 Feb 2017 10:25:07 +0100
Subject: [PATCH 11/19] rt2x00: separte clearing entry from rt2x00lib_txdone
This makes rt2x00lib_txdone a bit simpler and will allow to reuse
code in different variant of txdone which I'm preparing.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 51 +++++++++++++++-----------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
index b5d90fefc96b..03b368ac9cb6 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
@@ -391,6 +391,32 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
}
}
+static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
+ struct queue_entry *entry)
+{
+ /*
+ * Make this entry available for reuse.
+ */
+ entry->skb = NULL;
+ entry->flags = 0;
+
+ rt2x00dev->ops->lib->clear_entry(entry);
+
+ rt2x00queue_index_inc(entry, Q_INDEX_DONE);
+
+ /*
+ * If the data queue was below the threshold before the txdone
+ * handler we must make sure the packet queue in the mac80211 stack
+ * is reenabled when the txdone handler has finished. This has to be
+ * serialized with rt2x00mac_tx(), otherwise we can wake up queue
+ * before it was stopped.
+ */
+ spin_lock_bh(&entry->queue->tx_lock);
+ if (!rt2x00queue_threshold(entry->queue))
+ rt2x00queue_unpause_queue(entry->queue);
+ spin_unlock_bh(&entry->queue->tx_lock);
+}
+
void rt2x00lib_txdone(struct queue_entry *entry,
struct txdone_entry_desc *txdesc)
{
@@ -471,30 +497,11 @@ void rt2x00lib_txdone(struct queue_entry *entry,
ieee80211_tx_status(rt2x00dev->hw, entry->skb);
else
ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
- } else
+ } else {
dev_kfree_skb_any(entry->skb);
+ }
- /*
- * Make this entry available for reuse.
- */
- entry->skb = NULL;
- entry->flags = 0;
-
- rt2x00dev->ops->lib->clear_entry(entry);
-
- rt2x00queue_index_inc(entry, Q_INDEX_DONE);
-
- /*
- * If the data queue was below the threshold before the txdone
- * handler we must make sure the packet queue in the mac80211 stack
- * is reenabled when the txdone handler has finished. This has to be
- * serialized with rt2x00mac_tx(), otherwise we can wake up queue
- * before it was stopped.
- */
- spin_lock_bh(&entry->queue->tx_lock);
- if (!rt2x00queue_threshold(entry->queue))
- rt2x00queue_unpause_queue(entry->queue);
- spin_unlock_bh(&entry->queue->tx_lock);
+ rt2x00lib_clear_entry(rt2x00dev, entry);
}
EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
--
2.12.1