net stats: move layer 2 netstats from netdev driver to gnrc_netif#9793
net stats: move layer 2 netstats from netdev driver to gnrc_netif#9793miri64 merged 6 commits intoRIOT-OS:masterfrom
Conversation
|
Mh this somewhat collides with the efforts @bergzand is doing in disentangling netdev into a layered system. Can you two please sync on that. |
|
@miri64 we did ... via IRC, that's (also) why I asked for his review here - and yours bc you know GNRC best 😄 |
|
Ah, I didn't know about that ;-) (I don't follow the IRC that closely). Then what spoke against putting those stat counters into its own netdev layer instead of putting it in |
|
Mostly that this is the easiest solution at the moment. AFAIK there are no other network stacks using or exposing netstats, so I don't see problems with moving the implementation to GNRC specific code. IMHO it can be easily moved to a separate netdev layer if necessary, but for now I'm happy with this as it removes another cleanup step I would have to do before being able to implement a layered netdev structure |
bergzand
left a comment
There was a problem hiding this comment.
Completely missed that this was updated. I have some minor issue remaining, changes look good otherwise.
839822b to
97f240a
Compare
|
@bergzand comments addressed, maybe today HnA provides a merge window? |
|
@smlng What do you think, do you want to have every device tested individually? I'm willing to trust the code as long as it compiles and with the three gnrc_netif variants tested. |
97f240a to
5b9abce
Compare
|
esp_eth_netdev needs adaptation: |
|
ping @bergzand, I don't wanna merge this myself and w/o your thumps up |
|
Just from experiences with refactorings I also would rather wait until after the FF to merge this. |
|
@miri64 agreed, actually I wasn't pushing for getting this into the release but rather getting of my desk with open PRs 😄 |
| gomach_preamble_ack_hdr.phase_in_us = gnrc_gomach_phase_now(netif); | ||
|
|
||
| pkt = gnrc_pktbuf_add(NULL, &gomach_preamble_ack_hdr, sizeof(gomach_preamble_ack_hdr), | ||
| gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, &gomach_preamble_ack_hdr, sizeof(gomach_preamble_ack_hdr), |
There was a problem hiding this comment.
In theory yes, as it is not related to netstats. However, as I touched the file the static code analyser found (that is: complained) that the previous value of pkt (which is NULL see above) was not used before being overwritten. To me this seems a bit overly correct, but in the end I need to please the CI to get the green button.
TL;DR: change is necessary to make CI happy 😦
There was a problem hiding this comment.
TL;DR: change is necessary to make CI happy frowning
Makes sense
There was a problem hiding this comment.
I prefer variable definitions to be at the top of a block so one can have an overview and consider alignment (or rather more important: resulting padding i.e. waste from misalignment) on the stack, so I would prefer to just remove the = NULL above and keep this line as it was. E.g. I don't know the size of gnrc_gomach_frame_preamble_ack_t so I would prefer it to be defined / allocated last, so the padding "hole" is at the end.
|
@smlng Minor remark above, otherwise good to go I'd say |
|
@miri64 (re)adapted as suggested, lets see what Murdock thinks |
|
@miri64 can I squash? |
|
Yes please :-) |
This the first step in moving the collection of layer 2 netstats from the low level driver to a central location, ie. gnrc_netif, to avoid code duplication.
This removes the netopt to get layer 2 netstats from netdev.
|
done |
cpu/esp32/esp-wifi/esp_wifi_netdev.c
Outdated
| netdev->stats.tx_success++; | ||
| netdev->stats.tx_bytes += dev->tx_len; | ||
| #endif | ||
| #ifdef MODULE_NETSTATS_L2 |
There was a problem hiding this comment.
Wait... This changes behavior. Before this was not in the #ifdef block.
There was a problem hiding this comment.
mhm, right, will remove ... can I amend directly?
Removing usage of netdev->stats in all net drivers, as it is handled by gnrc_netif.
miri64
left a comment
There was a problem hiding this comment.
Re-ACK and go. My last-minute comment was addressed.
|
BTW, |
Contribution description
Currently handling and collection of layer 2 netstats is rather distributed, i.e. some is handled in the low level netdev drivers other parts are in GNRC. This PR move handling of layer 2 netstats to gnrc_netif. This is done step by step so each commit should be one after another.
Testing
use
tests/gnrc_netiforexamples/gnrc_networkingand transmit something, then lookupifconfig.Issues/PRs references