[riot-notifications] [RIOT-OS/RIOT] netdev_ieee802154: add radio capabilities (#11473)

José Alamos notifications at github.com
Tue Apr 30 20:39:59 CEST 2019

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### Contribution description
Several radios include hardware acceleration for common MAC tasks (automatic ACK handling, automatic retransmissions, CSMA, automatic FCS, etc).
Since these are MAC tasks, the MAC layer needs a mechanism for discovering which tasks are already handled by the radio.

Here comes the concept of radio capabilities.

/* ieee802154_mac */

void _send(...) {
    if(!(netdev->caps & NETDEV_IEEE802154_CAPS_FRAME_RETRIES)) {
        /* The radio does not handle the frame retransmission procedure. Use software logic */
I took the caps that I think make more sense for RIOT. I added a typedef for caps so we don't have to change the API if the flags grow (e.g uint16_t to uint32_t).

This tends to be a common pattern (check [Linux IEEE802154 MAC](https://github.com/torvalds/linux/blob/6f0d349d922ba44e4348a17a78ea51b7135965b1/include/net/mac802154.h#L95) and [OpenThread caps](https://github.com/openthread/openthread/blob/ae04d5928030b809c72dd710f0c2a00d847aaa3f/include/openthread/platform/radio.h#L119))
I didn't handle these caps as NETOPT because it's assumed a radio can enable or disable a feature if it exists but not otherwise. E.g it's indeed possible to disable the automatic ACK procedure while in extended mode of the driver (at82rf2xx), but the radio is still capable of handling ACKs. 

This is required in order to implement components of the IEEE802.15.4 MAC and add basic mode support for radios.

### Testing procedure
- Check the capabilities for each radio match the datasheet/implementation
- `make doc`
- Check if the defined capabilities make sense
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output

### Issues/PRs references
I will be updating this list on the run
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * netdev_ieee802154: add ieee802154 radio capabilities
  * nrf802154: declare radio capabilities
  * at86rf2xx: declare radio capabilities
  * cc2420: declare radio capabilities
  * k22xrf: declare radio capabilities
  * mrf24j40: declare radio capabilities

-- File Changes --

    M cpu/nrf52/radio/nrf802154/nrf802154.c (3)
    M drivers/at86rf2xx/at86rf2xx_netdev.c (9)
    M drivers/cc2420/cc2420_netdev.c (7)
    M drivers/include/net/netdev/ieee802154.h (61)
    M drivers/kw2xrf/kw2xrf_netdev.c (8)
    M drivers/mrf24j40/mrf24j40_netdev.c (9)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190430/6ec8c397/attachment.html>

More information about the notifications mailing list