From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: nbd@nbd.name, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com
Subject: Re: [PATCH] mt76: mt7915: simplify mt7915_mac_sta_poll routine
Date: Mon, 8 Mar 2021 11:08:55 +0100 [thread overview]
Message-ID: <YEX3t9lVlYhi4fYj@lore-desk> (raw)
In-Reply-To: <db48916a553fee715fc9c0c1f83f363a01218dff.1615139832.git.lorenzo@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1844 bytes --]
> Drop unnecessary lock around sta_poll_list list in mt7915_mac_sta_poll
> routine.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Hi Felix,
please let's drop this patch, as we discussed, there is a race on
list_del_init(&msta->poll_list).
Regards,
Lorenzo
> ---
> drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> index b3168dd3baed..cde98b86e2bb 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> @@ -117,23 +117,15 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
>
> rcu_read_lock();
>
> - while (true) {
> + while (!list_empty(&sta_poll_list)) {
> bool clear = false;
> u32 addr;
> - u16 idx;
>
> - spin_lock_bh(&dev->sta_poll_lock);
> - if (list_empty(&sta_poll_list)) {
> - spin_unlock_bh(&dev->sta_poll_lock);
> - break;
> - }
> msta = list_first_entry(&sta_poll_list,
> struct mt7915_sta, poll_list);
> list_del_init(&msta->poll_list);
> - spin_unlock_bh(&dev->sta_poll_lock);
>
> - idx = msta->wcid.idx;
> - addr = mt7915_mac_wtbl_lmac_addr(dev, idx) + 20 * 4;
> + addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx) + 20 * 4;
>
> for (i = 0; i < IEEE80211_NUM_ACS; i++) {
> u32 tx_last = msta->airtime_ac[i];
> @@ -152,7 +144,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
> }
>
> if (clear) {
> - mt7915_mac_wtbl_update(dev, idx,
> + mt7915_mac_wtbl_update(dev, msta->wcid.idx,
> MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
> memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac));
> }
> --
> 2.29.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2021-03-08 10:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-07 17:59 [PATCH] mt76: mt7915: simplify mt7915_mac_sta_poll routine Lorenzo Bianconi
2021-03-08 10:08 ` Lorenzo Bianconi [this message]
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=YEX3t9lVlYhi4fYj@lore-desk \
--to=lorenzo.bianconi@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.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