Linux wireless drivers development
 help / color / mirror / Atom feed
From: Wen Gong <quic_wgong@quicinc.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	<linux-wireless@vger.kernel.org>
Cc: <ath11k@lists.infradead.org>
Subject: Re: [PATCH 10/27] wifi: mac80211: isolate driver from inactive links
Date: Fri, 9 Sep 2022 16:38:34 +0800	[thread overview]
Message-ID: <e036ea72-10b1-1d4c-023b-c7d248a72b86@quicinc.com> (raw)
In-Reply-To: <545227cf18baac94ea8aa24dc08b250c47949541.camel@sipsolutions.net>

On 9/9/2022 3:28 PM, Johannes Berg wrote:
> Hi,
>
>>> No, they aren't, and shouldn't be.
>> IEEE P802.11be™/D2.0
>> 35.3.3 Multi-link device addressing
>> An MLD has an MLD MAC address that singly identifies the MLD.
>> Each STA affiliated with an MLD shall have a different MAC address.
>> NOTE 1—The MLD MAC address of an MLD might be the same as the MAC
>> address of one affiliated STA or different
>> from the MAC address of any affiliated STA.
> Right. I was over-simplifying, that was basically the "tl;dr" version of
> my statement, without the longer one ;-)
>
>> This means the MLD address can be same with one link.
> True.
>
>> I suggest to set primary link local addr same with MLD address for station.
> I wouldn't suggest that, but YMMV.
>
>> reason is:
>> When station up, one link interface of driver will be created with the
>> addr of struct ieee80211_vif,
>> it is used for scan and non-MLO connection.
>> If station start to do MLO connection now, then random local link addr
>> will be generated by below call stack.
>> for the 1st link. This lead driver must change the link interface local
>> address to this random addr.
> Well, that depends how you treat "address of an interface", no? I don't
> think there's really any need to "install" a MAC address to the NIC
> until you even start any kind of operation.
>
> True, if you cannot scan using the MLD address while you also have a
> different link address, you might be in trouble - but I find this
> unrealistic because you would want to be able to scan on any part of the
> hardware that is doing any of the links?
Scan probe request needs the local address, so we must fill one address 
to it.
And we use the same local address to scan for 2.4 GHz/5 GHz/6 GHz band.
>
>
> In any case, changing this makes the receive logic a bit different. You
> would have to ensure that your driver does indeed indicate the link a
> frame was received on, I think? Also, ieee80211_rx_for_interface() might
> have to change, something like the below maybe?
I looked the ieee80211_rx_for_interface(), it is to find struct 
link_sta_info with the source
address of an rx frame. For station, the hdr->addr2 means the address of 
the AP, so
the the change of mac80211/wireless will not effect the 
ieee80211_rx_for_interface().
Because it is the MLD/link address of the AP(maybe it is same addr for 
MLD/one link) when we use as station.
>
> If we just change the first link's address to the same as the MLD
> address without any changes then the code without the changes below
> would overwrite the link ID because it can find the link STA address,
> even if the device already did address translation. Of course this is
> only relevant if it does address translation w/o indicating the link,
> which it shouldn't ... hence the patch.
>
> In any case, I expect this will end up being some kind of driver policy,
> so I can imagine that we could make a relatively simple patch with a new
> method to let drivers set the link address that gets used. It cannot be
> changing the link address when it's added to the driver since this patch
> that this thread is based on means the driver doesn't get to know about
> the links until it's far too late (and even before this patch, the links
> were only created after assoc, when the link addresses were already sent
> to the AP)
>
> johannes
>
>
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index ac2bad57933f..648b2de8dd3e 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -1482,7 +1482,8 @@ enum mac80211_rx_encoding {
>    * @ampdu_delimiter_crc: A-MPDU delimiter CRC
>    * @zero_length_psdu_type: radiotap type of the 0-length PSDU
>    * @link_valid: if the link which is identified by @link_id is valid. This flag
> - *	is set only when connection is MLO.
> + *	is set only when connection is MLO. Note that setting this also implies
> + *	address translation was done.
>    * @link_id: id of the link used to receive the packet. This is used along with
>    *	@link_valid.
>    */
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index a57811372027..963de5d880d7 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -4946,22 +4946,24 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw,
>   static bool ieee80211_rx_for_interface(struct ieee80211_rx_data *rx,
>   				       struct sk_buff *skb, bool consume)
>   {
> -	struct link_sta_info *link_sta;
> +	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
>   	struct ieee80211_hdr *hdr = (void *)skb->data;
> +	struct link_sta_info *link_sta = NULL;
>   
>   	/*
> -	 * Look up link station first, in case there's a
> -	 * chance that they might have a link address that
> -	 * is identical to the MLD address, that way we'll
> -	 * have the link information if needed.
> +	 * Unless the driver did addr translation and provided the link
> +	 * ID, look up link station first. Note that if we get a frame
> +	 * without link ID in the status and the device happens to use
> +	 * identical addresses for one of the links and the MLD, then
> +	 * we cannot identify whether it was translated already or not.
>   	 */
> -	link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);
> +	if (!status->link_valid)
> +		link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2);
> +
>   	if (link_sta) {
>   		rx->sta = link_sta->sta;
>   		rx->link_id = link_sta->link_id;
>   	} else {
> -		struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
> -
>   		rx->sta = sta_info_get_bss(rx->sdata, hdr->addr2);
>   		if (rx->sta) {
>   			if (status->link_valid &&
Thanks.
Below patch has said driver should report link id if addr translated.

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/commit/?h=mld&id=ea9d807b56428d65cf43030cbd7ae5a580077147
wifi: mac80211: add link information in ieee80211_rx_status
In MLO, when the address translation from link to MLD is done
in fw/hw, it is necessary to be able to have some information
on the link on which the frame has been received. Extend the
rx API to include link_id and a valid flag in ieee80211_rx_status.
Also make chanes to mac80211 rx APIs to make use of the reported
link_id after sanity checks.

  reply	other threads:[~2022-09-09  8:38 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 14:12 [PATCH 00/27] another set of MLO patches Johannes Berg
2022-09-02 14:12 ` [PATCH 01/27] wifi: mac80211_hwsim: remove multicast workaround Johannes Berg
2022-09-02 14:12 ` [PATCH 02/27] wifi: mac80211: remove unused arg to ieee80211_chandef_eht_oper Johannes Berg
2022-09-02 14:12 ` [PATCH 03/27] wifi: mac80211_hwsim: check STA magic in change_sta_links Johannes Berg
2022-09-02 14:12 ` [PATCH 04/27] wifi: mac80211_hwsim: refactor RX a bit Johannes Berg
2022-09-02 14:12 ` [PATCH 05/27] wifi: mac80211: move link code to a new file Johannes Berg
2022-09-02 14:12 ` [PATCH 06/27] wifi: mac80211: mlme: assign link address correctly Johannes Berg
2022-09-02 14:12 ` [PATCH 07/27] wifi: mac80211_hwsim: warn on invalid link address Johannes Berg
2022-09-02 14:12 ` [PATCH 08/27] wifi: mac80211: use correct rx link_sta instead of default Johannes Berg
2022-09-02 14:12 ` [PATCH 09/27] wifi: mac80211: make smps_mode per-link Johannes Berg
2022-09-02 14:12 ` [PATCH 10/27] wifi: mac80211: isolate driver from inactive links Johannes Berg
2022-09-08 15:23   ` Wen Gong
2022-09-08 15:36     ` Johannes Berg
2022-09-08 15:51       ` Wen Gong
2022-09-08 15:52         ` Johannes Berg
2022-09-09  4:16           ` Wen Gong
2022-09-09  7:28             ` Johannes Berg
2022-09-09  8:38               ` Wen Gong [this message]
2022-09-09  8:58               ` Wen Gong
2022-09-28 15:20                 ` Wen Gong
2022-09-28 15:28                   ` Johannes Berg
2022-10-11  4:07                     ` Wen Gong
2022-10-11  7:26                       ` Johannes Berg
2023-04-04  2:54                         ` Wen Gong
2023-04-11  7:32                           ` Johannes Berg
2023-04-17 14:07                             ` Wen Gong
2023-04-18  8:15                               ` Johannes Berg
2023-04-18  8:59                                 ` Wen Gong
2023-04-18  9:11                                   ` Johannes Berg
2023-04-18  9:22                                     ` Wen Gong
2023-04-18  9:31                                       ` Johannes Berg
2023-04-18  9:37                                         ` Wen Gong
2023-04-18  9:38                                           ` Johannes Berg
2023-04-18  9:44                                             ` Wen Gong
2023-04-18 10:18                                               ` Johannes Berg
     [not found]                                                 ` <5bd1776e-0691-d0a8-d198-e5b4ee676494@quicinc.com>
2023-04-18 10:47                                                   ` Johannes Berg
2023-04-04  3:28       ` Wen Gong
2023-04-11  7:38         ` Johannes Berg
2023-04-17 14:13           ` Wen Gong
2023-04-18  8:18             ` Johannes Berg
2023-04-18  9:27               ` Wen Gong
2023-04-18  9:34                 ` Johannes Berg
2023-04-18  9:52                   ` Wen Gong
2023-05-24  7:39                   ` Wen Gong
2023-05-24  7:41                   ` Wen Gong
2023-06-14 18:32                     ` Johannes Berg
2023-06-15  2:26                       ` Wen Gong
2023-06-15  7:56                         ` Johannes Berg
2023-06-21  7:55                           ` Wen Gong
2023-06-27 11:02                             ` Wen Gong
2023-06-30  9:32                           ` Wen Gong
2023-05-10 11:06           ` Wen Gong
2023-05-10 11:24             ` Johannes Berg
2023-05-10 12:25               ` Wen Gong
2023-05-10 12:25                 ` Johannes Berg
2022-09-02 14:12 ` [PATCH 11/27] wifi: mac80211: add ieee80211_find_sta_by_link_addrs API Johannes Berg
2022-09-02 14:12 ` [PATCH 12/27] wifi: mac80211_hwsim: skip inactive links on TX Johannes Berg
2022-09-02 14:12 ` [PATCH 13/27] wifi: mac80211_hwsim: track active STA links Johannes Berg
2022-09-02 14:12 ` [PATCH 14/27] wifi: mac80211: mlme: refactor QoS settings code Johannes Berg
2022-09-02 14:12 ` [PATCH 15/27] wifi: mac80211: extend ieee80211_nullfunc_get() for MLO Johannes Berg
2022-09-02 14:12 ` [PATCH 16/27] wifi: mac80211_hwsim: send NDP for link (de)activation Johannes Berg
2022-09-02 14:12 ` [PATCH 17/27] wifi: mac80211_hwsim: fix multi-channel handling in netlink RX Johannes Berg
2022-09-02 14:12 ` [PATCH 18/27] wifi: nl80211: add MLD address to assoc BSS entries Johannes Berg
2022-09-02 14:12 ` [PATCH 19/27] wifi: mac80211: call drv_sta_state() under sdata_lock() in reconfig Johannes Berg
2022-09-02 14:12 ` [PATCH 20/27] wifi: mac80211: add vif/sta link RCU dereference macros Johannes Berg
2022-09-02 14:12 ` [PATCH 21/27] wifi: mac80211: set up beacon timing config on links Johannes Berg
2022-09-02 14:12 ` [PATCH 22/27] wifi: mac80211: keep A-MSDU data in sta and per-link Johannes Berg
2022-09-02 14:12 ` [PATCH 23/27] wifi: mac80211: fix double SW scan stop Johannes Berg
2022-09-02 14:12 ` [PATCH 24/27] wifi: mac80211: implement link switching Johannes Berg
2023-03-25 14:33   ` Wen Gong
2023-03-27  8:31     ` Johannes Berg
2023-03-27  8:40       ` Wen Gong
2023-03-27  9:04         ` Johannes Berg
2023-03-27  9:10           ` Wen Gong
2023-03-28  7:37       ` Wen Gong
2023-03-28  7:39         ` Johannes Berg
2023-04-03 14:15           ` Wen Gong
2023-04-11 10:16             ` Johannes Berg
2023-04-03 14:21       ` Wen Gong
2023-04-11 10:18         ` Johannes Berg
2022-09-02 14:12 ` [PATCH 25/27] wifi: mac80211_hwsim: always activate all links Johannes Berg
2022-09-02 14:12 ` [PATCH 26/27] wifi: mac80211: prevent 4-addr use on MLDs Johannes Berg
2022-09-02 14:12 ` [PATCH 27/27] wifi: mac80211: prevent VLANs " Johannes Berg
2022-09-06  7:18 ` [PATCH 00/27] another set of MLO patches Wen Gong
2022-09-06  7:28   ` Johannes Berg
2022-09-06  7:58     ` Wen Gong
2022-09-06  8:03       ` Johannes Berg
2022-09-06  8:42         ` Wen Gong
2022-09-12 13:17           ` Otcheretianski, Andrei
2022-09-13  4:26             ` Wen Gong
2022-09-28 15:12             ` Wen Gong
2022-10-11  2:28               ` Wen Gong
2022-10-19 10:04                 ` wifi: hostapd:/wpa_supplicant MLO " Wen Gong
2022-10-19 13:31                   ` Otcheretianski, Andrei
2022-11-28  8:45                   ` Wen Gong
2022-11-28 14:05                     ` Otcheretianski, Andrei
2022-11-29  2:06                       ` Wen Gong
2022-11-29  6:59                         ` Otcheretianski, Andrei
2022-11-29  7:04                           ` Wen Gong
2022-09-07  3:34         ` Wen Gong

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=e036ea72-10b1-1d4c-023b-c7d248a72b86@quicinc.com \
    --to=quic_wgong@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=johannes@sipsolutions.net \
    --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