ACS: Extend hostapd_get_mode_channel() to find from any mode
This is preparation for being able to support hw_mode=any to select the best channel from any supported mode. Signed-off-by: Neo Jou <neojou@gmail.com>
This commit is contained in:
parent
a62d761856
commit
499c37b729
3 changed files with 46 additions and 3 deletions
|
@ -1429,15 +1429,33 @@ static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
|
||||||
#endif /* HOSTAPD */
|
#endif /* HOSTAPD */
|
||||||
|
|
||||||
|
|
||||||
|
static struct hostapd_channel_data *
|
||||||
|
hostapd_get_mode_chan(struct hostapd_hw_modes *mode, unsigned int freq)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct hostapd_channel_data *chan;
|
||||||
|
|
||||||
|
for (i = 0; i < mode->num_channels; i++) {
|
||||||
|
chan = &mode->channels[i];
|
||||||
|
if ((unsigned int) chan->freq == freq)
|
||||||
|
return chan;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct hostapd_channel_data * hostapd_get_mode_channel(
|
static struct hostapd_channel_data * hostapd_get_mode_channel(
|
||||||
struct hostapd_iface *iface, unsigned int freq)
|
struct hostapd_iface *iface, unsigned int freq)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct hostapd_channel_data *chan;
|
struct hostapd_channel_data *chan;
|
||||||
|
|
||||||
for (i = 0; i < iface->current_mode->num_channels; i++) {
|
for (i = 0; i < iface->num_hw_features; i++) {
|
||||||
chan = &iface->current_mode->channels[i];
|
if (hostapd_hw_skip_mode(iface, &iface->hw_features[i]))
|
||||||
if ((unsigned int) chan->freq == freq)
|
continue;
|
||||||
|
chan = hostapd_get_mode_chan(&iface->hw_features[i], freq);
|
||||||
|
if (chan)
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1085,3 +1085,20 @@ int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int hostapd_hw_skip_mode(struct hostapd_iface *iface,
|
||||||
|
struct hostapd_hw_modes *mode)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (iface->current_mode)
|
||||||
|
return mode != iface->current_mode;
|
||||||
|
if (mode->mode != HOSTAPD_MODE_IEEE80211B)
|
||||||
|
return 0;
|
||||||
|
for (i = 0; i < iface->num_hw_features; i++) {
|
||||||
|
if (iface->hw_features[i].mode == HOSTAPD_MODE_IEEE80211G)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ int hostapd_check_edmg_capab(struct hostapd_iface *iface);
|
||||||
int hostapd_prepare_rates(struct hostapd_iface *iface,
|
int hostapd_prepare_rates(struct hostapd_iface *iface,
|
||||||
struct hostapd_hw_modes *mode);
|
struct hostapd_hw_modes *mode);
|
||||||
void hostapd_stop_setup_timers(struct hostapd_iface *iface);
|
void hostapd_stop_setup_timers(struct hostapd_iface *iface);
|
||||||
|
int hostapd_hw_skip_mode(struct hostapd_iface *iface,
|
||||||
|
struct hostapd_hw_modes *mode);
|
||||||
#else /* NEED_AP_MLME */
|
#else /* NEED_AP_MLME */
|
||||||
static inline void
|
static inline void
|
||||||
hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
|
hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
|
||||||
|
@ -77,6 +79,12 @@ static inline void hostapd_stop_setup_timers(struct hostapd_iface *iface)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int hostapd_hw_skip_mode(struct hostapd_iface *iface,
|
||||||
|
struct hostapd_hw_modes *mode)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* NEED_AP_MLME */
|
#endif /* NEED_AP_MLME */
|
||||||
|
|
||||||
#endif /* HW_FEATURES_H */
|
#endif /* HW_FEATURES_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue