2023-04-25 10:05:26

by Arend van Spriel

[permalink] [raw]
Subject: question about struct ieee80211_iface_combination

Hi Johannes,

My brain is tripping over a field in struct ieee80211_iface_combination,
ie. the num_different_channels. Looking at the name I tend to think that
num_different_channel = 0 means the interfaces must all operate on the
same channel. However, in most places it is configured as 1 or more. The
documentation in cfg80211.h [1] is not unambiguous about it in my
opinion. By now it probably depends on how user-space uses it.

Regards,
Arend

[1]
https://elixir.bootlin.com/linux/latest/source/include/net/cfg80211.h#L4780


Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature

2023-04-25 18:37:54

by Johannes Berg

[permalink] [raw]
Subject: Re: question about struct ieee80211_iface_combination

Hi Arend,

On Tue, 2023-04-25 at 12:01 +0200, Arend van Spriel wrote:
> My brain is tripping over a field in struct ieee80211_iface_combination,
> ie. the num_different_channels. Looking at the name I tend to think that
> num_different_channel = 0 means the interfaces must all operate on the
> same channel. However, in most places it is configured as 1 or more. The
> documentation in cfg80211.h [1] is not unambiguous about it in my
> opinion. By now it probably depends on how user-space uses it.

Well it's not valid for it to be 0 in the first place:

static int wiphy_verify_combinations(struct wiphy *wiphy)
{
...
for (i = 0; i < wiphy->n_iface_combinations; i++) {
...
for (i = 0; i < wiphy->n_iface_combinations; i++) {
...
/* Need at least one channel */
if (WARN_ON(!c->num_different_channels))
return -EINVAL;


So really what was meant that _1_ means you only have a single channel,
and so on. Are you tripping over the "different"? The way I read it, is
that with all the interfaces you have, you can have N different
channels, i.e. looking at it "globally". It seems maybe you're more
interpreting it as "additionally" to the first interface?

johannes

2023-04-25 19:56:05

by Arend van Spriel

[permalink] [raw]
Subject: Re: question about struct ieee80211_iface_combination

On April 25, 2023 8:14:33 PM Johannes Berg <[email protected]> wrote:

> Hi Arend,
>
> On Tue, 2023-04-25 at 12:01 +0200, Arend van Spriel wrote:
>> My brain is tripping over a field in struct ieee80211_iface_combination,
>> ie. the num_different_channels. Looking at the name I tend to think that
>> num_different_channel = 0 means the interfaces must all operate on the
>> same channel. However, in most places it is configured as 1 or more. The
>> documentation in cfg80211.h [1] is not unambiguous about it in my
>> opinion. By now it probably depends on how user-space uses it.
>
> Well it's not valid for it to be 0 in the first place:
>
> static int wiphy_verify_combinations(struct wiphy *wiphy)
> {
> ...
> for (i = 0; i < wiphy->n_iface_combinations; i++) {
> ...
> for (i = 0; i < wiphy->n_iface_combinations; i++) {
> ...
> /* Need at least one channel */
> if (WARN_ON(!c->num_different_channels))
> return -EINVAL;
>
>
> So really what was meant that _1_ means you only have a single channel,
> and so on. Are you tripping over the "different"? The way I read it, is

Yup. That WARN_ON is a big help ;-)

> that with all the interfaces you have, you can have N different
> channels, i.e. looking at it "globally". It seems maybe you're more
> interpreting it as "additionally" to the first interface?

Thanks for taking time to clarify this to me.

Regards,
Arend




Attachments:
smime.p7s (4.12 kB)
S/MIME Cryptographic Signature