mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shengyu Qu <wiagn233@outlook.com>
To: Ping-Ke Shih <pkshih@realtek.com>, "nbd@nbd.name" <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>,
	"nicolas.cavallari@green-communications.fr"
	<nicolas.cavallari@green-communications.fr>,
	"howard-yh.hsu@mediatek.com" <howard-yh.hsu@mediatek.com>,
	"greearb@candelatech.com" <greearb@candelatech.com>,
	"christophe.jaillet@wanadoo.fr" <christophe.jaillet@wanadoo.fr>,
	"benjamin-jw.lin@mediatek.com" <benjamin-jw.lin@mediatek.com>,
	"mingyen.hsieh@mediatek.com" <mingyen.hsieh@mediatek.com>,
	"quic_adisi@quicinc.com" <quic_adisi@quicinc.com>,
	"deren.wu@mediatek.com" <deren.wu@mediatek.com>,
	"chui-hao.chiu@mediatek.com" <chui-hao.chiu@mediatek.com>,
	"gustavoars@kernel.org" <gustavoars@kernel.org>,
	"bo.jiao@mediatek.com" <bo.jiao@mediatek.com>,
	"sujuan.chen@mediatek.com" <sujuan.chen@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>
Cc: wiagn233@outlook.com
Subject: Re: [PATCH v8] wifi: mt76: mt7915: add wds support when wed is enabled
Date: Fri, 7 Mar 2025 02:07:42 +0800	[thread overview]
Message-ID: <TYCPR01MB8437874842FE7A17EB4D856598CA2@TYCPR01MB8437.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <c56c9714c754451a8255ece79353da2b@realtek.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 2702 bytes --]

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@outlook.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);
>>   }
>>
> 
> [...]
> 


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 6977 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

      reply	other threads:[~2025-03-06 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 11:09 Shengyu Qu
2025-03-06  2:27 ` Ping-Ke Shih
2025-03-06 18:07   ` Shengyu Qu [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=TYCPR01MB8437874842FE7A17EB4D856598CA2@TYCPR01MB8437.jpnprd01.prod.outlook.com \
    --to=wiagn233@outlook.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin-jw.lin@mediatek.com \
    --cc=bo.jiao@mediatek.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=chui-hao.chiu@mediatek.com \
    --cc=deren.wu@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=nicolas.cavallari@green-communications.fr \
    --cc=pkshih@realtek.com \
    --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 \
    /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

all inboxes | Powered by JetHome®