TDLS: Retry TDLS Setup Response more quickly
authorSunil Dutt <duttus@codeaurora.org>
Mon, 20 May 2013 10:07:24 +0000 (15:37 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 20 May 2013 18:30:27 +0000 (21:30 +0300)
TDLS responder STA used to retransmit the TDLS Setup Response after 5
seconds if the TDLS Setup Confirm is not received. The initiator would
have enabled the TDLS link and started transmitting the data to the peer
on the TDLS link after transmitting the TDLS Setup Confirm frame. If the
TDLS Setup Confirm frame is not received by the receiver, the
transmissions from the initiator on the direct link would get failed for
the TDLS link not getting enabled on the receiver. This commit reduces
the data delivery failure duration by shortening the retry time of the
TDLS Setup Response frames. The retry limit of the TDLS Response frame
also is increased to ensure that the peer does not miss the frames in
the reduced time period.

Signed-hostap: Sunil Dutt <duttus@codeaurora.org>

src/rsn_supp/tdls.c

index 81e2a5c..221d5fd 100644 (file)
@@ -37,8 +37,10 @@ unsigned int tdls_testing = 0;
 #endif /* CONFIG_TDLS_TESTING */
 
 #define TPK_LIFETIME 43200 /* 12 hours */
-#define TPK_RETRY_COUNT 3
-#define TPK_TIMEOUT 5000 /* in milliseconds */
+#define TPK_M1_RETRY_COUNT 3
+#define TPK_M1_TIMEOUT 5000 /* in milliseconds */
+#define TPK_M2_RETRY_COUNT 10
+#define TPK_M2_TIMEOUT 500 /* in milliseconds */
 
 #define TDLS_MIC_LEN           16
 
@@ -244,8 +246,13 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
 
        eloop_cancel_timeout(wpa_tdls_tpk_retry_timeout, sm, peer);
 
-       peer->sm_tmr.count = TPK_RETRY_COUNT;
-       peer->sm_tmr.timer = TPK_TIMEOUT;
+       if (action_code == WLAN_TDLS_SETUP_RESPONSE) {
+               peer->sm_tmr.count = TPK_M2_RETRY_COUNT;
+               peer->sm_tmr.timer = TPK_M2_TIMEOUT;
+       } else {
+               peer->sm_tmr.count = TPK_M1_RETRY_COUNT;
+               peer->sm_tmr.timer = TPK_M1_TIMEOUT;
+       }
 
        /* Copy message to resend on timeout */
        os_memcpy(peer->sm_tmr.dest, dest, ETH_ALEN);
@@ -261,7 +268,8 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
 
        wpa_printf(MSG_DEBUG, "TDLS: Retry timeout registered "
                   "(action_code=%u)", action_code);
-       eloop_register_timeout(peer->sm_tmr.timer / 1000, 0,
+       eloop_register_timeout(peer->sm_tmr.timer / 1000,
+                              (peer->sm_tmr.timer % 1000) * 1000,
                               wpa_tdls_tpk_retry_timeout, sm, peer);
        return 0;
 }
@@ -296,7 +304,6 @@ static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
 
        if (peer->sm_tmr.count) {
                peer->sm_tmr.count--;
-               peer->sm_tmr.timer = TPK_TIMEOUT;
 
                wpa_printf(MSG_INFO, "TDLS: Retrying sending of message "
                           "(action_code=%u)",
@@ -323,7 +330,8 @@ static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
                }
 
                eloop_cancel_timeout(wpa_tdls_tpk_retry_timeout, sm, peer);
-               eloop_register_timeout(peer->sm_tmr.timer / 1000, 0,
+               eloop_register_timeout(peer->sm_tmr.timer / 1000,
+                                      (peer->sm_tmr.timer % 1000) * 1000,
                                       wpa_tdls_tpk_retry_timeout, sm, peer);
        } else {
                eloop_cancel_timeout(wpa_tdls_tpk_retry_timeout, sm, peer);