P2P: Use larger GO config timeout if HT40 is used

Increase GO config timeout if HT40 is used since it takes some time
to scan channels for coex purposes before the BSS can be started.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-08-15 23:19:11 +03:00
parent e2308e4b45
commit 4f219667d7
6 changed files with 36 additions and 3 deletions

View file

@ -2278,6 +2278,9 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)
eloop_register_timeout(P2P_PEER_EXPIRATION_INTERVAL, 0, eloop_register_timeout(P2P_PEER_EXPIRATION_INTERVAL, 0,
p2p_expiration_timeout, p2p, NULL); p2p_expiration_timeout, p2p, NULL);
p2p->go_timeout = 100;
p2p->client_timeout = 20;
return p2p; return p2p;
} }
@ -3959,3 +3962,13 @@ int p2p_in_progress(struct p2p_data *p2p)
return 0; return 0;
return p2p->state != P2P_IDLE && p2p->state != P2P_PROVISIONING; return p2p->state != P2P_IDLE && p2p->state != P2P_PROVISIONING;
} }
void p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout,
u8 client_timeout)
{
if (p2p) {
p2p->go_timeout = go_timeout;
p2p->client_timeout = client_timeout;
}
}

View file

@ -1698,4 +1698,13 @@ int p2p_other_scan_completed(struct p2p_data *p2p);
const char * p2p_wps_method_text(enum p2p_wps_method method); const char * p2p_wps_method_text(enum p2p_wps_method method);
/**
* p2p_set_config_timeout - Set local config timeouts
* @p2p: P2P module context from p2p_init()
* @go_timeout: Time in 10 ms units it takes to start the GO mode
* @client_timeout: Time in 10 ms units it takes to start the client mode
*/
void p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout,
u8 client_timeout);
#endif /* P2P_H */ #endif /* P2P_H */

View file

@ -161,7 +161,7 @@ static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p,
p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) |
p2p->next_tie_breaker); p2p->next_tie_breaker);
p2p->next_tie_breaker = !p2p->next_tie_breaker; p2p->next_tie_breaker = !p2p->next_tie_breaker;
p2p_buf_add_config_timeout(buf, 100, 20); p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout);
p2p_buf_add_listen_channel(buf, p2p->cfg->country, p2p->cfg->reg_class, p2p_buf_add_listen_channel(buf, p2p->cfg->country, p2p->cfg->reg_class,
p2p->cfg->channel); p2p->cfg->channel);
if (p2p->ext_listen_interval) if (p2p->ext_listen_interval)
@ -274,7 +274,7 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
~P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY, ~P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY,
group_capab); group_capab);
p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker); p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker);
p2p_buf_add_config_timeout(buf, 100, 20); p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout);
if (peer && peer->go_state == REMOTE_GO) { if (peer && peer->go_state == REMOTE_GO) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating " wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating "
"Channel attribute"); "Channel attribute");

View file

@ -424,6 +424,9 @@ struct p2p_data {
* in IDLE state. * in IDLE state.
*/ */
int pd_retries; int pd_retries;
u8 go_timeout;
u8 client_timeout;
}; };
/** /**

View file

@ -36,7 +36,8 @@ static struct wpabuf * p2p_build_invitation_req(struct p2p_data *p2p,
if (p2p->inv_role == P2P_INVITE_ROLE_ACTIVE_GO || !p2p->inv_persistent) if (p2p->inv_role == P2P_INVITE_ROLE_ACTIVE_GO || !p2p->inv_persistent)
p2p_buf_add_config_timeout(buf, 0, 0); p2p_buf_add_config_timeout(buf, 0, 0);
else else
p2p_buf_add_config_timeout(buf, 100, 20); p2p_buf_add_config_timeout(buf, p2p->go_timeout,
p2p->client_timeout);
p2p_buf_add_invitation_flags(buf, p2p->inv_persistent ? p2p_buf_add_invitation_flags(buf, p2p->inv_persistent ?
P2P_INVITATION_FLAGS_TYPE : 0); P2P_INVITATION_FLAGS_TYPE : 0);
p2p_buf_add_operating_channel(buf, p2p->cfg->country, p2p_buf_add_operating_channel(buf, p2p->cfg->country,

View file

@ -2670,6 +2670,13 @@ static int wpas_p2p_start_go_neg(struct wpa_supplicant *wpa_s,
force_freq, persistent_group); force_freq, persistent_group);
} }
/*
* Increase GO config timeout if HT40 is used since it takes some time
* to scan channels for coex purposes before the BSS can be started.
*/
p2p_set_config_timeout(wpa_s->global->p2p,
wpa_s->p2p_go_ht40 ? 255 : 100, 20);
return p2p_connect(wpa_s->global->p2p, peer_addr, wps_method, return p2p_connect(wpa_s->global->p2p, peer_addr, wps_method,
go_intent, own_interface_addr, force_freq, go_intent, own_interface_addr, force_freq,
persistent_group, ssid ? ssid->ssid : NULL, persistent_group, ssid ? ssid->ssid : NULL,