[riot-notifications] [RIOT-OS/RIOT] gnrc_netif_*: use the `gnrc_netif_t::pid` member instead of the pid of the current thread in netif header (#10742)

Gunar Schorcht notifications at github.com
Thu Jan 10 01:33:33 CET 2019


### Contribution description

Due to the interrupt context problem, the receive sequence of defined as follows.

![gnrc_netif_1](https://user-images.githubusercontent.com/31932013/50937496-3cc7ce00-1474-11e9-97e0-517d56419ca2.png)

It is not an UML compliant message sequence chart by intention. Activities show the active context.

In `netif::_recv`, the `thread_getpid` function is used to set the `netif` pid in `gnrc_netif_hdr`. This works since `_recv` is executed in the `netif` thread context.

However, if the `netdev` polls for new data using its own thread context, data are not fetched in interrupt context and there is no necessity to send an `NETDEV_EVENT_ISR` event to the `netif` first. Rather, `netdev` can call the event callback of `netif` with NETDEV_EVENT_RX_COMPLETE directly.

![gnrc_netif_2](https://user-images.githubusercontent.com/31932013/50938192-63d3cf00-1477-11e9-9707-00380e318b3f.png)

This has two advantages:
- it is faster
- there is no need for an additional buffer in `netdev`, data can be copied directly from hardware to the `netif` buffer.

However, since `netif::_recv` is executed in the `netdev` thread context, the `thread_getpid` function returns the wrong pid.

Since the `netif` has a member `pid` it should be used here.  Both approaches are possible with the change in this PR

### Testing procedure

Use any board with Ethernet interface or IEEE802.15.4 interfaces and use `example/gnrc_networking` to ping them.
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/10742

-- Commit Summary --

  * gnrc_netif_ethernet: use pid member in netif header 
  * gnrc_netif_ieee802154: use pid member in netif header

-- File Changes --

    M sys/net/gnrc/netif/ethernet/gnrc_netif_ethernet.c (2)
    M sys/net/gnrc/netif/ieee802154/gnrc_netif_ieee802154.c (2)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/10742.patch
https://github.com/RIOT-OS/RIOT/pull/10742.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10742
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190109/732736e8/attachment-0001.html>


More information about the notifications mailing list