P2P: Allow 6 GHz channels to be included in the P2P_FIND operation

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>
This commit is contained in:
Sreeramya Soratkal 2021-05-04 12:52:37 +05:30 committed by Jouni Malinen
parent a06c7d50f9
commit 6423c23e3d
9 changed files with 40 additions and 17 deletions

View file

@ -645,6 +645,12 @@ struct wpa_driver_scan_params {
*/ */
unsigned int oce_scan:1; 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 * NOTE: Whenever adding new parameters here, please make sure
* wpa_scan_clone_params() and wpa_scan_free_params() get updated with * wpa_scan_clone_params() and wpa_scan_free_params() get updated with

View file

@ -1035,7 +1035,7 @@ static void p2p_search(struct p2p_data *p2p)
res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, type, freq, res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, type, freq,
p2p->num_req_dev_types, p2p->req_dev_types, 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) { if (res < 0) {
p2p_dbg(p2p, "Scan request schedule failed"); p2p_dbg(p2p, "Scan request schedule failed");
p2p_continue_find(p2p); p2p_continue_find(p2p);
@ -1159,7 +1159,7 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
enum p2p_discovery_type type, enum p2p_discovery_type type,
unsigned int num_req_dev_types, const u8 *req_dev_types, unsigned int num_req_dev_types, const u8 *req_dev_types,
const u8 *dev_id, unsigned int search_delay, 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; int res;
struct os_reltime start; 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; p2p->find_dev_id = p2p->find_dev_id_buf;
} else } else
p2p->find_dev_id = NULL; p2p->find_dev_id = NULL;
p2p->include_6ghz = p2p_wfd_enabled(p2p) && include_6ghz;
if (seek_count == 0 || !seek) { if (seek_count == 0 || !seek) {
/* Not an ASP search */ /* Not an ASP search */
p2p->p2ps_seek = 0; p2p->p2ps_seek = 0;
@ -1260,7 +1260,8 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
P2P_SCAN_SPECIFIC, freq, P2P_SCAN_SPECIFIC, freq,
p2p->num_req_dev_types, p2p->num_req_dev_types,
p2p->req_dev_types, dev_id, p2p->req_dev_types, dev_id,
DEV_PW_DEFAULT); DEV_PW_DEFAULT,
p2p->include_6ghz);
break; break;
} }
/* fall through */ /* 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, res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, P2P_SCAN_FULL, 0,
p2p->num_req_dev_types, p2p->num_req_dev_types,
p2p->req_dev_types, dev_id, p2p->req_dev_types, dev_id,
DEV_PW_DEFAULT); DEV_PW_DEFAULT, p2p->include_6ghz);
break; break;
case P2P_FIND_ONLY_SOCIAL: case P2P_FIND_ONLY_SOCIAL:
res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, P2P_SCAN_SOCIAL, 0, res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx, P2P_SCAN_SOCIAL, 0,
p2p->num_req_dev_types, p2p->num_req_dev_types,
p2p->req_dev_types, dev_id, p2p->req_dev_types, dev_id,
DEV_PW_DEFAULT); DEV_PW_DEFAULT, p2p->include_6ghz);
break; break;
default: default:
return -1; return -1;

View file

@ -612,6 +612,7 @@ struct p2p_config {
* @req_dev_types: Array containing requested device types * @req_dev_types: Array containing requested device types
* @dev_id: Device ID to search for or %NULL to find all devices * @dev_id: Device ID to search for or %NULL to find all devices
* @pw_id: Device Password ID * @pw_id: Device Password ID
* @include_6ghz: Include 6 GHz channels in P2P scan
* Returns: 0 on success, -1 on failure * Returns: 0 on success, -1 on failure
* *
* This callback function is used to request a P2P scan or search * 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, int (*p2p_scan)(void *ctx, enum p2p_scan_type type, int freq,
unsigned int num_req_dev_types, 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 * 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. * P2P_FIND_START_WITH_FULL behavior. 0 = Use normal full scan.
* If p2p_find is already in progress, this parameter is ignored and full * If p2p_find is already in progress, this parameter is ignored and full
* scan will be executed. * scan will be executed.
* @include_6ghz: Include 6 GHz channels in P2P find
* Returns: 0 on success, -1 on failure * Returns: 0 on success, -1 on failure
*/ */
int p2p_find(struct p2p_data *p2p, unsigned int timeout, int p2p_find(struct p2p_data *p2p, unsigned int timeout,
enum p2p_discovery_type type, enum p2p_discovery_type type,
unsigned int num_req_dev_types, const u8 *req_dev_types, unsigned int num_req_dev_types, const u8 *req_dev_types,
const u8 *dev_id, unsigned int search_delay, 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 * p2p_notify_scan_trigger_status - Indicate scan trigger status

View file

@ -549,6 +549,7 @@ struct p2p_data {
u8 override_pref_op_class; u8 override_pref_op_class;
u8 override_pref_channel; u8 override_pref_channel;
bool p2p_6ghz_capable; bool p2p_6ghz_capable;
bool include_6ghz;
}; };
/** /**

View 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; const char *_seek[P2P_MAX_QUERY_HASH + 1], **seek = NULL;
u8 seek_count = 0; u8 seek_count = 0;
int freq = 0; int freq = 0;
bool include_6ghz = false;
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) { if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
wpa_dbg(wpa_s, MSG_INFO, wpa_dbg(wpa_s, MSG_INFO,
"Reject P2P_FIND since interface is disabled"); "Reject P2P_FIND since interface is disabled");
return -1; return -1;
} }
if (os_strstr(cmd, " include_6ghz"))
include_6ghz = true;
if (os_strstr(cmd, "type=social")) if (os_strstr(cmd, "type=social"))
type = P2P_FIND_ONLY_SOCIAL; type = P2P_FIND_ONLY_SOCIAL;
else if (os_strstr(cmd, "type=progressive")) 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, 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);
} }

View 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, 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( reply = wpas_dbus_error_unknown_error(
message, "Could not start P2P find"); message, "Could not start P2P find");

View file

@ -347,9 +347,9 @@ static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
params->only_new_results = 1; 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, 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, wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, params,
0); 0);
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params, 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, static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
unsigned int num_req_dev_types, 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_supplicant *wpa_s = ctx;
struct wpa_driver_scan_params *params = NULL; 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); num_req_dev_types, req_dev_types);
if (wps_ie == NULL) if (wps_ie == NULL)
goto fail; goto fail;
if (!wpa_s->conf->p2p_6ghz_disable)
params->p2p_include_6ghz = include_6ghz;
switch (type) { switch (type) {
case P2P_SCAN_SOCIAL: case P2P_SCAN_SOCIAL:
params->freqs = os_calloc(ARRAY_SIZE(social_channels_freq) + 1, 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, enum p2p_discovery_type type,
unsigned int num_req_dev_types, const u8 *req_dev_types, unsigned int num_req_dev_types, const u8 *req_dev_types,
const u8 *dev_id, unsigned int search_delay, 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); wpas_p2p_clear_pending_action_tx(wpa_s);
wpa_s->global->p2p_long_listen = 0; 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, return p2p_find(wpa_s->global->p2p, timeout, type,
num_req_dev_types, req_dev_types, dev_id, 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);
} }

View file

@ -73,7 +73,8 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
enum p2p_discovery_type type, enum p2p_discovery_type type,
unsigned int num_req_dev_types, const u8 *req_dev_types, unsigned int num_req_dev_types, const u8 *req_dev_types,
const u8 *dev_id, unsigned int search_delay, 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); 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(struct wpa_supplicant *wpa_s, unsigned int timeout);
int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s, unsigned int timeout); int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s, unsigned int timeout);

View file

@ -2850,6 +2850,7 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src)
params->relative_rssi = src->relative_rssi; params->relative_rssi = src->relative_rssi;
params->relative_adjust_band = src->relative_adjust_band; params->relative_adjust_band = src->relative_adjust_band;
params->relative_adjust_rssi = src->relative_adjust_rssi; params->relative_adjust_rssi = src->relative_adjust_rssi;
params->p2p_include_6ghz = src->p2p_include_6ghz;
return params; return params;
failed: failed: