]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Use larger GO config timeout if HT40 is used
authorJouni Malinen <j@w1.fi>
Wed, 15 Aug 2012 20:19:11 +0000 (23:19 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 15 Aug 2012 20:19:11 +0000 (23:19 +0300)
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>

src/p2p/p2p.c
src/p2p/p2p.h
src/p2p/p2p_go_neg.c
src/p2p/p2p_i.h
src/p2p/p2p_invitation.c
wpa_supplicant/p2p_supplicant.c

index 80b345ad2a375fb9fa19bb532c10cd0d4eceec97..16196ceec7cfd4a3ff79ad55cc6890e7ab45b766 100644 (file)
@@ -2278,6 +2278,9 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)
        eloop_register_timeout(P2P_PEER_EXPIRATION_INTERVAL, 0,
                               p2p_expiration_timeout, p2p, NULL);
 
+       p2p->go_timeout = 100;
+       p2p->client_timeout = 20;
+
        return p2p;
 }
 
@@ -3959,3 +3962,13 @@ int p2p_in_progress(struct p2p_data *p2p)
                return 0;
        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;
+       }
+}
index 90152b8c578814f63ea887d7b2e3ddc8dcf1da3b..d8a3ff176834b2e48e4e08e7be91b98e3f3d9f4f 100644 (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);
 
+/**
+ * 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 */
index 8d74cfb276127b6b123addf3648791343c2f881b..719dca4b248fc26b8bc531cea204b3b41891c0b2 100644 (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->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->cfg->channel);
        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,
                               group_capab);
        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) {
                wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating "
                        "Channel attribute");
index 39e879edf688c65067bf487fd21ea4be936e7fcd..027cad25219b653e44c5c8315d9138a409573fe6 100644 (file)
@@ -424,6 +424,9 @@ struct p2p_data {
         * in IDLE state.
         */
        int pd_retries;
+
+       u8 go_timeout;
+       u8 client_timeout;
 };
 
 /**
index 592554958499a1b86fa3bc5fa114038b14e0d0bb..caedfb30dadeae49930a9fe74bc8447d041ddab2 100644 (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)
                p2p_buf_add_config_timeout(buf, 0, 0);
        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_INVITATION_FLAGS_TYPE : 0);
        p2p_buf_add_operating_channel(buf, p2p->cfg->country,
index 33d5efa54bc51ee577be65cdc4d6eae70b637c44..27b7e349d97c0462acdafab14de86d870d0d99eb 100644 (file)
@@ -2670,6 +2670,13 @@ static int wpas_p2p_start_go_neg(struct wpa_supplicant *wpa_s,
                                           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,
                           go_intent, own_interface_addr, force_freq,
                           persistent_group, ssid ? ssid->ssid : NULL,