]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Allow 6 GHz channels to be included in the P2P_FIND operation
authorSreeramya Soratkal <ssramya@codeaurora.org>
Tue, 4 May 2021 07:22:37 +0000 (12:52 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 14 Jun 2021 17:24:37 +0000 (20:24 +0300)
Previously, the 6 GHz channels were disabled for P2P operations.
Introduce a new include_6ghz parameter for the P2P_FIND command to
configure P2P discovery on the 6 GHz channels.

However, the p2p_6ghz_disable parameter in the configuration takes a
higher priority. If the p2p_6ghz_disable parameter is not set in the
configuration, include_6ghz parameter can be used to enable or disable
the discovery operation in the 6 GHz channels for the P2P_FIND command.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
src/drivers/driver.h
src/p2p/p2p.c
src/p2p/p2p.h
src/p2p/p2p_i.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/dbus/dbus_new_handlers_p2p.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h
wpa_supplicant/scan.c

index 561882d0d024dc823a04fba611be9deeb76dec93..804ac6806f619b89e5db8cfa309e81b9b562d295 100644 (file)
@@ -645,6 +645,12 @@ struct wpa_driver_scan_params {
         */
        unsigned int oce_scan:1;
 
+       /**
+        * p2p_include_6ghz - Include 6 GHz channels for P2P full scan
+        *
+        */
+       unsigned int p2p_include_6ghz:1;
+
        /*
         * NOTE: Whenever adding new parameters here, please make sure
         * wpa_scan_clone_params() and wpa_scan_free_params() get updated with
index 3148aeb3da1fbeff46fceea628db1731e466a62e..09ee51089eb0fce683ec91a730794de92a518ead 100644 (file)
@@ -1035,7 +1035,7 @@ static void p2p_search(struct p2p_data *p2p)
 
        res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, type, freq,
                                 p2p->num_req_dev_types, p2p->req_dev_types,
-                                p2p->find_dev_id, pw_id);
+                                p2p->find_dev_id, pw_id, p2p->include_6ghz);
        if (res < 0) {
                p2p_dbg(p2p, "Scan request schedule failed");
                p2p_continue_find(p2p);
@@ -1159,7 +1159,7 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
             enum p2p_discovery_type type,
             unsigned int num_req_dev_types, const u8 *req_dev_types,
             const u8 *dev_id, unsigned int search_delay,
-            u8 seek_count, const char **seek, int freq)
+            u8 seek_count, const char **seek, int freq, bool include_6ghz)
 {
        int res;
        struct os_reltime start;
@@ -1184,7 +1184,7 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
                p2p->find_dev_id = p2p->find_dev_id_buf;
        } else
                p2p->find_dev_id = NULL;
-
+       p2p->include_6ghz = p2p_wfd_enabled(p2p) && include_6ghz;
        if (seek_count == 0 || !seek) {
                /* Not an ASP search */
                p2p->p2ps_seek = 0;
@@ -1260,7 +1260,8 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
                                                 P2P_SCAN_SPECIFIC, freq,
                                                 p2p->num_req_dev_types,
                                                 p2p->req_dev_types, dev_id,
-                                                DEV_PW_DEFAULT);
+                                                DEV_PW_DEFAULT,
+                                                p2p->include_6ghz);
                        break;
                }
                /* fall through */
@@ -1268,13 +1269,13 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
                res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, P2P_SCAN_FULL, 0,
                                         p2p->num_req_dev_types,
                                         p2p->req_dev_types, dev_id,
-                                        DEV_PW_DEFAULT);
+                                        DEV_PW_DEFAULT, p2p->include_6ghz);
                break;
        case P2P_FIND_ONLY_SOCIAL:
                res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, P2P_SCAN_SOCIAL, 0,
                                         p2p->num_req_dev_types,
                                         p2p->req_dev_types, dev_id,
