P2P: Add support for 60 GHz social channel
Support 60 GHz band in P2P module by selecting random social channel from all supported social channels in 2.4 GHz and 60 GHz bands. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
b6ebdfbedd
commit
1595eb93ae
4 changed files with 108 additions and 36 deletions
|
@ -1287,8 +1287,8 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
|
|||
} else if (p2p_channel_random_social(&p2p->cfg->channels,
|
||||
&p2p->op_reg_class,
|
||||
&p2p->op_channel) == 0) {
|
||||
p2p_dbg(p2p, "Select random available social channel %d from 2.4 GHz band as operating channel preference",
|
||||
p2p->op_channel);
|
||||
p2p_dbg(p2p, "Select random available social channel (op_class %u channel %u) as operating channel preference",
|
||||
p2p->op_reg_class, p2p->op_channel);
|
||||
} else {
|
||||
/* Select any random available channel from the first available
|
||||
* operating class */
|
||||
|
@ -4095,6 +4095,13 @@ void p2p_set_managed_oper(struct p2p_data *p2p, int enabled)
|
|||
}
|
||||
|
||||
|
||||
int p2p_config_get_random_social(struct p2p_config *p2p, u8 *op_class,
|
||||
u8 *op_channel)
|
||||
{
|
||||
return p2p_channel_random_social(&p2p->channels, op_class, op_channel);
|
||||
}
|
||||
|
||||
|
||||
int p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel,
|
||||
u8 forced)
|
||||
{
|
||||
|
|
|
@ -1691,6 +1691,20 @@ void p2p_set_client_discoverability(struct p2p_data *p2p, int enabled);
|
|||
*/
|
||||
void p2p_set_managed_oper(struct p2p_data *p2p, int enabled);
|
||||
|
||||
/**
|
||||
* p2p_config_get_random_social - Return a random social channel
|
||||
* @p2p: P2P config
|
||||
* @op_class: Selected operating class
|
||||
* @op_channel: Selected social channel
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This function is used before p2p_init is called. A random social channel
|
||||
* from supports bands 2.4 GHz (channels 1,6,11) and 60 GHz (channel 2) is
|
||||
* returned on success.
|
||||
*/
|
||||
int p2p_config_get_random_social(struct p2p_config *p2p, u8 *op_class,
|
||||
u8 *op_channel);
|
||||
|
||||
int p2p_set_listen_channel(struct p2p_data *p2p, u8 reg_class, u8 channel,
|
||||
u8 forced);
|
||||
|
||||
|
|
|
@ -149,6 +149,15 @@ int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (freq >= 58320 && freq <= 64800) {
|
||||
if ((freq - 58320) % 2160)
|
||||
return -1;
|
||||
|
||||
*op_class = 180; /* 60 GHz, channels 1..4 */
|
||||
*channel = (freq - 56160) / 2160;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -482,7 +491,7 @@ int p2p_channel_select(struct p2p_channels *chans, const int *classes,
|
|||
int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class,
|
||||
u8 *op_channel)
|
||||
{
|
||||
u8 chan[3];
|
||||
u8 chan[4];
|
||||
unsigned int num_channels = 0;
|
||||
|
||||
/* Try to find available social channels from 2.4 GHz */
|
||||
|
@ -493,11 +502,18 @@ int p2p_channel_random_social(struct p2p_channels *chans, u8 *op_class,
|
|||
if (p2p_channels_includes(chans, 81, 11))
|
||||
chan[num_channels++] = 11;
|
||||
|
||||
/* Try to find available social channels from 60 GHz */
|
||||
if (p2p_channels_includes(chans, 180, 2))
|
||||
chan[num_channels++] = 2;
|
||||
|
||||
if (num_channels == 0)
|
||||
return -1;
|
||||
|
||||
*op_class = 81;
|
||||
*op_channel = p2p_channel_pick_random(chan, num_channels);
|
||||
if (*op_channel == 2)
|
||||
*op_class = 180;
|
||||
else
|
||||
*op_class = 81;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue