Skip to content

Commit

Permalink
luci-mod-status: channel_analysis: detect 40 MHz (20+20 bonded) APs
Browse files Browse the repository at this point in the history
At the moment, 40 MHz detection works only for some APs. HT (802.11n)
exposes the 40 MHz capability of APs in two ways. The first way is
a continuous 40 Mhz band. The second way is two 20MHz bonded channels.
Linux detects the presence of 40 MHz by checking the presence of the
second channel. It is always absent when the AP supports only 20 MHz.
This PR fixes this issue and both ways are supported.

First (40 MHz continuous):
HT Operation:
     Primary Channel: 13
     Secondary Channel Offset: below
     Channel Width: 40 MHz or higher

Second way (20+20MHz bonded):
HT Operation:
     Primary Channel: 1
     Secondary Channel Offset: above
     Channel Width: 20 MHz

Pure 20MHz channel:
HT Operation:
     Primary Channel: 1
     Secondary Channel Offset: no secondary
     Channel Width: 20 MHz

Fixes: openwrt#6839
Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
  • Loading branch information
abajk authored and hnyman committed Nov 10, 2024
1 parent c16643f commit d650688
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,20 +291,24 @@ return view.extend({
continue;

res.channel_width = "20 MHz";
if (res.ht_operation != null)
if (res.ht_operation.channel_width == 2040) { /* 40 MHz Channel Enabled */
if (res.ht_operation.secondary_channel_offset == "below") {
res.channel_width = "40 MHz";
chan_width = 4; /* 40 MHz Channel Used */
center_channels[0] -= 2;
} else if (res.ht_operation.secondary_channel_offset == "above") {
res.channel_width = "40 MHz";
chan_width = 4; /* 40 MHz Channel Used */
center_channels[0] += 2;
} else {
if (res.ht_operation != null) {
/* Detect 40 MHz operation by looking for the presence of
* a secondary channel. */
if (res.ht_operation.secondary_channel_offset == "below") {
res.channel_width = "40 MHz";
chan_width = 4; /* 40 MHz Channel Used */
center_channels[0] -= 2;
} else if (res.ht_operation.secondary_channel_offset == "above") {
res.channel_width = "40 MHz";
chan_width = 4; /* 40 MHz Channel Used */
center_channels[0] += 2;
} else {
/* Fallback to 20 MHz due to discovery of other APs on the
* same channel (802.11n coexistence mechanism). */
if (res.ht_operation.channel_width == 2040)
res.channel_width = "20 MHz (40 MHz Intolerant)";
}
}
}

/* if channel_width <= 40, refer to HT (above) for actual channel width,
* as vht_operation.channel_width == 40 really only means that the used
Expand Down

0 comments on commit d650688

Please sign in to comment.