Home | History | Annotate | Download | only in ap

Lines Matching refs:iface

47 int hostapd_get_hw_features(struct hostapd_iface *iface)
49 struct hostapd_data *hapd = iface->bss[0];
65 iface->hw_flags = flags;
67 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
68 iface->hw_features = modes;
69 iface->num_hw_features = num_modes;
104 int hostapd_prepare_rates(struct hostapd_iface *iface,
113 if (iface->conf->basic_rates)
114 basic_rates = iface->conf->basic_rates;
134 os_free(iface->basic_rates);
135 iface->basic_rates = os_malloc(i * sizeof(int));
136 if (iface->basic_rates)
137 os_memcpy(iface->basic_rates, basic_rates, i * sizeof(int));
139 os_free(iface->current_rates);
140 iface->num_rates = 0;
142 iface->current_rates =
144 if (!iface->current_rates) {
153 if (iface->conf->supported_rates &&
154 !hostapd_rate_found(iface->conf->supported_rates,
158 rate = &iface->current_rates[iface->num_rates];
165 iface->num_rates, rate->rate, rate->flags);
166 iface->num_rates++;
169 if ((iface->num_rates == 0 || num_basic_rates == 0) &&
170 (!iface->conf->ieee80211n || !iface->conf->require_ht)) {
173 iface->num_rates, num_basic_rates);
182 static int ieee80211n_allowed_ht40_channel_pair(struct hostapd_iface *iface)
189 if (!iface->conf->secondary_channel)
192 sec_chan = iface->conf->channel + iface->conf->secondary_channel * 4;
195 iface->conf->channel, sec_chan);
200 for (j = 0; j < iface->current_mode->num_channels; j++) {
202 &iface->current_mode->channels[j];
221 if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
224 if (iface->conf->secondary_channel > 0)
225 first = iface->conf->channel;
238 iface->conf->channel,
239 iface->conf->secondary_channel);
247 static void ieee80211n_switch_pri_sec(struct hostapd_iface *iface)
249 if (iface->conf->secondary_channel > 0) {
250 iface->conf->channel += 4;
251 iface->conf->secondary_channel = -1;
253 iface->conf->channel -= 4;
254 iface->conf->secondary_channel = 1;
284 static int ieee80211n_check_40mhz_5g(struct hostapd_iface *iface,
292 pri_chan = iface->conf->channel;
293 sec_chan = iface->conf->secondary_channel * 4;
294 pri_freq = hostapd_hw_get_freq(iface->bss[0], pri_chan);
295 if (iface->conf->secondary_channel > 0)
316 ieee80211n_switch_pri_sec(iface);
345 ieee80211n_switch_pri_sec(iface);
355 static int ieee80211n_check_40mhz_2g4(struct hostapd_iface *iface,
362 pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel);
363 if (iface->conf->secondary_channel > 0)
414 static void ieee80211n_check_scan(struct hostapd_iface *iface)
423 iface->scan_cb = NULL;
425 scan_res = hostapd_driver_get_scan_results(iface->bss[0]);
427 hostapd_setup_interface_complete(iface, 1);
431 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A)
432 oper40 = ieee80211n_check_40mhz_5g(iface, scan_res);
434 oper40 = ieee80211n_check_40mhz_2g4(iface, scan_res);
440 iface->conf->channel,
441 iface->conf->channel +
442 iface->conf->secondary_channel * 4);
443 iface->conf->secondary_channel = 0;
444 iface->conf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
447 res = ieee80211n_allowed_ht40_channel_pair(iface);
448 hostapd_setup_interface_complete(iface, !res);
452 static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface,
461 if (iface->current_mode == NULL)
464 pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel);
465 if (iface->conf->secondary_channel > 0)
474 mode = iface->current_mode;
492 static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
496 if (!iface->conf->secondary_channel)
502 if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G)
503 ieee80211n_scan_channels_2g4(iface, &params);
504 if (hostapd_driver_scan(iface->bss[0], &params) < 0) {
512 iface->scan_cb = ieee80211n_check_scan;
517 static int ieee80211n_supported_ht_capab(struct hostapd_iface *iface)
519 u16 hw = iface->current_mode->ht_capab;
520 u16 conf = iface->conf->ht_capab;
617 int hostapd_check_ht_capab(struct hostapd_iface *iface)
621 if (!iface->conf->ieee80211n)
623 if (!ieee80211n_supported_ht_capab(iface))
625 ret = ieee80211n_check_40mhz(iface);
628 if (!ieee80211n_allowed_ht40_channel_pair(iface))
638 * @iface: Pointer to interface data.
644 int hostapd_select_hw_mode(struct hostapd_iface *iface)
648 if (iface->num_hw_features < 1)
651 iface->current_mode = NULL;
652 for (i = 0; i < iface->num_hw_features; i++) {
653 struct hostapd_hw_modes *mode = &iface->hw_features[i];
654 if (mode->mode == iface->conf->hw_mode) {
655 iface->current_mode = mode;
660 if (iface->current_mode == NULL) {
663 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
667 (int) iface->conf->hw_mode);
672 for (j = 0; j < iface->current_mode->num_channels; j++) {
674 &iface->current_mode->channels[j];
675 if (chan->chan == iface->conf->channel) {
694 if (ok && iface->conf->secondary_channel) {
696 int sec_chan = iface->conf->channel +
697 iface->conf->secondary_channel * 4;
698 for (j = 0; j < iface->current_mode->num_channels; j++) {
700 &iface->current_mode->channels[j];
708 hostapd_logger(iface->bss[0], NULL,
714 sec_chan, iface->current_mode->mode,
716 iface->current_mode->mode));
720 if (iface->conf->channel == 0) {
727 if (ok == 0 && iface->conf->channel != 0) {
728 hostapd_logger(iface->bss[0], NULL,
733 iface->conf->channel,
734 iface->current_mode->mode,
735 hostapd_hw_mode_txt(iface->current_mode->mode));
736 iface->current_mode = NULL;
739 if (iface->current_mode == NULL) {
740 hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
769 if (!hapd->iface->current_mode)
772 for (i = 0; i < hapd->iface->current_mode->num_channels; i++) {
774 &hapd->iface->current_mode->channels[i];
787 if (!hapd->iface->current_mode)
790 for (i = 0; i < hapd->iface->current_mode->num_channels; i++) {
792 &hapd->iface->current_mode->channels[i];