[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<TYCPR01MB8437874842FE7A17EB4D856598CA2@TYCPR01MB8437.jpnprd01.prod.outlook.com>
Date: Fri, 7 Mar 2025 02:07:42 +0800
From: Shengyu Qu <wiagn233@...look.com>
To: Ping-Ke Shih <pkshih@...ltek.com>, "nbd@....name" <nbd@....name>,
"lorenzo@...nel.org" <lorenzo@...nel.org>,
"ryder.lee@...iatek.com" <ryder.lee@...iatek.com>,
"shayne.chen@...iatek.com" <shayne.chen@...iatek.com>,
"sean.wang@...iatek.com" <sean.wang@...iatek.com>,
"johannes@...solutions.net" <johannes@...solutions.net>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>,
"miriam.rachel.korenblit@...el.com" <miriam.rachel.korenblit@...el.com>,
"nicolas.cavallari@...en-communications.fr"
<nicolas.cavallari@...en-communications.fr>,
"howard-yh.hsu@...iatek.com" <howard-yh.hsu@...iatek.com>,
"greearb@...delatech.com" <greearb@...delatech.com>,
"christophe.jaillet@...adoo.fr" <christophe.jaillet@...adoo.fr>,
"benjamin-jw.lin@...iatek.com" <benjamin-jw.lin@...iatek.com>,
"mingyen.hsieh@...iatek.com" <mingyen.hsieh@...iatek.com>,
"quic_adisi@...cinc.com" <quic_adisi@...cinc.com>,
"deren.wu@...iatek.com" <deren.wu@...iatek.com>,
"chui-hao.chiu@...iatek.com" <chui-hao.chiu@...iatek.com>,
"gustavoars@...nel.org" <gustavoars@...nel.org>,
"bo.jiao@...iatek.com" <bo.jiao@...iatek.com>,
"sujuan.chen@...iatek.com" <sujuan.chen@...iatek.com>,
"linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>
Cc: wiagn233@...look.com
Subject: Re: [PATCH v8] wifi: mt76: mt7915: add wds support when wed is
enabled
Hi,
Thanks for reply. I'll change the code in next version.
Best regards,
Shengyu
在 2025/3/6 10:27, Ping-Ke Shih 写道:
> Shengyu Qu <wiagn233@...look.com> wrote:
>
> [...]
>
>> @@ -1271,6 +1278,10 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
>> {
>> struct mt7915_dev *dev = mt7915_hw_dev(hw);
>> struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
>> + int min = MT76_WED_WDS_MIN, max = MT76_WED_WDS_MAX;
>> + struct ieee80211_sta *pre_sta;
>> + u8 flags = MT76_WED_DEFAULT;
>> + int temp_idx;
>
> In general 'temp' is short for temperature. 'tmp' is preferred.
>
>>
>> if (enabled)
>> set_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
>> @@ -1280,6 +1291,30 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
>> if (!msta->wcid.sta)
>> return;
>>
>> + if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
>> + !is_mt7915(&dev->mt76) &&
>> + (msta->wcid.idx < min || msta->wcid.idx > max - 1)) {
>> + pre_sta = kzalloc(sizeof(*sta) + sizeof(*msta), GFP_KERNEL);
>> + memmove(pre_sta, sta, sizeof(*sta) + sizeof(*msta));
>
> Seemingly, kmemdup() = kzalloc() + memmove().
>
>> +
>> + flags = test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags) ?
>> + MT76_WED_WDS_ACTIVE : MT76_WED_ACTIVE;
>> +
>> + temp_idx = __mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA, flags);
>
> Since __mt76_wcid_alloc() could return -1 for error case, shouldn't you handle that?
>
>> + ((struct mt7915_sta *)pre_sta->drv_priv)->wcid.idx = (u16)temp_idx;
>
> Define a local `struct mt7915_sta *pre_msta = (struct mt7915_sta *)pre_sta->drv_priv`
> ahead. This statement would be simpler. Just `pre_msta-> wcid.idx = (u16)temp_idx`,
> but casting of '(u16)' is still not very preferred.
>
>> + mt7915_mac_sta_add(&dev->mt76, vif, pre_sta);
>> + rcu_assign_pointer(dev->mt76.wcid[temp_idx], &msta->wcid);
>> +
>> + temp_idx = msta->wcid.idx;
>> + msta->wcid.idx = ((struct mt7915_sta *)pre_sta->drv_priv)->wcid.idx;
>> + ((struct mt7915_sta *)pre_sta->drv_priv)->wcid.idx = (u16)temp_idx;
>> + rcu_assign_pointer(dev->mt76.wcid[temp_idx], NULL);
>> +
>> + synchronize_rcu();
>> + mt7915_mac_sta_remove(&dev->mt76, vif, pre_sta);
>> + kfree(pre_sta);
>> + }
>> +
>> mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
>> }
>>
>
> [...]
>
Download attachment "OpenPGP_0xE3520CC91929C8E7.asc" of type "application/pgp-keys" (6869 bytes)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists