Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: Sujuan Chen <sujuan.chen@mediatek.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Evelyn Tsai <evelyn.tsai@mediatek.com>,
	Bo Jiao <bo.jiao@mediatek.com>,
	Haitao Shang <haitao.shang@mediatek.com>,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH,v2] wifi: mt76: mt7915: add wds support when wed is enabled
Date: Fri, 9 Dec 2022 13:32:24 +0100	[thread overview]
Message-ID: <c4f01e3e-4ae6-3d60-4fd0-b8d8bc5f4573@nbd.name> (raw)
In-Reply-To: <e603722d58079af98c57a3dc117274d824d1d832.1669798063.git.sujuan.chen@mediatek.com>

On 30.11.22 10:18, Sujuan Chen wrote:
> The current WED only supports 256 wcid, whereas mt7986 can support up to 512 entries,
> so firmware provides a rule to get sta_info by DA when wcid is set to 0x3ff by txd.
> Also, WED provides a register to overwrite txd wcid, that is, wcid[9:8] can
> be overwritten by 0x3 and wcid[7:0] is set to 0xff by host driver.
> 
> However, firmware is unable to get sta_info from DA as DA != RA for 4addr cases,
> so firmware and wifi host driver both use wcid (256 - 271) and (768 ~ 783)
> for sync up to get correct sta_info
> 
> Tested-by: Sujuan Chen <sujuan.chen@mediatek.com>
> Co-developed-by: Bo Jiao <bo.jiao@mediatek.com>
> Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
> Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
> ---
> v2:
>   - drop duplicate settings
>   - reduce the patch size by redefining mt76_wcid_alloc
> ---
>   drivers/net/wireless/mediatek/mt76/mt76.h     |  6 +++
>   .../net/wireless/mediatek/mt76/mt7915/main.c  | 24 +++++++++--
>   .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 13 +++++-
>   .../net/wireless/mediatek/mt76/mt7915/mcu.h   |  1 +
>   drivers/net/wireless/mediatek/mt76/util.c     | 40 +++++++++++++++++--
>   drivers/net/wireless/mediatek/mt76/util.h     |  7 +++-
>   6 files changed, 82 insertions(+), 9 deletions(-)
> 

> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> index c40b6098f19a..46a9e4f0396e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> @@ -1115,6 +1122,13 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
>   	else
>   		clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
>   
> +	if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
> +	    !is_mt7915(&dev->mt76)) {
> +		mt7915_sta_remove(hw, vif, sta);
> +		mt76_sta_pre_rcu_remove(hw, vif, sta);
> +		mt7915_sta_add(hw, vif, sta);
> +	}
> +
>   	mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
>   }
>   
I suspect that this may a bit racy if there is concurrent tx activity 
(e.g. for EAP auth). Not sure if this could cause problems for the 
firmware or other kinds of bugs.

While my idea may need some rework of the existing functions, I think a 
better flow would be:

1. mt76_sta_pre_rcu_remove
2. save old wcid
3. mt7915_sta_add
4. synchronize_rcu()
5. remove firmware state for old wcid entry

- Felix


  reply	other threads:[~2022-12-09 12:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30  9:18 [PATCH,v2] wifi: mt76: mt7915: add wds support when wed is enabled Sujuan Chen
2022-12-09 12:32 ` Felix Fietkau [this message]
2022-12-13  1:57   ` Sujuan Chen (陈素娟)
2022-12-20  4:26   ` Sujuan Chen (陈素娟)

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=c4f01e3e-4ae6-3d60-4fd0-b8d8bc5f4573@nbd.name \
    --to=nbd@nbd.name \
    --cc=bo.jiao@mediatek.com \
    --cc=evelyn.tsai@mediatek.com \
    --cc=haitao.shang@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=ryder.lee@mediatek.com \
    --cc=sujuan.chen@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