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

nrf802154: Add ACK handling capabilities #11150

Closed
wants to merge 7 commits into from

Conversation

bergzand
Copy link
Member

@bergzand bergzand commented Mar 11, 2019

Contribution description

This PR adds ack handling to the nrf802154 radio driver. Both ACKing incoming frames and ACK requests with retransmissions are supported. The number of retransmissions is configurable, but within the bounds specified by IEEE 802.15.4.

I can split this PR into the autoack and ack_req parts if preferred.

with this PR having +246 lines of code I took the liberty of adding myself to the authors list.

Testing procedure

Manual testing with a sniffer and another node is preferred here:

  • Acks correctly transmitted when requested by a peer
  • Acks not transmitted while requested by a peer when autoack is disabled
  • Frame transmitted with ack_req bit set is not retransmitted when a proper ack is received
  • Frame is retransmitted when no ack is received.
  • Frame is not retransmitted when ack_req is disabled.
  • Multicast frames are not retransmitted and don't have ack_req flag set while ack_req is set in the interface settings
  • It must not be possible to set the max retransmissions above 7.

And not immediately critical, but nice to have tested:

  • Must be at least SIFS symbols between frame received and ack transmitted.
  • Must be {S|L}IFS symbols between ack reception and next transmission.
  • driver reports NETDEV_EVENT_TX_NOACK when no ack received.
  • driver always reports NETDEV_EVENT_TX_COMPLETE when ack_req is disabled.

Issues/PRs references

depends on #11146

@bergzand bergzand added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: drivers Area: Device drivers labels Mar 11, 2019
@PeterKietzmann
Copy link
Member

There once was #4795 which proposed a generic mechanism outside the driver which seems reasonable IMO, as it is a MAC feature. However, I can imagine it was timing issues that lead to your decision to implement the feature next to the hardware. Can you give short feedback?

@PeterKietzmann
Copy link
Member

@jia200x wanna have a look at this too?

@bergzand
Copy link
Member Author

@PeterKietzmann Timing was one of the issues, although that matters more for answering a frame with ack requests set than receiving ack. Assuming I understand the architecture proposed with #4795 the low level driver still has to handle ACK timeouts and signal ACK_TIMEOUT back to the retransmission code. Including the code to configure and handle retransmissions wasn't a lot of extra effort here. Being able to work directly on top of the low level driver code was a definite advantage here.

I agree that in the future, it might be possible to refactor the retransmission and maybe even the ack handling to a different module

else {
else if (_state == NRF802154_STATE_ACKWAIT) {
/* Check if this is the expected ACK frame */
if (txbuf[3] == ieee802154_get_seq(&rxbuf[1]) &&
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also validate the psdu length

@bergzand
Copy link
Member Author

rebased and added additional checks to the ack reception handling

@SemjonWilke
Copy link
Member

I just tested it and had some issues. I tested with samr21xpro and nrf5284dk all 16 combinations of ack_req, autoack, -ack_req and -autoack sending with both boards (multiple times) and wrote the results into a table.
I expected to receive some kind of a symmetric matrix, since combinations should have the same effect when swapping them between the boards, but this was clearly not the case.

Something that always worked was -ack_req on both boards.

Also I found some interesting bug with ping when sending from samr to nrf with combination [samr with autoack and -ack_req] and [nrf with autoack and ack_req]:
INFO # 2 packets transmitted, 3 packets received, 3 duplicates, 2147483598% packet loss
I've seen this bug before this PR and it occured with different combinations sometimes, but for the first time I could reproduce it everytime with this one combination. Can you confirm my finding, I would raise an issue then.

@SemjonWilke
Copy link
Member

I know this will be annoying, but can you split this PR? I think it is easier to debug the modules independently and also it will probably go in much faster that way.

@bergzand
Copy link
Member Author

I know this will be annoying, but can you split this PR? I think it is easier to debug the modules independently and also it will probably go in much faster that way.

Nah, you're totally right, should have splitted this from the start.

@jia200x jia200x mentioned this pull request Nov 13, 2019
14 tasks
@stale
Copy link

stale bot commented Feb 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Feb 9, 2020
@miri64 miri64 removed the State: stale State: The issue / PR has no activity for >185 days label Feb 10, 2020
@stale
Copy link

stale bot commented Aug 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Aug 12, 2020
@SemjonWilke SemjonWilke added State: don't stale State: Tell state-bot to ignore this issue and removed State: stale State: The issue / PR has no activity for >185 days labels Aug 13, 2020
@benpicco
Copy link
Contributor

benpicco commented Oct 8, 2020

With #14950 and #14802 this should now be obsolete.

@benpicco benpicco removed the State: don't stale State: Tell state-bot to ignore this issue label Oct 8, 2020
@SemjonWilke
Copy link
Member

@benpicco you are not wrong, but maybe we should wait until nrf802154 is marked obsolete and is going to be removed.

@SemjonWilke SemjonWilke added the State: don't stale State: Tell state-bot to ignore this issue label Oct 9, 2020
@benpicco benpicco removed the State: don't stale State: Tell state-bot to ignore this issue label Nov 29, 2020
@stale
Copy link

stale bot commented Jun 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jun 3, 2021
@SemjonWilke
Copy link
Member

Since the module is still default for some boards, this PR is not completely obsolete - even though it would need a lot of work to revive.
https://github.com/RIOT-OS/RIOT/blob/master/boards/common/nrf52/Makefile.nrf802154.dep#L3
I think deprecating nrf802154 in favor of 15.4 submac should happen soonish.

@stale stale bot removed the State: stale State: The issue / PR has no activity for >185 days label Jun 4, 2021
@benpicco
Copy link
Contributor

benpicco commented Jun 4, 2021

Since the module is still default for some boards, this PR is not completely obsolete

Which boards are that?
And what is the point of implementing something in a driver for which there is now a common layer?

@jeandudey
Copy link
Contributor

jeandudey commented Jun 4, 2021

https://github.com/RIOT-OS/RIOT/blob/master/boards/common/nrf52/Makefile.nrf802154.dep#L3
I think deprecating nrf802154 in favor of 15.4 submac should happen soonish.

nrf802154 defaults to the SubMac, nrf802154_netdev_legacy defaults to the direct netdev driver. So, unless specified directly on your board/application it uses the SubMac.

I think we should go forward with with the HAL/SubMac and add the features on top of it whenever possible if it benefits other drivers too.

See also #15886

And what is the point of implementing something in a driver for which there is now a common layer?

The ACK handling is still implemented on driver though, only for nrf5280154 and #13295 . I think some devices out there don't include Auto-ACK capabilities so it might be a thing to discuss for the SubMac.

@SemjonWilke
Copy link
Member

SemjonWilke commented Jun 9, 2021

The ACK handling is still implemented on driver though, only for nrf5280154 and 13295 . I think some devices out there don't include Auto-ACK capabilities so it might be a thing to discuss for the SubMac.

Sorry, that I am not up to date. From what you say and what I see in https://github.com/RIOT-OS/RIOT/blob/master/cpu/nrf52/radio/nrf802154/nrf802154_radio.c there is a working implementation of ACK for the SubMac of nrf52 CPUs and it's set as default radio.

In that case I'd suggest closing this PR with no further ado.

@benpicco
Copy link
Contributor

benpicco commented Aug 7, 2021

obsoleted by #16630

@benpicco benpicco closed this Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants