P2P: Fix after_scan_tx processing during ongoing operations

When Action frame TX is postponed until a pending p2p_scan completes,
there may be additional operations that need to be continued after the
postponed Action frame TX operation completes. Fix this by starting
pending operation (if any) from TX status event for after_scan_tx
frames.

This fixes common errors seen with the test_discovery hwsim test case.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-04-23 21:12:04 +03:00
parent 06b7f58def
commit 63a965c313
2 changed files with 16 additions and 2 deletions

View file

@ -941,8 +941,7 @@ static int p2p_run_after_scan(struct p2p_data *p2p)
enum p2p_after_scan op;
if (p2p->after_scan_tx) {
/* TODO: schedule p2p_run_after_scan to be called from TX
* status callback(?) */
p2p->after_scan_tx_in_progress = 1;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Send pending "
"Action frame at p2p_scan completion");
p2p->cfg->send_action(p2p->cfg->cb_ctx,
@ -3050,6 +3049,18 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
switch (state) {
case P2P_NO_PENDING_ACTION:
if (p2p->after_scan_tx_in_progress) {
p2p->after_scan_tx_in_progress = 0;
if (p2p->start_after_scan != P2P_AFTER_SCAN_NOTHING &&
p2p_run_after_scan(p2p))
break;
if (p2p->state == P2P_SEARCH) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Continue find after "
"after_scan_tx completion");
p2p_continue_find(p2p);
}
}
break;
case P2P_PENDING_GO_NEG_REQUEST:
p2p_go_neg_req_cb(p2p, success);
@ -3085,6 +3096,8 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
p2p_go_disc_req_cb(p2p, success);
break;
}
p2p->after_scan_tx_in_progress = 0;
}

View file

@ -385,6 +385,7 @@ struct p2p_data {
} start_after_scan;
u8 after_scan_peer[ETH_ALEN];
struct p2p_pending_action_tx *after_scan_tx;
unsigned int after_scan_tx_in_progress:1;
/* Requested device types for find/search */
unsigned int num_req_dev_types;