-                                        DEV_PW_DEFAULT);
+                                        DEV_PW_DEFAULT, p2p->include_6ghz);
                break;
        default:
                return -1;
index 24b0677e70efe6caded8d527388e6799525dda07..17809a661bf4bc194b55fdfb017bc1c8b05525e4 100644 (file)
@@ -612,6 +612,7 @@ struct p2p_config {
         * @req_dev_types: Array containing requested device types
         * @dev_id: Device ID to search for or %NULL to find all devices
         * @pw_id: Device Password ID
+        * @include_6ghz: Include 6 GHz channels in P2P scan
         * Returns: 0 on success, -1 on failure
         *
         * This callback function is used to request a P2P scan or search
@@ -635,7 +636,8 @@ struct p2p_config {
         */
        int (*p2p_scan)(void *ctx, enum p2p_scan_type type, int freq,
                        unsigned int num_req_dev_types,
-                       const u8 *req_dev_types, const u8 *dev_id, u16 pw_id);
+                       const u8 *req_dev_types, const u8 *dev_id, u16 pw_id,
+                       bool include_6ghz);
 
        /**
         * send_probe_resp - Transmit a Probe Response frame
@@ -1243,13 +1245,15 @@ enum p2p_discovery_type {
  *     P2P_FIND_START_WITH_FULL behavior. 0 = Use normal full scan.
  *     If p2p_find is already in progress, this parameter is ignored and full
  *     scan will be executed.
+ * @include_6ghz: Include 6 GHz channels in P2P find
  * Returns: 0 on success, -1 on failure
  */
 int p2p_find(struct p2p_data *p2p, unsigned int timeout,
             enum p2p_discovery_type type,
             unsigned int num_req_dev_types, const u8 *req_dev_types,
             const u8 *dev_id, unsigned int search_delay,
-            u8 seek_count, const char **seek_string, int freq);
+            u8 seek_count, const char **seek_string, int freq,
+            bool include_6ghz);
 
 /**
  * p2p_notify_scan_trigger_status - Indicate scan trigger status
index b4e3c4401f9c1a1fec2f49b6c7853ee4a6c6ad03..b778efad8632d1cf945a50506c7fe9a0d16cc017 100644 (file)
@@ -549,6 +549,7 @@ struct p2p_data {
        u8 override_pref_op_class;
        u8 override_pref_channel;
        bool p2p_6ghz_capable;
+       bool include_6ghz;
 };
 
 /**
index ba91cfb11d1455f581195043622b93ff2413cf44..37329704db98b6c6471d528a78e985d5a4e4f0b0 100644 (file)
@@ -5723,12 +5723,16 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd)
        const char *_seek[P2P_MAX_QUERY_HASH + 1], **seek = NULL;
        u8 seek_count = 0;
        int freq = 0;
+       bool include_6ghz = false;
 
        if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
                wpa_dbg(wpa_s, MSG_INFO,
                        "Reject P2P_FIND since interface is disabled");
                return -1;
        }
+
+       if (os_strstr(cmd, " include_6ghz"))
+               include_6ghz = true;
        if (os_strstr(cmd, "type=social"))
                type = P2P_FIND_ONLY_SOCIAL;
        else if (os_strstr(cmd, "type=progressive"))
@@ -5788,7 +5792,8 @@ static int p2p_ctrl_find(struct wpa_supplicant *wpa_s, char *cmd)
        }
 
        return wpas_p2p_find(wpa_s, timeout, type, _dev_type != NULL, _dev_type,
-                            _dev_id, search_delay, seek_count, seek, freq);
+                            _dev_id, search_delay, seek_count, seek, freq,
+                            include_6ghz);
 }
 
 
index 7a6567330407b2c68e39bfae27c94ae4cb4273c8..f7632e4ecb5519dc5f9f59e6ec06b6eacd0cee1e 100644 (file)
@@ -175,7 +175,7 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
        }
 
        if (wpas_p2p_find(wpa_s, timeout, type, num_req_dev_types,
-                         req_dev_types, NULL, 0, 0, NULL, freq))
+                         req_dev_types, NULL, 0, 0, NULL, freq, false))
                reply = wpas_dbus_error_unknown_error(
                        message, "Could not start P2P find");
 
index df676552c7afe2af26de9c658948a584ca2b70b7..2012fa58eff715e92f29a5180a004c87c90666cf 100644 (file)
@@ -347,9 +347,9 @@ static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
                params->only_new_results = 1;
        }
 
-       if (wpa_s->conf->p2p_6ghz_disable && !params->freqs) {
+       if (!params->p2p_include_6ghz && !params->freqs) {
                wpa_printf(MSG_DEBUG,
-                          "P2P: 6 GHz disabled - update the scan frequency list");
+                          "P2P: Exclude 6 GHz channels - update the scan frequency list");
                wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, params,
                                        0);
                wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params,
@@ -394,7 +394,8 @@ static int wpas_p2p_search_social_channel(struct wpa_supplicant *wpa_s,
 
 static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
                         unsigned int num_req_dev_types,
-                        const u8 *req_dev_types, const u8 *dev_id, u16 pw_id)
+                        const u8 *req_dev_types, const u8 *dev_id, u16 pw_id,
+                        bool include_6ghz)
 {
        struct wpa_supplicant *wpa_s = ctx;
        struct wpa_driver_scan_params *params = NULL;
@@ -432,7 +433,8 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
                                        num_req_dev_types, req_dev_types);
        if (wps_ie == NULL)
                goto fail;
-
+       if (!wpa_s->conf->p2p_6ghz_disable)
+               params->p2p_include_6ghz = include_6ghz;
        switch (type) {
        case P2P_SCAN_SOCIAL:
                params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) + 1,
@@ -7191,7 +7193,8 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
                  enum p2p_discovery_type type,
                  unsigned int num_req_dev_types, const u8 *req_dev_types,
                  const u8 *dev_id, unsigned int search_delay,
-                 u8 seek_cnt, const char **seek_string, int freq)
+                 u8 seek_cnt, const char **seek_string, int freq,
+                 bool include_6ghz)
 {
        wpas_p2p_clear_pending_action_tx(wpa_s);
        wpa_s->global->p2p_long_listen = 0;
@@ -7210,7 +7213,8 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
 
        return p2p_find(wpa_s->global->p2p, timeout, type,
                        num_req_dev_types, req_dev_types, dev_id,
-                       search_delay, seek_cnt, seek_string, freq);
+                       search_delay, seek_cnt, seek_string, freq,
+                       include_6ghz);
 }
 
 
index 61f2d5233316fb8cb5242c4c27b1d1cf2f24d117..6c11a8dec09bda7893fcf0048da2702c4a5de5fc 100644 (file)
@@ -73,7 +73,8 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
                  enum p2p_discovery_type type,
                  unsigned int num_req_dev_types, const u8 *req_dev_types,
                  const u8 *dev_id, unsigned int search_delay,
-                 u8 seek_cnt, const char **seek_string, int freq);
+                 u8 seek_cnt, const char **seek_string, int freq,
+                 bool include_6ghz);
 void wpas_p2p_stop_find(struct wpa_supplicant *wpa_s);
 int wpas_p2p_listen(struct wpa_supplicant *wpa_s, unsigned int timeout);
 int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s, unsigned int timeout);
index c194806cd7f20d239525b3af5bfe3dc18108d3a5..97a8d9a638d6af31bf1d5176f341f8d5d1da82da 100644 (file)
@@ -2850,6 +2850,7 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src)
        params->relative_rssi = src->relative_rssi;
        params->relative_adjust_band = src->relative_adjust_band;
        params->relative_adjust_rssi = src->relative_adjust_rssi;
+       params->p2p_include_6ghz = src->p2p_include_6ghz;
        return params;
 
 failed: