2017-05-12 14:11:11

by Sergey Naumov

[permalink] [raw]
Subject: iw reg get since iw-4.x

Hi All.

I see that since iw-4.x "iw reg get" reports multiple region
information - per-phy and global. Moreover, per-phy information could
be marked as "self-managed".

Could somebody clarify when a driver uses phy-specific region and when
- the global one?

Looking at a list of channels from "iw phy phyX info" I can conclude
that if "self-managed" is true, then phy-specific region is used,
otherwise - the global one. Is it a correct assumption? If yes, then
why phy-specific regions are reported at all for non-self-managed
devices, and why the global region is reported for self-managed ones?

I think it would be natural to use new "iw phy phyX reg get" command
to report region information that is actually used, but unfortunately
this command returns exactly the same as "iw reg get":

root@OpenWrt:~# iw --version
iw version 4.9
root@OpenWrt:~# iw phy phy0 reg get
global
country RU: DFS-ETSI
(2402 - 2482 @ 40), (N/A, 20), (N/A)
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
(5650 - 5730 @ 80), (N/A, 30), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57000 - 66000 @ 2160), (N/A, 40), (N/A)

phy#1
country US: DFS-FCC
(2402 - 2472 @ 40), (N/A, 30), (N/A)
(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57240 - 63720 @ 2160), (N/A, 40), (N/A)

phy#0
country US: DFS-FCC
(2402 - 2472 @ 40), (N/A, 30), (N/A)
(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57240 - 63720 @ 2160), (N/A, 40), (N/A)

Thanks in advance,
Sergey.


2017-05-17 13:32:36

by Johannes Berg

[permalink] [raw]
Subject: Re: iw reg get since iw-4.x

On Fri, 2017-05-12 at 17:11 +0300, Sergey Naumov wrote:
> Hi All.
>
> I see that since iw-4.x "iw reg get" reports multiple region
> information - per-phy and global. Moreover, per-phy information could
> be marked as "self-managed".

That's also dependent on the kernel.

> Could somebody clarify when a driver uses phy-specific region and
> when
> - the global one?

It's just a driver decision, and how the firmware works.

> Looking at a list of channels from "iw phy phyX info" I can conclude
> that if "self-managed" is true, then phy-specific region is used,
> otherwise - the global one. Is it a correct assumption? If yes, then
> why phy-specific regions are reported at all for non-self-managed
> devices, and why the global region is reported for self-managed ones?

Good question, I'm not sure right now. You probably need to look at the
kernel's code (net/wireless/reg.c) to figure out the answer.

> I think it would be natural to use new "iw phy phyX reg get" command
> to report region information that is actually used, but unfortunately
> this command returns exactly the same as "iw reg get":

It's a pure alias right now, but that could be fixed by filtering in iw
I guess.

johannes