2023-09-14 00:06:37

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/3] wifi: mac80211: add support to allow driver to set active link while connection for station

On Wed, 2023-09-06 at 06:34 -0400, Wen Gong wrote:
> There are 2 fields valid_links and active_links in struct ieee80211_vif
> of mac80211. For station mode, valid_links is always include the bitmap
> of active_links. valid_links stores the bitmap of links which is created
> in mac80211, and mac80211 only indicate the info of links which is existed
> in active_links to driver. Finally, the active_links is the bitmap of
> links which station can interactive with MLO AP it is connected to.
>
> Currently the active links is always only contain the primary link,
> primary link means the link used by the latest exchange of successful
> (Re)Association Request/Response frames. Then it will always have only
> one link in driver after connected.
>
> Hence add this ops in struct ieee80211_ops to allow driver to determine
> the active links bit map dynamically while connecting to MLO AP.

This commit log does nothing to address the question "why do we need
this", particularly since we already have
ieee80211_set_active_links(/_async), so the driver can pretty much
immediately enable all the links it wants.

I see no value in this patch whatsoever.

> @@ -166,6 +167,13 @@ static void ieee80211_set_vif_links_bitmaps(struct ieee80211_sub_if_data *sdata,
> WARN_ON(dormant_links);
> break;
> case NL80211_IFTYPE_STATION:
> + active_links = drv_calculate_active_links(sdata->local, sdata,
> + valid_links & ~dormant_links);
> + if (active_links) {
> + sdata->vif.active_links = active_links;
> + break;
> + }
>

I also _really_ don't think this should operate at this low-level
infrastructure.

johannes


2023-09-15 08:34:02

by Wen Gong

[permalink] [raw]
Subject: Re: [PATCH 2/3] wifi: mac80211: add support to allow driver to set active link while connection for station

On 9/13/2023 4:58 PM, Johannes Berg wrote:
> On Wed, 2023-09-06 at 06:34 -0400, Wen Gong wrote:
>> There are 2 fields valid_links and active_links in struct ieee80211_vif
>> of mac80211. For station mode, valid_links is always include the bitmap
>> of active_links. valid_links stores the bitmap of links which is created
>> in mac80211, and mac80211 only indicate the info of links which is existed
>> in active_links to driver. Finally, the active_links is the bitmap of
>> links which station can interactive with MLO AP it is connected to.
>>
>> Currently the active links is always only contain the primary link,
>> primary link means the link used by the latest exchange of successful
>> (Re)Association Request/Response frames. Then it will always have only
>> one link in driver after connected.
>>
>> Hence add this ops in struct ieee80211_ops to allow driver to determine
>> the active links bit map dynamically while connecting to MLO AP.
> This commit log does nothing to address the question "why do we need
> this", particularly since we already have
> ieee80211_set_active_links(/_async), so the driver can pretty much
> immediately enable all the links it wants.
>
> I see no value in this patch whatsoever.
For ieee80211_set_active_links(), driver need save and install pairwise
keys for the other links as you said in link below. But driver do not
save the key data currently. So driver could not install the pairwise
keys by itself.
https://lore.kernel.org/linux-wireless/[email protected]/

And driver could ensure this rule in spec as I said before in link below:
"For MLO, if RSNA has not been established, each message of the 4-way
handshake shall be sent on the same link used by the latest exchange of
successful (Re)Association Request/Response frames."
https://lore.kernel.org/linux-wireless/[email protected]/

It will be complext for driver/ath12k to use
ieee80211_set_active_links(/_async).
>
>> @@ -166,6 +167,13 @@ static void ieee80211_set_vif_links_bitmaps(struct ieee80211_sub_if_data *sdata,
>> WARN_ON(dormant_links);
>> break;
>> case NL80211_IFTYPE_STATION:
>> + active_links = drv_calculate_active_links(sdata->local, sdata,
>> + valid_links & ~dormant_links);
>> + if (active_links) {
>> + sdata->vif.active_links = active_links;
>> + break;
>> + }
>>
> I also _really_ don't think this should operate at this low-level
> infrastructure.

I really want to know the reason why active *only* the assoc link for
station, but

active *all* links for AP here?????

> johannes

2023-09-26 10:43:36

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/3] wifi: mac80211: add support to allow driver to set active link while connection for station


> For ieee80211_set_active_links(), driver need save and install pairwise
> keys for the other links as you said in link below. But driver do not
> save the key data currently. So driver could not install the pairwise
> keys by itself.
> https://lore.kernel.org/linux-wireless/[email protected]/

Well it can still easily iterate the keys, but OK, I can buy this
argument. You should probably mention it all in the commit log though.

> > > @@ -166,6 +167,13 @@ static void ieee80211_set_vif_links_bitmaps(struct ieee80211_sub_if_data *sdata,
> > > WARN_ON(dormant_links);
> > > break;
> > > case NL80211_IFTYPE_STATION:
> > > + active_links = drv_calculate_active_links(sdata->local, sdata,
> > > + valid_links & ~dormant_links);
> > > + if (active_links) {
> > > + sdata->vif.active_links = active_links;
> > > + break;
> > > + }
> > >
> > I also _really_ don't think this should operate at this low-level
> > infrastructure.
>
> I really want to know the reason why active *only* the assoc link for
> station, but
>
> active *all* links for AP here?????

Well, fair point.

I was somehow anyway thinking that it should be the other way around, I
mean, in the sense that this code here is just mechanism, and the policy
should've been in higher-level code ... but somehow that's not what we
ended up doign here.


It really feels wrong to me to have the driver involved in this low-
level infrastructure, but OTOH that really is how it works now?


Maybe really what you want is a driver flag saying
IEEE80211_HW_MANAGES_ACTIVE_LINKS or something, and then from a mac80211
perspective you don't set active links at all? Though I'm not sure that
works with TTLM, for instance? And maybe you'd still want the debugfs?

But in fact, if you do still want something from mac80211 for debugfs or
TTLM, then this code here is not really right, since you'd interact with
_all_ attempts in mac80211 to activate or deactivate links - when all
you really wanted was the very first one.

Which today mac80211 achieves by bailing out
"if (sdata->vif.active_links)", and while you could do the same in the
driver, it feels really brittle / error-prone to me.


I think it'd be better than all these callbacks to encode the specific
behaviour you need in a flag, e.g. "activate all STA links on assoc" or
something?

johannes