Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lorawan: unconfirmed messages leave stack in busy state #33456

Closed
JordanYates opened this issue Mar 18, 2021 · 0 comments · Fixed by #34366
Closed

lorawan: unconfirmed messages leave stack in busy state #33456

JordanYates opened this issue Mar 18, 2021 · 0 comments · Fixed by #34366
Labels
area: LoRa Enhancement Changes/Updates/Additions to existing features

Comments

@JordanYates
Copy link
Collaborator

Is your enhancement proposal related to a problem? Please describe.

The current implementation of lorawan_send only waits for the transmission to complete if the LORAWAN_MSG_CONFIRMED flag is set. For unconfirmed transmissions, the application is free to call lorawan_send again before the receive windows for the first transmissions have finished, resulting in lorawan_send returning -EBUSY.

Ideally there would be some application level way to wait until the stack is ready to accept new commands/transmissions.
This can be done without changes to the stack as McpsConfirm is already called when all transmissions complete.

Describe the solution you'd like

The simplest solution I have identified is forlorawan_send to always wait on the mcps_confirm_sem, regardless of the confirmed flag. This would add some application level latency for unconfirmed transitions if the application was already guaranteeing sufficient packet spacing.

Alternative solutions include:

  • Adding an additional flag to signify the driver should wait for unconfirmed transmissions to complete.
  • Adding a new function that blocks until the stack is ready to accept new commands.

I'm not sure if the second alternative is feasible, as it sounds like waiting on a boolean flag.

Describe alternatives you've considered

The application could either wait for some fixed time period after each unconfirmed transmission, or delay and retry if -EBUSY is returned. Neither solution is very nice, as the LoRaWAN driver already knows when the stack is ready again.

@JordanYates JordanYates added the Enhancement Changes/Updates/Additions to existing features label Mar 18, 2021
ioannisg pushed a commit that referenced this issue Apr 20, 2021
Wait for MAC operations to complete when transmitting. Unconfirmed
messages still open receive windows and can cause error conditions,
which are currently dropped.

It is also possible for a second send to be requested before the first
one has finished processing, which results in `LORAMAC_STATUS_BUSY`.
Empty frames (due to insufficient payload space) now also block until
the MAC layer is ready to accept new commands.

This change means the application no longer needs to guess-and-check
when it is possible to send unconfirmed messages.

Fixes #33456.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
jmahkye pushed a commit to cdo2com/zephyr that referenced this issue Apr 20, 2021
Wait for MAC operations to complete when transmitting. Unconfirmed
messages still open receive windows and can cause error conditions,
which are currently dropped.

It is also possible for a second send to be requested before the first
one has finished processing, which results in `LORAMAC_STATUS_BUSY`.
Empty frames (due to insufficient payload space) now also block until
the MAC layer is ready to accept new commands.

This change means the application no longer needs to guess-and-check
when it is possible to send unconfirmed messages.

Fixes zephyrproject-rtos#33456.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LoRa Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants