diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 561882d0d..804ac6806 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -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 diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 3148aeb3d..09ee51089 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -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; diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 24b0677e7..17809a661 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -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 diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index b4e3c4401..b778efad8 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -549,6 +549,7 @@ struct p2p_data { u8 override_pref_op_class; u8 override_pref_channel; bool p2p_6ghz_capable; + bool include_6ghz; }; /** diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index ba91cfb11..37329704d 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -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); } diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index 7a6567330..f7632e4ec 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -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"); diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index df676552c..2012fa58e 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -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); } diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 61f2d5233..6c11a8dec 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -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); diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index c194806cd..97a8d9a63 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -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: