diff options
author | Brian Norris <briannorris@chromium.org> | 2019-06-25 20:40:45 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2019-06-27 19:50:58 +0300 |
commit | 8a7f9fd8a3e09c829c9fc2a86fe2d370ebcafd95 (patch) | |
tree | 7cfce9205e8212d1ab509e7c39342c418511e67c /drivers/net/wireless/marvell/mwifiex/cfg80211.c | |
parent | ce2e942e32e851acdae05f9772f3b7a99f6a47cb (diff) | |
download | linux-8a7f9fd8a3e09c829c9fc2a86fe2d370ebcafd95.tar.xz |
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/cfg80211.c')
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/cfg80211.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 5a7cdb981789..d89684168500 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -876,13 +876,13 @@ static int mwifiex_deinit_priv_params(struct mwifiex_private *priv) spin_unlock_irqrestore(&adapter->main_proc_lock, flags); } - spin_lock_irqsave(&adapter->rx_proc_lock, flags); + spin_lock_bh(&adapter->rx_proc_lock); adapter->rx_locked = true; if (adapter->rx_processing) { - spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); + spin_unlock_bh(&adapter->rx_proc_lock); flush_workqueue(adapter->rx_workqueue); } else { - spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); + spin_unlock_bh(&adapter->rx_proc_lock); } mwifiex_free_priv(priv); @@ -934,9 +934,9 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv, adapter->main_locked = false; spin_unlock_irqrestore(&adapter->main_proc_lock, flags); - spin_lock_irqsave(&adapter->rx_proc_lock, flags); + spin_lock_bh(&adapter->rx_proc_lock); adapter->rx_locked = false; - spin_unlock_irqrestore(&adapter->rx_proc_lock, flags); + spin_unlock_bh(&adapter->rx_proc_lock); mwifiex_set_mac_address(priv, dev, false, NULL); @@ -1827,7 +1827,6 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_sta_node *sta_node; u8 deauth_mac[ETH_ALEN]; - unsigned long flags; if (!priv->bss_started && priv->wdev.cac_started) { mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); @@ -1845,11 +1844,11 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, eth_zero_addr(deauth_mac); - spin_lock_irqsave(&priv->sta_list_spinlock, flags); + spin_lock_bh(&priv->sta_list_spinlock); sta_node = mwifiex_get_sta_entry(priv, params->mac); if (sta_node) ether_addr_copy(deauth_mac, params->mac); - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); if (is_valid_ether_addr(deauth_mac)) { if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH, @@ -3852,15 +3851,14 @@ mwifiex_cfg80211_tdls_chan_switch(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_chan_def *chandef) { struct mwifiex_sta_node *sta_ptr; - unsigned long flags; u16 chan; u8 second_chan_offset, band; struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - spin_lock_irqsave(&priv->sta_list_spinlock, flags); + spin_lock_bh(&priv->sta_list_spinlock); sta_ptr = mwifiex_get_sta_entry(priv, addr); if (!sta_ptr) { - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); wiphy_err(wiphy, "%s: Invalid TDLS peer %pM\n", __func__, addr); return -ENOENT; @@ -3868,18 +3866,18 @@ mwifiex_cfg80211_tdls_chan_switch(struct wiphy *wiphy, struct net_device *dev, if (!(sta_ptr->tdls_cap.extcap.ext_capab[3] & WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH)) { - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); wiphy_err(wiphy, "%pM do not support tdls cs\n", addr); return -ENOENT; } if (sta_ptr->tdls_status == TDLS_CHAN_SWITCHING || sta_ptr->tdls_status == TDLS_IN_OFF_CHAN) { - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); wiphy_err(wiphy, "channel switch is running, abort request\n"); return -EALREADY; } - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); chan = chandef->chan->hw_value; second_chan_offset = mwifiex_get_sec_chan_offset(chan); @@ -3895,23 +3893,22 @@ mwifiex_cfg80211_tdls_cancel_chan_switch(struct wiphy *wiphy, const u8 *addr) { struct mwifiex_sta_node *sta_ptr; - unsigned long flags; struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - spin_lock_irqsave(&priv->sta_list_spinlock, flags); + spin_lock_bh(&priv->sta_list_spinlock); sta_ptr = mwifiex_get_sta_entry(priv, addr); if (!sta_ptr) { - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); wiphy_err(wiphy, "%s: Invalid TDLS peer %pM\n", __func__, addr); } else if (!(sta_ptr->tdls_status == TDLS_CHAN_SWITCHING || sta_ptr->tdls_status == TDLS_IN_BASE_CHAN || sta_ptr->tdls_status == TDLS_IN_OFF_CHAN)) { - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); wiphy_err(wiphy, "tdls chan switch not initialize by %pM\n", addr); } else { - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); + spin_unlock_bh(&priv->sta_list_spinlock); mwifiex_stop_tdls_cs(priv, addr); } } |