P2P: Allow all channels in case of multi channel concurrency
If multi channel concurrency is supported, we have to populate the p2p_channels with list of channels that we support. Use the same design that was previously added for GO Negotiation. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
851b73eb28
commit
79879f4ae8
5 changed files with 114 additions and 29 deletions
|
@ -1259,8 +1259,8 @@ static void p2p_prepare_channel_best(struct p2p_data *p2p)
|
|||
* may be further optimized in p2p_reselect_channel() once the peer information
|
||||
* is available.
|
||||
*/
|
||||
static int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
|
||||
unsigned int force_freq, unsigned int pref_freq)
|
||||
int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
|
||||
unsigned int force_freq, unsigned int pref_freq)
|
||||
{
|
||||
if (force_freq || pref_freq) {
|
||||
if (p2p_prepare_channel_pref(p2p, force_freq, pref_freq) < 0)
|
||||
|
|
|
@ -1042,12 +1042,14 @@ enum p2p_invite_role {
|
|||
* @force_freq: The only allowed channel frequency in MHz or 0
|
||||
* @go_dev_addr: Forced GO Device Address or %NULL if none
|
||||
* @persistent_group: Whether this is to reinvoke a persistent group
|
||||
* @pref_freq: Preferred operating frequency in MHz or 0 (this is only used if
|
||||
* force_freq == 0)
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
|
||||
const u8 *bssid, const u8 *ssid, size_t ssid_len,
|
||||
unsigned int force_freq, const u8 *go_dev_addr,
|
||||
int persistent_group);
|
||||
int persistent_group, unsigned int pref_freq);
|
||||
|
||||
/**
|
||||
* p2p_presence_req - Request GO presence
|
||||
|
|
|
@ -713,5 +713,7 @@ int p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
|
|||
const u8 *src, const u8 *bssid, const u8 *buf,
|
||||
size_t len, unsigned int wait_time);
|
||||
void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq);
|
||||
int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
|
||||
unsigned int force_freq, unsigned int pref_freq);
|
||||
|
||||
#endif /* P2P_I_H */
|
||||
|
|
|
@ -531,7 +531,7 @@ void p2p_invitation_resp_cb(struct p2p_data *p2p, int success)
|
|||
int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
|
||||
const u8 *bssid, const u8 *ssid, size_t ssid_len,
|
||||
unsigned int force_freq, const u8 *go_dev_addr,
|
||||
int persistent_group)
|
||||
int persistent_group, unsigned int pref_freq)
|
||||
{
|
||||
struct p2p_device *dev;
|
||||
|
||||
|
@ -561,6 +561,9 @@ int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (p2p_prepare_channel(p2p, dev, force_freq, pref_freq) < 0)
|
||||
return -1;
|
||||
|
||||
if (dev->flags & P2P_DEV_GROUP_CLIENT_ONLY) {
|
||||
if (!(dev->info.dev_capab &
|
||||
P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
|
||||
|
@ -574,26 +577,6 @@ int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
|
|||
|
||||
dev->invitation_reqs = 0;
|
||||
|
||||
if (force_freq) {
|
||||
if (p2p_freq_to_channel(p2p->cfg->country, force_freq,
|
||||
&p2p->op_reg_class, &p2p->op_channel) <
|
||||
0) {
|
||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
|
||||
"P2P: Unsupported frequency %u MHz",
|
||||
force_freq);
|
||||
return -1;
|
||||
}
|
||||
p2p->channels.reg_classes = 1;
|
||||
p2p->channels.reg_class[0].channels = 1;
|
||||
p2p->channels.reg_class[0].reg_class = p2p->op_reg_class;
|
||||
p2p->channels.reg_class[0].channel[0] = p2p->op_channel;
|
||||
} else {
|
||||
p2p->op_reg_class = p2p->cfg->op_reg_class;
|
||||
p2p->op_channel = p2p->cfg->op_channel;
|
||||
os_memcpy(&p2p->channels, &p2p->cfg->channels,
|
||||
sizeof(struct p2p_channels));
|
||||
}
|
||||
|
||||
if (p2p->state != P2P_IDLE)
|
||||
p2p_stop_find(p2p);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue