hw_feature: Correctly select mode in case of the 6 GHz band
There are 2 HW modes with IEEE80211_MODE_A: one for the 5 GHz channels and one for 6 GHz channels. Since hw_get_chan() checks all the compatible hw modes, eventually, an incorrect hw mode is selected. To fix this, add a function that checks if a specific mode supports the requested frequency and if so use it as the current mode. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
parent
cc96f45f4f
commit
99cd453720
3 changed files with 33 additions and 15 deletions
|
@ -1074,12 +1074,13 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
|
||||||
iface->current_mode = NULL;
|
iface->current_mode = NULL;
|
||||||
for (i = 0; i < iface->num_hw_features; i++) {
|
for (i = 0; i < iface->num_hw_features; i++) {
|
||||||
struct hostapd_hw_modes *mode = &iface->hw_features[i];
|
struct hostapd_hw_modes *mode = &iface->hw_features[i];
|
||||||
|
int chan;
|
||||||
|
|
||||||
if (mode->mode == iface->conf->hw_mode) {
|
if (mode->mode == iface->conf->hw_mode) {
|
||||||
if (iface->freq > 0 &&
|
if (iface->freq > 0 &&
|
||||||
!hw_get_chan(mode->mode, iface->freq,
|
!hw_mode_get_channel(mode, iface->freq, &chan))
|
||||||
iface->hw_features,
|
|
||||||
iface->num_hw_features))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
iface->current_mode = mode;
|
iface->current_mode = mode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,25 +41,12 @@ struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
|
||||||
|
|
||||||
|
|
||||||
struct hostapd_channel_data *
|
struct hostapd_channel_data *
|
||||||
hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
|
hw_mode_get_channel(struct hostapd_hw_modes *mode, int freq, int *chan)
|
||||||
struct hostapd_hw_modes *hw_features, int num_hw_features)
|
|
||||||
{
|
{
|
||||||
int i, j;
|
int i;
|
||||||
|
|
||||||
if (chan)
|
for (i = 0; i < mode->num_channels; i++) {
|
||||||
*chan = 0;
|
struct hostapd_channel_data *ch = &mode->channels[i];
|
||||||
|
|
||||||
if (!hw_features)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (j = 0; j < num_hw_features; j++) {
|
|
||||||
struct hostapd_hw_modes *curr_mode = &hw_features[j];
|
|
||||||
|
|
||||||
if (curr_mode->mode != mode)
|
|
||||||
continue;
|
|
||||||
for (i = 0; i < curr_mode->num_channels; i++) {
|
|
||||||
struct hostapd_channel_data *ch =
|
|
||||||
&curr_mode->channels[i];
|
|
||||||
|
|
||||||
if (ch->freq == freq) {
|
if (ch->freq == freq) {
|
||||||
if (chan)
|
if (chan)
|
||||||
|
@ -67,6 +54,33 @@ hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct hostapd_channel_data *
|
||||||
|
hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
|
||||||
|
struct hostapd_hw_modes *hw_features, int num_hw_features)
|
||||||
|
{
|
||||||
|
struct hostapd_channel_data *chan_data;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (chan)
|
||||||
|
*chan = 0;
|
||||||
|
|
||||||
|
if (!hw_features)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < num_hw_features; i++) {
|
||||||
|
struct hostapd_hw_modes *curr_mode = &hw_features[i];
|
||||||
|
|
||||||
|
if (curr_mode->mode != mode)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
chan_data = hw_mode_get_channel(curr_mode, freq, chan);
|
||||||
|
if (chan_data)
|
||||||
|
return chan_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
|
|
||||||
struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
|
struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
|
||||||
int chan, int *freq);
|
int chan, int *freq);
|
||||||
|
struct hostapd_channel_data *
|
||||||
|
hw_mode_get_channel(struct hostapd_hw_modes *mode, int freq, int *chan);
|
||||||
|
|
||||||
struct hostapd_channel_data *
|
struct hostapd_channel_data *
|
||||||
hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
|
hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
|
||||||
struct hostapd_hw_modes *hw_features, int num_hw_features);
|
struct hostapd_hw_modes *hw_features, int num_hw_features);
|
||||||
|
|
Loading…
Reference in a new issue