@@ -5529,23 +5529,40 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
struct wpa_used_freq_data *freqs;
unsigned int cand;
unsigned int num, i;
+ u8 ignore_no_freqs = 0;
os_memset(params, 0, sizeof(*params));
params->role_go = 1;
params->ht40 = ht40;
params->vht = vht;
- if (wpa_s->p2p_group_common_freqs_num)
- wpa_printf(MSG_DEBUG, "P2P: %s called for an active GO",
- __func__);
-
freqs = os_calloc(wpa_s->num_multichan_concurrent,
sizeof(struct wpa_used_freq_data));
if (!freqs)
return -1;
- num = wpas_p2p_valid_oper_freqs(wpa_s, freqs,
- wpa_s->num_multichan_concurrent);
+ num = get_shared_radio_freqs_data(wpa_s, freqs,
+ wpa_s->num_multichan_concurrent);
+
+ if (wpa_s->current_ssid &&
+ wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO &&
+ wpa_s->wpa_state == WPA_COMPLETED) {
+ wpa_printf(MSG_DEBUG, "P2P: %s called for an active GO",
+ __func__);
+
+ /* if the frequency selection is done for an active P2P GO that
+ * is not sharing a frequency, allow to select a new frequency
+ * even if there are not unused freqs as we are about to move
+ * the P2P GO so its freq can be re-used.
+ */
+ for (i = 0; i < num; i++) {
+ if (freqs[i].freq == wpa_s->current_ssid->frequency &&
+ freqs[i].flags == 0) {
+ ignore_no_freqs = 1;
+ break;
+ }
+ }
+ }
/* try using the forced freq */
if (freq) {
@@ -5566,7 +5583,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
}
}
- if (wpas_p2p_num_unused_channels(wpa_s) <= 0) {
+ if (!ignore_no_freqs &&
+ wpas_p2p_num_unused_channels(wpa_s) <= 0) {
wpa_printf(MSG_DEBUG,
"P2P: Cannot force GO on freq (%d MHz) as all the channels are in use",
freq);
@@ -5604,7 +5622,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
}
}
- if (wpas_p2p_num_unused_channels(wpa_s) <= 0) {
+ if (!ignore_no_freqs &&
+ wpas_p2p_num_unused_channels(wpa_s) <= 0) {
wpa_printf(MSG_DEBUG,
"P2P: Cannot force GO on any of the channels we are already using");
goto fail;
wpas_p2p_move_go_csa() uses wpas_p2p_init_p2p_params() to select the frequency to move to. However, it is possible that all the channels are already used, so the selection of a new frequency would fail, although the frequency used by the P2P GO should not be considered as used if it is the only one using it. To overcome this, allow the frequency selection to continue even if all the frequencies are in use, but the frequency used by the P2P GO is not used by any station interface. Signed-off-by: Ilan Peer <ilan.peer@intel.com> --- wpa_supplicant/p2p_supplicant.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-)