From 360a9d5a8f8b6c35319229fc13fdf0a86700b023 Mon Sep 17 00:00:00 2001 From: Avraham Stern Date: Mon, 25 Jan 2016 12:28:48 +0200 Subject: [PATCH] P2P: Reduce off channel wait time for some P2P Action frames Setting a long off channel wait time for P2P Action frames when we know we are already on the right channel may cause a delay in sending the Action frame (because the driver may not be able to satisfy the request for long wait time until previous off channel requests are over). This may be crucial for P2P response frames that must be sent within 100 milliseconds of receiving the request. Fix this by adjusting P2P Action frame wait times as follows: 1. For GO Negotiation Response frame, shorten the wait time to 100 ms. This is reasonable because the peer has just sent us the GO Negotiation Request frame, so it is known to be on the right channel and is probably ready to send us the GO Negotiation Confirmation frame without delay. 2. For GO Negotiation Confirmation, P2P Invitation Response, and Provision Discovery Response frames, there is no need for wait time at all as this is the last frame in the exchange. So set the wait time to 50 ms to ensure there is enough time to send the frame. Signed-off-by: Avraham Stern --- src/p2p/p2p_go_neg.c | 4 ++-- src/p2p/p2p_invitation.c | 2 +- src/p2p/p2p_pd.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index 049ce6e93..fe0096f14 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -1060,7 +1060,7 @@ fail: P2P_PENDING_GO_NEG_RESPONSE_FAILURE; if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, p2p->cfg->dev_addr, - wpabuf_head(resp), wpabuf_len(resp), 500) < 0) { + wpabuf_head(resp), wpabuf_len(resp), 100) < 0) { p2p_dbg(p2p, "Failed to send Action frame"); } @@ -1394,7 +1394,7 @@ fail: if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, sa, wpabuf_head(dev->go_neg_conf), - wpabuf_len(dev->go_neg_conf), 200) < 0) { + wpabuf_len(dev->go_neg_conf), 50) < 0) { p2p_dbg(p2p, "Failed to send Action frame"); p2p_go_neg_failed(p2p, -1); p2p->cfg->send_action_done(p2p->cfg->cb_ctx); diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c index 70da15a96..bbba001a7 100644 --- a/src/p2p/p2p_invitation.c +++ b/src/p2p/p2p_invitation.c @@ -418,7 +418,7 @@ fail: p2p->pending_action_state = P2P_PENDING_INVITATION_RESPONSE; if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, p2p->cfg->dev_addr, - wpabuf_head(resp), wpabuf_len(resp), 200) < 0) { + wpabuf_head(resp), wpabuf_len(resp), 50) < 0) { p2p_dbg(p2p, "Failed to send Action frame"); } diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c index d70a43c2d..e6535d411 100644 --- a/src/p2p/p2p_pd.c +++ b/src/p2p/p2p_pd.c @@ -997,7 +997,7 @@ out: if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, p2p->cfg->dev_addr, wpabuf_head(resp), wpabuf_len(resp), - 200) < 0) + 50) < 0) p2p_dbg(p2p, "Failed to send Action frame"); else p2p->send_action_in_progress = 1;