P2P: Include p2p_6ghz_disable in global configuration

Previously, the configuration to disable the 6 GHz band remained local
to the P2P interface. With this there is a possibility of 6 GHz channels
being included in the channel list when the channel list needs to be
updated if the state changes on one of the interfaces.

Include the configuration to disable the 6 GHz band for P2P as a global
configuration value to prevent the inclusion of 6 GHz channels in the
channel list for P2P when the channel list needs to be updated during
the state change in one of the interfaces.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
This commit is contained in:
Sreeramya Soratkal 2020-10-29 19:15:47 +05:30 committed by Jouni Malinen
parent 60c902f408
commit 2ffd3bb4b6
3 changed files with 23 additions and 5 deletions

View File

@ -2913,6 +2913,14 @@ void p2p_group_formation_failed(struct p2p_data *p2p)
} }
bool is_p2p_6ghz_disabled(struct p2p_data *p2p)
{
if (p2p)
return p2p->cfg->p2p_6ghz_disable;
return false;
}
struct p2p_data * p2p_init(const struct p2p_config *cfg) struct p2p_data * p2p_init(const struct p2p_config *cfg)
{ {
struct p2p_data *p2p; struct p2p_data *p2p;

View File

@ -500,6 +500,11 @@ struct p2p_config {
*/ */
struct p2p_channel *pref_chan; struct p2p_channel *pref_chan;
/**
* p2p_6ghz_disable - Disable 6GHz for P2P operations
*/
bool p2p_6ghz_disable;
/** /**
* pri_dev_type - Primary Device Type (see WPS) * pri_dev_type - Primary Device Type (see WPS)
*/ */
@ -2100,6 +2105,8 @@ void p2p_update_channel_list(struct p2p_data *p2p,
const struct p2p_channels *chan, const struct p2p_channels *chan,
const struct p2p_channels *cli_chan); const struct p2p_channels *cli_chan);
bool is_p2p_6ghz_disabled(struct p2p_data *p2p);
/** /**
* p2p_set_best_channels - Update best channel information * p2p_set_best_channels - Update best channel information
* @p2p: P2P module context from p2p_init() * @p2p: P2P module context from p2p_init()

View File

@ -3752,7 +3752,8 @@ static enum chan_allowed wpas_p2p_verify_channel(struct wpa_supplicant *wpa_s,
static int wpas_p2p_setup_channels(struct wpa_supplicant *wpa_s, static int wpas_p2p_setup_channels(struct wpa_supplicant *wpa_s,
struct p2p_channels *chan, struct p2p_channels *chan,
struct p2p_channels *cli_chan) struct p2p_channels *cli_chan,
bool p2p_disable_6ghz)
{ {
struct hostapd_hw_modes *mode; struct hostapd_hw_modes *mode;
int cla, op, cli_cla; int cla, op, cli_cla;
@ -3772,8 +3773,7 @@ static int wpas_p2p_setup_channels(struct wpa_supplicant *wpa_s,
struct p2p_reg_class *reg = NULL, *cli_reg = NULL; struct p2p_reg_class *reg = NULL, *cli_reg = NULL;
if (o->p2p == NO_P2P_SUPP || if (o->p2p == NO_P2P_SUPP ||
(is_6ghz_op_class(o->op_class) && (is_6ghz_op_class(o->op_class) && p2p_disable_6ghz))
wpa_s->conf->p2p_6ghz_disable))
continue; continue;
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, o->mode, mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, o->mode,
@ -4669,6 +4669,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
p2p.prov_disc_resp_cb = wpas_prov_disc_resp_cb; p2p.prov_disc_resp_cb = wpas_prov_disc_resp_cb;
p2p.p2ps_group_capability = p2ps_group_capability; p2p.p2ps_group_capability = p2ps_group_capability;
p2p.get_pref_freq_list = wpas_p2p_get_pref_freq_list; p2p.get_pref_freq_list = wpas_p2p_get_pref_freq_list;
p2p.p2p_6ghz_disable = wpa_s->conf->p2p_6ghz_disable;
os_memcpy(wpa_s->global->p2p_dev_addr, wpa_s->own_addr, ETH_ALEN); os_memcpy(wpa_s->global->p2p_dev_addr, wpa_s->own_addr, ETH_ALEN);
os_memcpy(p2p.dev_addr, wpa_s->global->p2p_dev_addr, ETH_ALEN); os_memcpy(p2p.dev_addr, wpa_s->global->p2p_dev_addr, ETH_ALEN);
@ -4682,7 +4683,8 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
p2p.config_methods = wpa_s->wps->config_methods; p2p.config_methods = wpa_s->wps->config_methods;
} }
if (wpas_p2p_setup_channels(wpa_s, &p2p.channels, &p2p.cli_channels)) { if (wpas_p2p_setup_channels(wpa_s, &p2p.channels, &p2p.cli_channels,
p2p.p2p_6ghz_disable)) {
wpa_printf(MSG_ERROR, wpa_printf(MSG_ERROR,
"P2P: Failed to configure supported channel list"); "P2P: Failed to configure supported channel list");
return -1; return -1;
@ -8018,7 +8020,8 @@ void wpas_p2p_update_channel_list(struct wpa_supplicant *wpa_s,
os_memset(&chan, 0, sizeof(chan)); os_memset(&chan, 0, sizeof(chan));
os_memset(&cli_chan, 0, sizeof(cli_chan)); os_memset(&cli_chan, 0, sizeof(cli_chan));
if (wpas_p2p_setup_channels(wpa_s, &chan, &cli_chan)) { if (wpas_p2p_setup_channels(wpa_s, &chan, &cli_chan,
is_p2p_6ghz_disabled(wpa_s->global->p2p))) {
wpa_printf(MSG_ERROR, "P2P: Failed to update supported " wpa_printf(MSG_ERROR, "P2P: Failed to update supported "
"channel list"); "channel list");
return; return;