From: Baochen Qiang <quic_bqiang@quicinc.com>
To: Kalle Valo <kvalo@kernel.org>
Cc: <ath12k@lists.infradead.org>, <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 1/8] wifi: ath12k: Add MLO station state change handling
Date: Thu, 21 Nov 2024 11:35:30 +0800 [thread overview]
Message-ID: <d7a0d62c-4723-4e9f-a362-2ea51aaba3ed@quicinc.com> (raw)
In-Reply-To: <87bjy9zonx.fsf@kernel.org>
On 11/21/2024 3:32 AM, Kalle Valo wrote:
> Baochen Qiang <quic_bqiang@quicinc.com> writes:
>
>>>>> +static void ath12k_mac_free_unassign_link_sta(struct ath12k_hw *ah,
>>>>> + struct ath12k_sta *ahsta,
>>>>> + u8 link_id)
>>>>> +{
>>>>> + struct ath12k_link_sta *arsta;
>>>>> +
>>>>> + lockdep_assert_wiphy(ah->hw->wiphy);
>>>>> +
>>>>> + if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS))
>>>>> + return;
>>>>> +
>>>>> + arsta = wiphy_dereference(ah->hw->wiphy, ahsta->link[link_id]);
>>>>> +
>>>>> + if (WARN_ON(!arsta))
>>>>> + return;
>>>>> +
>>>>> + ath12k_mac_unassign_link_sta(ah, ahsta, link_id);
>>>>> +
>>>>> + arsta->link_id = ATH12K_INVALID_LINK_ID;
>>>>> + arsta->ahsta = NULL;
>>>>> + arsta->arvif = NULL;
>>>>
>>>> if arsta is not deflink and would be freed, can we avoid these
>>>> cleanup?
>>>
>>> I think that's something we can cleanup later if needed. Sure, it's
>>> extra assignments but it's not really doing any harm.
>> exactly, but ideally we should avoid unnecessary effort if possible.
>>
>>>
>>>>> + if (arsta != &ahsta->deflink)
>>>>> + kfree(arsta);
>>>>
>>>> I know the actual free happens here, but why split them?
>>>
>>> You mean why have a separate function ath12k_mac_unassign_link_sta() and
>>> instead just have all code the in
>>> ath12k_mac_free_unassign_link_sta()?
>>
>> yes. such that we can have synchronize_rcu() and kfree() located together.
>
> Ok, I think I now get what you mean. Does this look better:
>
> static void ath12k_mac_free_unassign_link_sta(struct ath12k_hw *ah,
> struct ath12k_sta *ahsta,
> u8 link_id)
> {
> struct ath12k_link_sta *arsta;
>
> lockdep_assert_wiphy(ah->hw->wiphy);
>
> if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS))
> return;
>
> arsta = wiphy_dereference(ah->hw->wiphy, ahsta->link[link_id]);
> if (WARN_ON(!arsta))
> return;
>
> ahsta->links_map &= ~BIT(link_id);
> rcu_assign_pointer(ahsta->link[link_id], NULL);
below synchronize_rcu() should be moved to here, such that any change to arsta can happen only AFTER all existing RCU readers finish accessing it.
>
> if (arsta == &ahsta->deflink) {
> arsta->link_id = ATH12K_INVALID_LINK_ID;
> arsta->ahsta = NULL;
> arsta->arvif = NULL;
> return;
> }
>
> synchronize_rcu();
> kfree(arsta);
> }
other than that this change looks good to me.
>
> BTW your lines are really long, please check your settings:
sure, will check.
>
> https://patchwork.kernel.org/project/linux-wireless/patch/20241106142617.660901-2-kvalo@kernel.org/
>
next prev parent reply other threads:[~2024-11-21 3:35 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 14:26 [PATCH 0/8] [0/8] wifi: ath12k: MLO support part 3 Kalle Valo
2024-11-06 14:26 ` [PATCH 1/8] wifi: ath12k: Add MLO station state change handling Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
2024-11-07 2:26 ` Baochen Qiang
2024-11-12 16:03 ` Kalle Valo
2024-11-13 2:33 ` Baochen Qiang
2024-11-20 15:57 ` Kalle Valo
2024-11-07 2:45 ` Baochen Qiang
2024-11-12 17:10 ` Kalle Valo
2024-11-13 2:55 ` Baochen Qiang
2024-11-20 19:32 ` Kalle Valo
2024-11-21 3:35 ` Baochen Qiang [this message]
2024-11-21 14:51 ` Kalle Valo
2024-11-06 14:26 ` [PATCH 2/8] wifi: ath12k: support change_sta_links() mac80211 op Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
2024-11-07 7:14 ` Baochen Qiang
2024-11-12 16:55 ` Kalle Valo
2024-11-12 17:11 ` Kalle Valo
2024-11-06 14:26 ` [PATCH 3/8] wifi: ath12k: add primary link for data path operations Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
2024-11-06 14:26 ` [PATCH 4/8] wifi: ath12k: use arsta instead of sta Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
2024-11-06 14:26 ` [PATCH 5/8] wifi: ath12k: add reo queue lookup table for ML peers Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
2024-11-06 14:26 ` [PATCH 6/8] wifi: ath12k: modify chanctx iterators for MLO Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
2024-11-06 14:26 ` [PATCH 7/8] wifi: ath12k: Use mac80211 vif's link_conf instead of bss_conf Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
2024-11-06 14:26 ` [PATCH 8/8] wifi: ath12k: Use mac80211 sta's link_sta instead of deflink Kalle Valo
2024-11-06 16:33 ` Jeff Johnson
-- strict thread matches above, loose matches on Subject: below --
2024-11-21 15:57 [PATCH 0/8] [0/8] wifi: ath12k: MLO support part 3 Kalle Valo
2024-11-21 15:57 ` [PATCH 1/8] wifi: ath12k: Add MLO station state change handling Kalle Valo
2024-11-25 17:03 ` Kalle Valo
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=d7a0d62c-4723-4e9f-a362-2ea51aaba3ed@quicinc.com \
--to=quic_bqiang@quicinc.com \
--cc=ath12k@lists.infradead.org \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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