From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 4/6] mt76: store software PN/IV in wcid
Date: Mon, 18 Mar 2019 11:21:35 +0100 [thread overview]
Message-ID: <20190318102134.GC3323@redhat.com> (raw)
In-Reply-To: <20190316204242.73560-4-nbd@nbd.name>
On Sat, Mar 16, 2019 at 09:42:40PM +0100, Felix Fietkau wrote:
> Avoids expensive 64-bit atomic access in the data path
<snip>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
> index d6e260ca1423..fb1961ac9dc6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
> @@ -924,7 +924,11 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi,
> txwi[3] = cpu_to_le32(val);
>
> if (key) {
> - u64 pn = atomic64_inc_return(&key->tx_pn);
> + u64 pn;
> +
> + spin_lock(&dev->mt76.lock);
> + pn = ++wcid->tx_pn;
> + spin_unlock(&dev->mt76.lock);
It's interesting that atomic op is more expensive that taking spinlock
and do the operation under spinlock protection. This should not be
the case, atomic ops are provided exactly to avoid locking and should
be faster than spin_lock. Perhaps on architecture where this happen
(presumably MIPS 32bit) either atomic ops assembly code should be fixed
or arch should switch generic lib/atomic64.c .
Stanislaw
next prev parent reply other threads:[~2019-03-18 10:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-16 20:42 [PATCH 1/6] mt76: use mac80211 txq scheduling Felix Fietkau
2019-03-16 20:42 ` [PATCH 2/6] mt76: reduce locking in mt76_dma_tx_cleanup Felix Fietkau
2019-03-16 20:42 ` [PATCH 3/6] mt76: store wcid tx rate info in one u32 reduce locking Felix Fietkau
2019-03-16 20:42 ` [PATCH 4/6] mt76: store software PN/IV in wcid Felix Fietkau
2019-03-18 10:21 ` Stanislaw Gruszka [this message]
2019-03-18 10:37 ` Felix Fietkau
2019-03-16 20:42 ` [PATCH 5/6] mt76: move tx tasklet to struct mt76_dev Felix Fietkau
2019-03-16 20:42 ` [PATCH 6/6] mt76: only schedule txqs from the tx tasklet Felix Fietkau
2019-03-16 22:28 ` [PATCH 1/6] mt76: use mac80211 txq scheduling Toke Høiland-Jørgensen
2019-03-17 10:44 ` Felix Fietkau
2019-03-17 11:32 ` Toke Høiland-Jørgensen
2019-03-17 12:32 ` Felix Fietkau
2019-03-17 21:59 ` Toke Høiland-Jørgensen
2019-03-18 20:08 ` Felix Fietkau
2019-03-18 22:14 ` Toke Høiland-Jørgensen
2019-03-18 22:37 ` Felix Fietkau
2019-03-18 23:05 ` Toke Høiland-Jørgensen
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=20190318102134.GC3323@redhat.com \
--to=sgruszka@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
/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 NNTP newsgroup(s).