]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Disable pri/sec channel switch for GO with forced frequency
authorSunil Ravi <sunilravi@google.com>
Mon, 3 Oct 2022 00:53:41 +0000 (00:53 +0000)
committerJouni Malinen <j@w1.fi>
Fri, 1 Mar 2024 18:04:13 +0000 (20:04 +0200)
When wpa_supplicant receives a request to start a P2P group owner on a
fixed frequency with bandwidth wider than 20 MHz, wpa_supplicant scans
for neighboring BSSs prior to starting the GO. This is done to switch
the primary/secondary channels if there are any other networks which are
operating on the same secondary channel. Though this logic is defined
for 20/40 MHz coexistence and might improve throughput, there are P2P
use cases where this logic causes problem:

1. The file transfer use case takes time to start the file transfer or
   even fails when the 20/40 coex scan repeatedly fails due to an
   ongoing externally triggered scan happening in the system.
2. wpa_supplicant overrides the channel which is selected by the
   application based on the best channel it derived by looking into
   the channel conditions. This degrades the expected throughput.
3. Latency sensitive applications experience long time to
   start the group owner which gives a bad user experience.

So do not allow 40 MHz co-ex PRI/SEC switch to force a change to
Autonomous GO PRI channel when the P2P group add is called with a forced
frequency.

Test: Tested autonomous GO and confirmed from the logs that
P2P GO is not triggering 20/40 coex scan.

Signed-off-by: Sunil Ravi <sunilravi@google.com>
wpa_supplicant/ap.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 2d30ce409c9ae906d1241ec3018955f1db536dfe..ffe98fa8ddb1c994dd8a7c84ac277df7988650e5 100644 (file)
@@ -440,7 +440,9 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
                }
        }
 
-       if (conf->secondary_channel) {
+       if (wpa_s->p2p_go_no_pri_sec_switch) {
+               conf->no_pri_sec_switch = 1;
+       } else if (conf->secondary_channel) {
                struct wpa_supplicant *iface;
 
                for (iface = wpa_s->global->ifaces; iface; iface = iface->next)
index 0904d60efcdc62282cb23bbdc38b657e92038163..f8e903362d088dec3cc958251ec2b5fcf31dd6d5 100644 (file)
@@ -6895,6 +6895,7 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,
                       bool allow_6ghz)
 {
        struct p2p_go_neg_results params;
+       int selected_freq = 0;
 
        if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
                return -1;
@@ -6909,12 +6910,13 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,
        wpas_p2p_stop_find_oper(wpa_s);
 
        if (!wpa_s->p2p_go_do_acs) {
-               freq = wpas_p2p_select_go_freq(wpa_s, freq);
-               if (freq < 0)
+               selected_freq = wpas_p2p_select_go_freq(wpa_s, freq);
+               if (selected_freq < 0)
                        return -1;
        }
 
-       if (wpas_p2p_init_go_params(wpa_s, &params, freq, vht_center_freq2,
+       if (wpas_p2p_init_go_params(wpa_s, &params, selected_freq,
+                                   vht_center_freq2,
                                    ht40, vht, max_oper_chwidth, he, edmg,
                                    NULL))
                return -1;
@@ -6925,6 +6927,8 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group,
        wpa_s = wpas_p2p_get_group_iface(wpa_s, 0, 1);
        if (wpa_s == NULL)
                return -1;
+       if (freq > 0)
+               wpa_s->p2p_go_no_pri_sec_switch = 1;
        wpas_start_wps_go(wpa_s, &params, 0);
 
        return 0;
@@ -7084,6 +7088,7 @@ int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
                        freq = wpas_p2p_select_go_freq(wpa_s, force_freq);
                        if (freq < 0)
                                return -1;
+                       wpa_s->p2p_go_no_pri_sec_switch = 1;
                } else {
                        freq = wpas_p2p_select_go_freq(wpa_s, neg_freq);
                        if (freq < 0 ||
index 6cacfe4854f05f44dbe620a3edf0d648d8d0ae98..c169dce678cb8e712a7b129cbe69e07f755a5f0b 100644 (file)
@@ -1156,6 +1156,7 @@ struct wpa_supplicant {
        unsigned int user_initiated_pd:1;
        unsigned int p2p_go_group_formation_completed:1;
        unsigned int group_formation_reported:1;
+       unsigned int p2p_go_no_pri_sec_switch:1;
        unsigned int waiting_presence_resp;
        int p2p_first_connection_timeout;
        unsigned int p2p_nfc_tag_enabled:1;