[RFC] net/netstats L1/L2 per neighbor transfer statistics#6873
[RFC] net/netstats L1/L2 per neighbor transfer statistics#6873bergzand wants to merge 8 commits intoRIOT-OS:masterfrom
Conversation
652e815 to
d6bd7e8
Compare
|
Added RFC tag :) |
09559e4 to
5129d9d
Compare
|
Rebased and resolved merge conflict |
|
No longer WIP. |
|
Prevents a segfault when no empty/stale entries are present and added support for ethernet devices. Note that ETX doesn't really make sense with tap because there is no L2 ack mechanism, but it simplifies testing a lot. |
|
Yes, At some point I hope to build a v2 of this based on #8198 |
|
@tcschmidt As requested here #8198 contained only the initial headers and code required for the layered approach. As long as the netdev stack is not adapted to actually use the code, it is not possible to reworking this PR in a useful way. |
|
@bergzand is this still true? |
|
Ping @bergzand? |
|
If this were resolved, would there be much work left to do to implement MRHOF? (The contiki users around me are kind of reluctant to switch that off). |
Around 350 lines of code depending a bit on how much things changed in two years |
|
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. |
This might actually be useful. |
|
Would have thought the bot removes the stale label if you re-open the issue... |
I can take over. From what I gathered by talking to @miri64 was that it should not be part of GNRC (so not extending the NIB) but rather a separate L2 database - so pretty much what you did here. |
| /* find the oldest inactive entry to replace. Empty entries are infinity old */ | ||
| netstats_nb_t *netstats_nb_get_or_create(netdev_t *dev, const uint8_t *l2_addr, uint8_t len) |
There was a problem hiding this comment.
Wouldn't it be better to evict the entry with the worst signal?
| uint32_t tx_count; /**< Number of sent frames to this peer */ | ||
| uint32_t tx_failed; /**< Number of failed transmission tries to this peer */ | ||
| uint32_t rx_count; /**< Number of received frames */ | ||
| uint32_t tx_bytes; /**< Bytes sent */ | ||
| uint32_t rx_bytes; /**< Bytes received */ |
There was a problem hiding this comment.
If those are just for printing out information, I'd rather drop them - 20 bytes / neighbor is quite a lot to keep around for curiosity's sake.
|
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. |
|
Very timely, stale bot, very timely ;-). |
This WIP adds functionality for recording statistics split out per peer. The goal of these statistics are for RPL parent selection, for example based on the ETX of the connection to the potential parent.
A struct with these statistics is defined. At this moment an array of length 8 is added to the netdev struct. I went for this approach because ETX statistics can be radio dependent and if a device has multiple radios these statistics are clearly dependent on the radio. Statistics are updated on packets received from the neighbor or transmission to the neighbor.
Because the netdev callback used to process transmission result has no knowledge of the transmitted frame itself, I decided to implement a small ring buffer like construction to link transfers to the callback. This ring buffer assumes that the order of packets send to the radio and the callbacks are in the same order. The ring buffer consists of a array of netstats_peer_t pointers and 2 indexes for reading/writing positions. Multicast/broadcast transmissions are recorded as NULL ptr's preserving the order of this buffer.
RSSI and LQI values are kept as exponential weighted moving averages, this to have some average function over this data while keeping the stored data small. I prefer to store the RSSI values in dBm, but the current radio's return the raw values instead of dBm converted values.
I've added a netopt call to retrieve the statistics. I've used this to extend the
ifconfigtool with these statistics.This PR is a work in progress. It's probably not feasible to have this merged before the feature deadline.
I would like some feedback on the architecture build for this. If a different approach is preferred, I can rewrite this. Also, if a different algorithm for certain parts is preferred, I'd also like to hear
Todo: