diff options
author | Brian Norris <briannorris@chromium.org> | 2019-06-25 10:40:45 -0700 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2019-06-27 19:50:58 +0300 |
commit | 8a7f9fd8a3e09c829c9fc2a86fe2d370ebcafd95 (patch) | |
tree | 7cfce9205e8212d1ab509e7c39342c418511e67c /drivers/net/wireless/marvell/mwifiex/11n.c | |
parent | ce2e942e32e851acdae05f9772f3b7a99f6a47cb (diff) |
mwifiex: don't disable hardirqs; just softirqs
main_proc_lock and int_lock (in mwifiex_adapter) are the only spinlocks
used in hardirq contexts. The rest are only in task or softirq contexts.
Convert every other lock from *_irq{save,restore}() variants to _bh()
variants.
This is a mechanical transformation of all spinlock usage in mwifiex
using the following:
Step 1:
I ran this nasty sed script:
sed -i -E '/spin_lock_irqsave|spin_unlock_irqrestore/ {
/main_proc_lock|int_lock/! {
s:(spin_(un|)lock)_irq(save|restore):\1_bh: ;
# Join broken lines.
:a /;$/! {
N;
s/\s*\n\s*//;
ba
}
/,.*\);$/ s:,.*\):\):
}
}' drivers/net/wireless/marvell/mwifiex/*
Step 2:
Manually delete the flags / ra_list_flags args from:
mwifiex_send_single_packet()
mwifiex_11n_aggregate_pkt()
mwifiex_send_processed_packet()
which are now unused.
Step 3:
Apply this semantic patch (coccinelle) to remove the unused 'flags'
variables:
// <smpl>
@@
type T;
identifier i;
@@
(
extern T i;
|
- T i;
... when != i
)
// </smpl>
(Usage is something like this:
make coccicheck COCCI=./patch.cocci MODE=patch M=drivers/net/wireless/marvell/mwifiex/
although this skips *.h files for some reasons, so I had to massage
stuff.)
Testing: I've played with a variety of stress tests, including download
stress tests on the same APs which caught regressions with commit
5188d5453bc9 ("mwifiex: restructure rx_reorder_tbl_lock usage"). I've
primarily tested on Marvell 8997 / PCIe, although I've given 8897 / SDIO
a quick spin as well.
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/marvell/mwifiex/11n.c')
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/11n.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c index 5d75c971004b..e435f801bc91 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n.c +++ b/drivers/net/wireless/marvell/mwifiex/11n.c @@ -84,17 +84,15 @@ mwifiex_get_ba_status(struct mwifiex_private *priv, enum mwifiex_ba_status ba_status) { struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl; - unsigned long flags; - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); + spin_lock_bh(&priv->tx_ba_stream_tbl_lock); list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) { if (tx_ba_tsr_tbl->ba_status == ba_status) { - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, - flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); return tx_ba_tsr_tbl; } } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); return NULL; } @@ -516,13 +514,12 @@ void mwifiex_11n_delete_all_tx_ba_stream_tbl(struct mwifiex_private *priv) { int i; struct mwifiex_tx_ba_stream_tbl *del_tbl_ptr, *tmp_node; - unsigned long flags; - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); + spin_lock_bh(&priv->tx_ba_stream_tbl_lock); list_for_each_entry_safe(del_tbl_ptr, tmp_node, &priv->tx_ba_stream_tbl_ptr, list) mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, del_tbl_ptr); - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); INIT_LIST_HEAD(&priv->tx_ba_stream_tbl_ptr); @@ -539,18 +536,16 @@ struct mwifiex_tx_ba_stream_tbl * mwifiex_get_ba_tbl(struct mwifiex_private *priv, int tid, u8 *ra) { struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl; - unsigned long flags; - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); + spin_lock_bh(&priv->tx_ba_stream_tbl_lock); list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) { if (ether_addr_equal_unaligned(tx_ba_tsr_tbl->ra, ra) && tx_ba_tsr_tbl->tid == tid) { - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, - flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); return tx_ba_tsr_tbl; } } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); return NULL; } @@ -563,7 +558,6 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, { struct mwifiex_tx_ba_stream_tbl *new_node; struct mwifiex_ra_list_tbl *ra_list; - unsigned long flags; int tid_down; if (!mwifiex_get_ba_tbl(priv, tid, ra)) { @@ -584,9 +578,9 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, new_node->ba_status = ba_status; memcpy(new_node->ra, ra, ETH_ALEN); - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); + spin_lock_bh(&priv->tx_ba_stream_tbl_lock); list_add_tail(&new_node->list, &priv->tx_ba_stream_tbl_ptr); - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); } } @@ -599,7 +593,6 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac) u32 tx_win_size = priv->add_ba_param.tx_win_size; static u8 dialog_tok; int ret; - unsigned long flags; u16 block_ack_param_set; mwifiex_dbg(priv->adapter, CMD, "cmd: %s: tid %d\n", __func__, tid); @@ -612,10 +605,10 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac) memcmp(priv->cfg_bssid, peer_mac, ETH_ALEN)) { struct mwifiex_sta_node *sta_ptr; - spin_lock_irqsave(&priv->sta_list_spinlock, flags); + spin_lock_bh(&priv->sta_list_spinlock); sta_ptr = mwifiex_get_sta_entry(priv, peer_mac); if (!sta_ptr) { - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_dbg(priv->adapter, ERROR, "BA setup with unknown TDLS peer %pM!\n", peer_mac); @@ -623,7 +616,7 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac) } if (sta_ptr->is_11ac_enabled) tx_win_size = MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE; - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); } block_ack_param_set = (u16)((tid << BLOCKACKPARAM_TID_POS) | @@ -687,9 +680,8 @@ int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac, void mwifiex_11n_delba(struct mwifiex_private *priv, int tid) { struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr; - unsigned long flags; - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); + spin_lock_bh(&priv->rx_reorder_tbl_lock); list_for_each_entry(rx_reor_tbl_ptr, &priv->rx_reorder_tbl_ptr, list) { if (rx_reor_tbl_ptr->tid == tid) { dev_dbg(priv->adapter->dev, @@ -700,7 +692,7 @@ void mwifiex_11n_delba(struct mwifiex_private *priv, int tid) } } exit: - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); + spin_unlock_bh(&priv->rx_reorder_tbl_lock); } /* @@ -729,9 +721,8 @@ int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv, struct mwifiex_ds_rx_reorder_tbl *rx_reo_tbl = buf; struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr; int count = 0; - unsigned long flags; - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); + spin_lock_bh(&priv->rx_reorder_tbl_lock); list_for_each_entry(rx_reorder_tbl_ptr, &priv->rx_reorder_tbl_ptr, list) { rx_reo_tbl->tid = (u16) rx_reorder_tbl_ptr->tid; @@ -750,7 +741,7 @@ int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv, if (count >= MWIFIEX_MAX_RX_BASTREAM_SUPPORTED) break; } - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); + spin_unlock_bh(&priv->rx_reorder_tbl_lock); return count; } @@ -764,9 +755,8 @@ int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv, struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl; struct mwifiex_ds_tx_ba_stream_tbl *rx_reo_tbl = buf; int count = 0; - unsigned long flags; - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); + spin_lock_bh(&priv->tx_ba_stream_tbl_lock); list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) { rx_reo_tbl->tid = (u16) tx_ba_tsr_tbl->tid; mwifiex_dbg(priv->adapter, DATA, "data: %s tid=%d\n", @@ -778,7 +768,7 @@ int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv, if (count >= MWIFIEX_MAX_TX_BASTREAM_SUPPORTED) break; } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); return count; } @@ -790,16 +780,15 @@ int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv, void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra) { struct mwifiex_tx_ba_stream_tbl *tbl, *tmp; - unsigned long flags; if (!ra) return; - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); + spin_lock_bh(&priv->tx_ba_stream_tbl_lock); list_for_each_entry_safe(tbl, tmp, &priv->tx_ba_stream_tbl_ptr, list) if (!memcmp(tbl->ra, ra, ETH_ALEN)) mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, tbl); - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); + spin_unlock_bh(&priv->tx_ba_stream_tbl_lock); return; } |