SiliconLabs / wfx-fullMAC-driver

Silicon Laboratories WFx Wi-Fi Full-MAC driver
23 stars 9 forks source link

Waited event sync issue after call to sl_wfx_send_ethernet_frame() #1

Closed mbruno-xmos closed 4 years ago

mbruno-xmos commented 4 years ago

When sending an Ethernet frame with sl_wfx_send_ethernet_frame() a waited event is set up by sl_wfx_send_request(). All other driver functions that call sl_wfx_send_request() then wait for the event by calling sl_wfx_host_wait_for_confirmation(), but sl_wfx_send_ethernet_frame() does not. I imagine this could be for performance reasons, so that the application can move on without waiting for the wf200 to respond. However, this means that a subsequent call to another driver function that calls sl_wfx_send_request() followed by sl_wfx_host_wait_for_confirmation(), for example sl_wfx_send_disconnect_command(), will return a failure code. This is because sl_wfx_host_wait_for_confirmation() will be expecting the confirmation for the disconnect command but will see the confirmation for the send frame command.

This can be worked around in the host code by having sl_wfx_host_setup_waited_event() ignore calls to it when event_id is SL_WFX_SEND_FRAME_REQ_ID. Alternatively the application could call sl_wfx_host_wait_for_confirmation() after calling sl_wfx_send_ethernet_frame(). However the example applications in the wfx-fullMAC-tools repository do neither of these things and it appears that they likely are affected by this.

silabs-JulienT commented 4 years ago

Thanks for reporting the issue. The bug will be fixed in a new driver version 2.4.0 by calling the sl_wfx_host_setup_waited_event() under condition (the condition being (command_id != SL_WFX_SEND_FRAME_REQ_ID)) in the sl_wfx_send_request().

mbruno-xmos commented 4 years ago

Perfect, thanks.

mbruno-xmos commented 4 years ago

You may also want to skip it for SL_WFX_SHUT_DOWN_REQ_ID.

silabs-JulienT commented 4 years ago

Fixed in driver 2.4.0