From: Ping-Ke Shih <pkshih@realtek.com>
To: Shengyu Qu <wiagn233@outlook.com>, Felix Fietkau <nbd@nbd.name>,
"lorenzo@kernel.org" <lorenzo@kernel.org>,
"ryder.lee@mediatek.com" <ryder.lee@mediatek.com>,
"shayne.chen@mediatek.com" <shayne.chen@mediatek.com>,
"sean.wang@mediatek.com" <sean.wang@mediatek.com>,
"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>,
"miriam.rachel.korenblit@intel.com"
<miriam.rachel.korenblit@intel.com>,
"howard-yh.hsu@mediatek.com" <howard-yh.hsu@mediatek.com>,
"greearb@candelatech.com" <greearb@candelatech.com>,
"chui-hao.chiu@mediatek.com" <chui-hao.chiu@mediatek.com>,
"mingyen.hsieh@mediatek.com" <mingyen.hsieh@mediatek.com>,
"quic_adisi@quicinc.com" <quic_adisi@quicinc.com>,
"sujuan.chen@mediatek.com" <sujuan.chen@mediatek.com>,
"gustavoars@kernel.org" <gustavoars@kernel.org>,
"bo.jiao@mediatek.com" <bo.jiao@mediatek.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>
Subject: RE: [PATCH v9 RESEND] wifi: mt76: mt7915: add wds support when wed is enabled
Date: Tue, 11 Mar 2025 00:47:57 +0000 [thread overview]
Message-ID: <349d0fbe197a40068377e889a2311cb2@realtek.com> (raw)
In-Reply-To: <OSZPR01MB84345D44294ACA75A863ED6B98D62@OSZPR01MB8434.jpnprd01.prod.outlook.com>
Shengyu Qu <wiagn233@outlook.com> wrote:
> Hello,
>
> I modified the patch as you two adviced. If you think it's ok, please
> tell me and I'll send a v10 patch.
>
> Modified patch is attached below.
Since you want people review whole patch, why not just sending v10?
>
> Best regards,
> Shengyu
>
> ---
> drivers/net/wireless/mediatek/mt76/mt76.h | 15 ++++++
> .../net/wireless/mediatek/mt76/mt7915/main.c | 53 +++++++++++++++++--
> .../net/wireless/mediatek/mt76/mt7915/mcu.c | 18 +++++--
> .../net/wireless/mediatek/mt76/mt7915/mcu.h | 1 +
> drivers/net/wireless/mediatek/mt76/util.c | 37 +++++++++++--
> drivers/net/wireless/mediatek/mt76/util.h | 2 +-
> 6 files changed, 115 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
> index 132148f7b107..bd943b8b20bc 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> @@ -28,6 +28,9 @@
>
> #define MT76_TOKEN_FREE_THR 64
>
> +#define MT76_WED_WDS_MIN 256
> +#define MT76_WED_WDS_MAX 272
> +
> #define MT_QFLAG_WED_RING GENMASK(1, 0)
> #define MT_QFLAG_WED_TYPE GENMASK(4, 2)
> #define MT_QFLAG_WED BIT(5)
> @@ -73,6 +76,12 @@ enum mt76_wed_type {
> MT76_WED_RRO_Q_IND,
> };
>
> +enum mt76_wed_state {
> + MT76_WED_DEFAULT,
> + MT76_WED_ACTIVE,
> + MT76_WED_WDS_ACTIVE,
> +};
> +
> struct mt76_bus_ops {
> u32 (*rr)(struct mt76_dev *dev, u32 offset);
> void (*wr)(struct mt76_dev *dev, u32 offset, u32 val);
> @@ -1165,6 +1174,12 @@ void mt76_wed_dma_reset(struct mt76_dev *dev);
> int mt76_wed_net_setup_tc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> struct net_device *netdev, enum tc_setup_type type,
> void *type_data);
> +
> +static inline int mt76_wcid_alloc(u32 *mask, int size)
> +{
> + return __mt76_wcid_alloc(mask, size, MT76_WED_DEFAULT);
> +}
> +
> #ifdef CONFIG_NET_MEDIATEK_SOC_WED
> u32 mt76_wed_init_rx_buf(struct mtk_wed_device *wed, int size);
> int mt76_wed_offload_enable(struct mtk_wed_device *wed);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> index 3aa31c5cefa6..07c2ce518d97 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> @@ -745,8 +745,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
> struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
> bool ext_phy = mvif->phy != &dev->phy;
> int idx;
> + u8 flags = MT76_WED_DEFAULT;
In reverse X'mas tree order.
>
> - idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
> + if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
> + !is_mt7915(&dev->mt76)) {
> + flags = test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags) ?
> + MT76_WED_WDS_ACTIVE : MT76_WED_ACTIVE;
> + }
> +
> + idx = __mt76_wcid_alloc(mdev->wcid_mask, MT7915_WTBL_STA, flags);
> if (idx < 0)
> return -ENOSPC;
>
[...]
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 9d790f234e82..191f966c3f32 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -2385,10 +2385,20 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
>
> mt76_connac_mcu_del_wtbl_all(&dev->mt76);
>
> - if ((mtk_wed_device_active(&dev->mt76.mmio.wed) &&
> - is_mt7915(&dev->mt76)) ||
> - !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed))
> - mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
> +#if IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED)
In MT76, there are two styles:
#if IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED)
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
I think both are correct. Just wonder why not making them consistent.
> + if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
> + if (is_mt7915(&dev->mt76) ||
> + !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed))
> + ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
> + 0, 0, 0);
> + else
> + ret = mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
> + MCU_WA_PARAM_WED_VERSION,
> + dev->mt76.mmio.wed.rev_id, 0);
> + if (ret)
> + return ret;
> + }
> +#endif
>
> ret = mt7915_mcu_set_mwds(dev, 1);
> if (ret)
next prev parent reply other threads:[~2025-03-11 0:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-08 15:35 [PATCH v9 RESEND] wifi: mt76: mt7915: add wds support when wed is enabled Shengyu Qu
2025-03-10 0:33 ` Ping-Ke Shih
2025-03-10 10:33 ` Shengyu Qu
2025-03-10 10:41 ` Felix Fietkau
2025-03-10 12:41 ` Shengyu Qu
2025-03-11 0:47 ` Ping-Ke Shih [this message]
2025-03-11 5:14 ` Shengyu Qu
2025-03-11 8:29 ` Ping-Ke Shih
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=349d0fbe197a40068377e889a2311cb2@realtek.com \
--to=pkshih@realtek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bo.jiao@mediatek.com \
--cc=chui-hao.chiu@mediatek.com \
--cc=greearb@candelatech.com \
--cc=gustavoars@kernel.org \
--cc=howard-yh.hsu@mediatek.com \
--cc=johannes@sipsolutions.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=mingyen.hsieh@mediatek.com \
--cc=miriam.rachel.korenblit@intel.com \
--cc=nbd@nbd.name \
--cc=quic_adisi@quicinc.com \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
--cc=sujuan.chen@mediatek.com \
--cc=wiagn233@outlook.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