From: Stanislaw Gruszka <sgruszka@redhat.com>
To: linux-wireless@vger.kernel.org
Cc: Helmut Schaa <helmut.schaa@googlemail.com>, Felix Fietkau <nbd@nbd.name>
Subject: [PATCH v2 04/10] rt2x00: separte clearing entry from rt2x00lib_txdone
Date: Wed, 15 Feb 2017 10:25:07 +0100 [thread overview]
Message-ID: <1487150713-3510-5-git-send-email-sgruszka@redhat.com> (raw)
In-Reply-To: <1487150713-3510-1-git-send-email-sgruszka@redhat.com>
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>
---
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 b5d90fe..03b368a 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);
--
1.8.3.1
next prev parent reply other threads:[~2017-02-15 9:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 9:25 [PATCH v2 00/10] rt2x00 patches 14.02.2017 Stanislaw Gruszka
2017-02-15 9:25 ` [PATCH v2 01/10] rt2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h Stanislaw Gruszka
2017-03-08 15:07 ` [v2, " Kalle Valo
2017-02-15 9:25 ` [PATCH v2 02/10] rt2800: identify station based on status WCID Stanislaw Gruszka
2017-02-15 9:25 ` [PATCH v2 03/10] rt2x00: separte filling tx status from rt2x00lib_txdone Stanislaw Gruszka
2017-02-15 9:25 ` Stanislaw Gruszka [this message]
2017-02-15 9:25 ` [PATCH v2 05/10] rt2x00: add txdone nomatch function Stanislaw Gruszka
2017-02-15 9:25 ` [PATCH v2 06/10] rt2x00: fixup fill_tx_status for nomatch case Stanislaw Gruszka
2017-02-15 9:25 ` [PATCH v2 07/10] rt2x00: use txdone_nomatch on rt2800usb Stanislaw Gruszka
2017-02-15 9:25 ` [PATCH v2 08/10] rt2800: status based rate flags for nomatch case Stanislaw Gruszka
2017-02-15 9:25 ` [PATCH v2 09/10] rt2800: use TXOP_BACKOFF for probe frames Stanislaw Gruszka
2017-02-15 9:25 ` [PATCH v2 10/10] rt2x00: fix rt2x00debug_dump_frame comment Stanislaw Gruszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1487150713-3510-5-git-send-email-sgruszka@redhat.com \
--to=sgruszka@redhat.com \
--cc=helmut.schaa@googlemail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).