wifi_drv: split front end notification

Issue #3139.
This commit is contained in:
Josef Söntgen 2019-01-31 17:00:43 +01:00 committed by Norman Feske
parent 8f47609024
commit ac59b68257
4 changed files with 18 additions and 4 deletions

View File

@ -35,6 +35,7 @@ void wpa_ctrl_set_fd(void);
void *wifi_get_buffer(void);
void wifi_notify_cmd_result(void);
void wifi_block_for_processing(void);
void wifi_notify_event(void);

View File

@ -1501,6 +1501,7 @@ struct Wifi::Frontend
char const *msg = reinterpret_cast<char const*>(_msg.recv);
unsigned const recv_id = _msg.recv_id;
/* return early */
if (_last_recv_id == recv_id) {
_notify_lock_unlock();

View File

@ -35,7 +35,7 @@ static Wifi::Frontend *_wifi_frontend = nullptr;
* Called by the CTRL interface after wpa_supplicant has processed
* the command.
*/
void wifi_notify_cmd_result(void)
void wifi_block_for_processing(void)
{
if (!_wifi_frontend) {
Genode::warning("frontend not available, dropping notification");
@ -50,6 +50,15 @@ void wifi_notify_cmd_result(void)
/* XXX hack to trick poll() into returning faster */
wpa_ctrl_set_fd();
}
void wifi_notify_cmd_result(void)
{
if (!_wifi_frontend) {
Genode::warning("frontend not available, dropping notification");
return;
}
Genode::Signal_transmitter(_wifi_frontend->result_sigh()).submit();
}

View File

@ -115,19 +115,22 @@ static void wpa_supplicant_ctrl_iface_receive(int fd, void *eloop_ctx,
&reply_len);
if (reply) {
wifi_notify_cmd_result();
wifi_block_for_processing();
send_reply(priv, reply, reply_len);
wifi_notify_cmd_result();
os_free(reply);
} else
if (reply_len == 1) {
wifi_notify_cmd_result();
wifi_block_for_processing();
send_reply(priv, "FAIL", 4);
wifi_notify_cmd_result();
} else
if (reply_len == 2) {
wifi_notify_cmd_result();
wifi_block_for_processing();
send_reply(priv, "OK", 2);
wifi_notify_cmd_result();
}
}