[riot-notifications] [RIOT-OS/RIOT] netif: add stack independent data handlers (#11888)

José Alamos notifications at github.com
Tue Jul 23 10:29:41 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
This PR adds some stack independent functions passing data between the network stack and the interfaces. 

It adds the following functions:
- `netif_send`: Send MSDU (Mac Service Data Unit, full L3 frame) to an interface.
- `netif_recv`: To be called when radio triggers RX_DONE. This function fetches the packet from the radio and does L2 processing.
- `netif_dispatch`: Dispatches the packet to the network stack. I added because `netif_recv` might be not enough for dispatching a packet, considering the fact some MAC layers work with callbacks (IEEE802.15.4 implementations, LoRaWAN).

It also adds a stack independent packet representations (`pkt_t`) to encapsulate different packet formats (static buffers, gnrc_pktbuf, etc).

With this it's possible to:
- Avoid [these kind of #ifdef](https://github.com/RIOT-OS/RIOT/blob/master/sys/auto_init/netif/auto_init_at86rf2xx.c#L56), since the network device will always call the `netif_recv` function regardless of the stack. The stack is selected via `netif_xxx` functions implementation.
- Separate interface logic from the network stack, so it's possible e.g to send non IP data (LoRaWAN, etc) via an interface that might not be dependent of GNRC (@aabadie)
- Provide MAC layers independent of the network stack.

I also adapted the `txtsnd` command to use the new `netapi_send` command.

Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes

### Testing procedure
Try the `default` example and send data between nodes with `txtsnd`.
Also, check the documentation with `make doc`.
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
Depends on #11879 
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 --

  * netif: introduce descriptor based netif
  * gnrc_netif: adapt to new netif_t abstraction
  * tests/gnrc_netif: adapt to new netif_t representation
  * netif: add data handlers
  * gnrc_netif: adapt to netif_t data handlers
  * txtsnd: use netif_send for sending data

-- File Changes --

    M makefiles/pseudomodules.inc.mk (1)
    M sys/Makefile (3)
    M sys/Makefile.include (3)
    M sys/include/net/gnrc/netif.h (2)
    M sys/include/net/netif.h (107)
    M sys/net/gnrc/netif/_netif.c (85)
    M sys/net/gnrc/netif/gnrc_netif.c (19)
    D sys/net/gnrc/netif/include/netif_types.h (36)
    A sys/net/netif/Makefile (3)
    A sys/net/netif/netif.c (58)
    M sys/shell/commands/sc_gnrc_netif.c (9)
    M tests/gnrc_netif/main.c (25)

-- 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/20190723/266421af/attachment-0001.htm>

More information about the notifications mailing list