From: David Mosberger-Tang <davidm@egauge.net>
To: Ajay Singh <ajay.kathat@microchip.com>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>,
Kalle Valo <kvalo@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
David Mosberger-Tang <davidm@egauge.net>
Subject: [PATCH v2 01/50] wilc1000: don't hold txq_spinlock while initializing AC queue limits
Date: Thu, 23 Dec 2021 01:14:05 +0000 (UTC) [thread overview]
Message-ID: <20211223011358.4031459-2-davidm@egauge.net> (raw)
In-Reply-To: <20211223011358.4031459-1-davidm@egauge.net>
The wilc_tx_queue_status queue is relatively large and there is
absolutely no need to initialize it while holding a spinlock.
Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
.../net/wireless/microchip/wilc1000/netdev.h | 1 -
.../net/wireless/microchip/wilc1000/wlan.c | 32 +++++++++++--------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index a067274c20144..f4fc2cc392bd0 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -202,7 +202,6 @@ struct wilc_tx_queue_status {
u16 end_index;
u16 cnt[NQUEUES];
u16 sum;
- bool initialized;
};
struct wilc {
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index fb5633a05fd51..c4da14147dd04 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -12,6 +12,8 @@
#define WAKE_UP_TRIAL_RETRY 10000
+static const u8 factors[NQUEUES] = {1, 1, 1, 1};
+
static inline bool is_wilc1000(u32 id)
{
return (id & (~WILC_CHIP_REV_FIELD)) == WILC_1000_BASE_ID;
@@ -283,10 +285,23 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
return 1;
}
+static void init_q_limits(struct wilc *wl)
+{
+ struct wilc_tx_queue_status *q = &wl->tx_q_limit;
+ int i;
+
+ for (i = 0; i < AC_BUFFER_SIZE; i++)
+ q->buffer[i] = i % NQUEUES;
+
+ for (i = 0; i < NQUEUES; i++) {
+ q->cnt[i] = AC_BUFFER_SIZE * factors[i] / NQUEUES;
+ q->sum += q->cnt[i];
+ }
+ q->end_index = AC_BUFFER_SIZE - 1;
+}
+
static bool is_ac_q_limit(struct wilc *wl, u8 q_num)
{
- u8 factors[NQUEUES] = {1, 1, 1, 1};
- u16 i;
unsigned long flags;
struct wilc_tx_queue_status *q = &wl->tx_q_limit;
u8 end_index;
@@ -294,17 +309,6 @@ static bool is_ac_q_limit(struct wilc *wl, u8 q_num)
bool ret = false;
spin_lock_irqsave(&wl->txq_spinlock, flags);
- if (!q->initialized) {
- for (i = 0; i < AC_BUFFER_SIZE; i++)
- q->buffer[i] = i % NQUEUES;
-
- for (i = 0; i < NQUEUES; i++) {
- q->cnt[i] = AC_BUFFER_SIZE * factors[i] / NQUEUES;
- q->sum += q->cnt[i];
- }
- q->end_index = AC_BUFFER_SIZE - 1;
- q->initialized = 1;
- }
end_index = q->end_index;
q->cnt[q->buffer[end_index]] -= factors[q->buffer[end_index]];
@@ -1484,6 +1488,8 @@ int wilc_wlan_init(struct net_device *dev)
goto fail;
}
+ init_q_limits(wilc);
+
if (!wilc->tx_buffer)
wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL);
--
2.25.1
next prev parent reply other threads:[~2021-12-23 1:14 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 1:14 [PATCH v2 00/50] wilc1000: rework tx path to use sk_buffs throughout David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 04/50] wilc1000: factor common code in wilc_wlan_cfg_set() and wilc_wlan_cfg_get() David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 03/50] wilc1000: move receive-queue stats from txq to wilc structure David Mosberger-Tang
2021-12-23 1:14 ` David Mosberger-Tang [this message]
2021-12-23 1:14 ` [PATCH v2 02/50] wilc1000: switch txq_event from completion to waitqueue David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 23/50] wilc1000: introduce symbolic names for two tx-related control bits David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 21/50] wilc1000: declare read-only ac_preserve_ratio as static and const David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 14/50] wilc1000: if there is no tx packet, don't increment packets-sent counter David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 16/50] wilc1000: switch tx queue to normal sk_buff entries David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 30/50] wilc1000: use more descriptive variable names David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 29/50] wilc1000: factor header length calculation into a new function David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 08/50] wilc1000: fix management packet type inconsistency David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 11/50] wilc1000: convert tqx_entries from "int" to "atomic_t" David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 22/50] wilc1000: minor syntax cleanup David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 20/50] wilc1000: eliminate "max_size_over" variable in fill_vmm_table David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 27/50] wilc1000: simplify ac_balance() a bit David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 13/50] wilc1000: sanitize config packet sequence number management " David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 31/50] wilc1000: eliminate another magic constant David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 07/50] wilc1000: increment tx_dropped stat counter on tx packet drop David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 18/50] wilc1000: split huge tx handler into subfunctions David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 24/50] wilc1000: protect tx_q_limit with a mutex instead of a spinlock David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 15/50] wilc1000: add struct wilc_skb_tx_cb as an alias of struct txq_entry_t David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 09/50] wilc1000: prepare wilc_wlan_tx_packet_done() for sk_buff changes David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 25/50] wilc1000: replace txq_spinlock with ack_filter_lock mutex David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 28/50] wilc1000: improve send_packets() a bit David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 12/50] wilc1000: refactor wilc_wlan_cfg_commit() " David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 17/50] wilc1000: remove no longer used "vif" argument from init_txq_entry() David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 10/50] wilc1000: factor initialization of tx queue-specific packet fields David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 06/50] wilc1000: move tx packet drop code into its own function David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 19/50] wilc1000: don't tell the chip to go to sleep while copying tx packets David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 33/50] wilc1000: move ac_desired_ratio calculation to where its needed David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 34/50] wilc1000: restructure wilc-wlan_handle_txq() for clarity David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 43/50] wilc1000: add support for zero-copy transmit of tx packets David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 40/50] wilc1000: introduce schedule_packets() function David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 35/50] wilc1000: introduce copy_and_send_packets() helper function David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 50/50] wilc1000: add module parameter "disable_zero_copy_tx" to SPI driver David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 48/50] wilc1000: introduce function to find and check DMA response David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 26/50] wilc1000: reduce amount of time ack_filter_lock is held David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 45/50] wilc1000: move struct wilc_spi declaration David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 32/50] wilc1000: introduce vmm_table_entry() helper function David Mosberger-Tang
2021-12-28 12:47 ` kernel test robot
2021-12-23 1:14 ` [PATCH v2 42/50] wilc1000: simplify code by adding header/padding to skb David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 49/50] wilc1000: implement zero-copy transmit support for SPI David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 39/50] wilc1000: eliminate txq_add_to_head_cs mutex David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 46/50] wilc1000: remove duplicate CRC calculation code David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 36/50] wilc1000: introduce transmit path chip queue David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 44/50] wilc1000: don't allocate tx_buffer when zero-copy is available David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 37/50] wilc1000: introduce set_header() function David Mosberger-Tang
2021-12-28 15:00 ` kernel test robot
2021-12-23 1:14 ` [PATCH v2 05/50] wilc1000: add wilc_wlan_tx_packet_done() function David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 41/50] wilc1000: use more descriptive variable name David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 38/50] wilc1000: take advantage of chip queue David Mosberger-Tang
2021-12-23 1:14 ` [PATCH v2 47/50] wilc1000: factor SPI DMA command initialization code into a function David Mosberger-Tang
2021-12-23 6:16 ` [PATCH v2 00/50] wilc1000: rework tx path to use sk_buffs throughout Ajay.Kathat
2021-12-23 6:41 ` Kalle Valo
2021-12-23 15:23 ` David Mosberger-Tang
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=20211223011358.4031459-2-davidm@egauge.net \
--to=davidm@egauge.net \
--cc=ajay.kathat@microchip.com \
--cc=claudiu.beznea@microchip.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®