From: Pin-yen Lin <treapking@chromium.org>
To: Amitkumar Karwar <amitkarwar@gmail.com>,
Ganapathi Bhat <ganapathi017@gmail.com>,
Sharvari Harisangam <sharvari.harisangam@nxp.com>,
Xinming Hu <huxinming820@gmail.com>,
Kalle Valo <kvalo@kernel.org>
Cc: Brian Norris <briannorris@chromium.org>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Pin-yen Lin <treapking@chromium.org>
Subject: [PATCH] wifi: mwifiex: Replace RX workqueues with kthreads
Date: Fri, 9 Jun 2023 18:35:01 +0800 [thread overview]
Message-ID: <20230609103651.313194-1-treapking@chromium.org> (raw)
This improves the RX throughput likely by better locality for the work
loads.
We tested this patch on Mediatek MT8173 Chromebooks, and it shows ~80%
Rx throughput improvement on high data rate test cases.
Signed-off-by: Pin-yen Lin <treapking@chromium.org>
---
.../wireless/marvell/mwifiex/11n_rxreorder.c | 2 +-
.../net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
drivers/net/wireless/marvell/mwifiex/main.c | 29 ++++++++-----------
drivers/net/wireless/marvell/mwifiex/main.h | 5 ++--
4 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
index 391793a16adc..431f6dc61f5b 100644
--- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
@@ -198,7 +198,7 @@ mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv,
priv->adapter->rx_locked = true;
if (priv->adapter->rx_processing) {
spin_unlock_bh(&priv->adapter->rx_proc_lock);
- flush_workqueue(priv->adapter->rx_workqueue);
+ kthread_flush_worker(priv->adapter->rx_thread);
} else {
spin_unlock_bh(&priv->adapter->rx_proc_lock);
}
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index bcd564dc3554..f985bff4e52c 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -872,7 +872,7 @@ static int mwifiex_deinit_priv_params(struct mwifiex_private *priv)
adapter->rx_locked = true;
if (adapter->rx_processing) {
spin_unlock_bh(&adapter->rx_proc_lock);
- flush_workqueue(adapter->rx_workqueue);
+ kthread_flush_worker(adapter->rx_thread);
} else {
spin_unlock_bh(&adapter->rx_proc_lock);
}
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index ea22a08e6c08..bab963f3db83 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -168,7 +168,7 @@ static void mwifiex_queue_rx_work(struct mwifiex_adapter *adapter)
spin_unlock_bh(&adapter->rx_proc_lock);
} else {
spin_unlock_bh(&adapter->rx_proc_lock);
- queue_work(adapter->rx_workqueue, &adapter->rx_work);
+ kthread_queue_work(adapter->rx_thread, &adapter->rx_work);
}
}
@@ -526,9 +526,10 @@ static void mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter)
adapter->workqueue = NULL;
}
- if (adapter->rx_workqueue) {
- destroy_workqueue(adapter->rx_workqueue);
- adapter->rx_workqueue = NULL;
+ if (adapter->rx_thread) {
+ kthread_flush_worker(adapter->rx_thread);
+ kthread_destroy_worker(adapter->rx_thread);
+ adapter->rx_thread = NULL;
}
}
@@ -1394,7 +1395,7 @@ int is_command_pending(struct mwifiex_adapter *adapter)
*
* It handles the RX operations.
*/
-static void mwifiex_rx_work_queue(struct work_struct *work)
+static void mwifiex_rx_work_queue(struct kthread_work *work)
{
struct mwifiex_adapter *adapter =
container_of(work, struct mwifiex_adapter, rx_work);
@@ -1554,13 +1555,10 @@ mwifiex_reinit_sw(struct mwifiex_adapter *adapter)
INIT_WORK(&adapter->main_work, mwifiex_main_work_queue);
if (adapter->rx_work_enabled) {
- adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE",
- WQ_HIGHPRI |
- WQ_MEM_RECLAIM |
- WQ_UNBOUND, 1);
- if (!adapter->rx_workqueue)
+ adapter->rx_thread = kthread_create_worker(0, "MWIFIEX_RX");
+ if (IS_ERR(adapter->rx_thread))
goto err_kmalloc;
- INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue);
+ kthread_init_work(&adapter->rx_work, mwifiex_rx_work_queue);
}
/* Register the device. Fill up the private data structure with
@@ -1709,14 +1707,11 @@ mwifiex_add_card(void *card, struct completion *fw_done,
INIT_WORK(&adapter->main_work, mwifiex_main_work_queue);
if (adapter->rx_work_enabled) {
- adapter->rx_workqueue = alloc_workqueue("MWIFIEX_RX_WORK_QUEUE",
- WQ_HIGHPRI |
- WQ_MEM_RECLAIM |
- WQ_UNBOUND, 1);
- if (!adapter->rx_workqueue)
+ adapter->rx_thread = kthread_create_worker(0, "MWIFIEX_RX");
+ if (!adapter->rx_thread)
goto err_kmalloc;
- INIT_WORK(&adapter->rx_work, mwifiex_rx_work_queue);
+ kthread_init_work(&adapter->rx_work, mwifiex_rx_work_queue);
}
/* Register the device. Fill up the private data structure with relevant
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index b95886e1413e..3255f9a5c2d4 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -32,6 +32,7 @@
#include <linux/gfp.h>
#include <linux/interrupt.h>
#include <linux/io.h>
+#include <linux/kthread.h>
#include <linux/of_gpio.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
@@ -886,8 +887,8 @@ struct mwifiex_adapter {
atomic_t tx_hw_pending;
struct workqueue_struct *workqueue;
struct work_struct main_work;
- struct workqueue_struct *rx_workqueue;
- struct work_struct rx_work;
+ struct kthread_worker *rx_thread;
+ struct kthread_work rx_work;
struct workqueue_struct *dfs_workqueue;
struct work_struct dfs_work;
bool rx_work_enabled;
--
2.41.0.162.gfafddb0af9-goog
next reply other threads:[~2023-06-09 10:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 10:35 Pin-yen Lin [this message]
2023-06-09 10:41 ` [PATCH] wifi: mwifiex: Replace RX workqueues with kthreads Kalle Valo
2023-06-09 17:41 ` Pin-yen Lin
2023-06-12 23:47 ` Brian Norris
2023-06-13 5:12 ` Kalle Valo
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=20230609103651.313194-1-treapking@chromium.org \
--to=treapking@chromium.org \
--cc=amitkarwar@gmail.com \
--cc=briannorris@chromium.org \
--cc=ganapathi017@gmail.com \
--cc=huxinming820@gmail.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=sharvari.harisangam@nxp.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).