Skip to content

net: introduce IPv6 netstats#5178

Merged
OlegHahm merged 1 commit into
RIOT-OS:masterfrom
OlegHahm:netstats_l3
May 25, 2016
Merged

net: introduce IPv6 netstats#5178
OlegHahm merged 1 commit into
RIOT-OS:masterfrom
OlegHahm:netstats_l3

Conversation

@OlegHahm

@OlegHahm OlegHahm commented Mar 25, 2016

Copy link
Copy Markdown
Member

Based on #4801.

@OlegHahm OlegHahm added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: network Area: Networking State: waiting for other PR State: The PR requires another PR to be merged first GNRC labels Mar 25, 2016
@miri64 miri64 modified the milestone: Release 2016.07 Mar 29, 2016
@OlegHahm OlegHahm removed the State: waiting for other PR State: The PR requires another PR to be merged first label Apr 14, 2016
* @return A @ref netstats_t pointer to the statistics.
* @return NULL if no statistics are available.
*/
netstats_t *gnrc_ipv6_netif_get_stats(kernel_pid_t pid);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be more suitable to put this into some unit file of the netstats module itself? Then you can also drop the @note section and it is immediately apparent, that you need said module compiled into the binary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO that would be conceptionally unclean. Actually, I think the better idea would be drop the netstats module completely and move its "functionality" into the shell.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about the new solution?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and move its "functionality" into the shell.

It depends: Can I still use netstats then if I do not compile the shell, but send the stats over e.g. UDP to a server?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. The only thing in the netstats module was the _to_string() function that moved to the shell.

@OlegHahm OlegHahm added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Apr 15, 2016
}
#ifdef MODULE_NETSTATS_IPV6
if_entry->stats.tx_success++;
if_entry->stats.tx_bytes += gnrc_pkt_len(pkt->next);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if it's available here, but why not use the length field of the ipv6 header? Isn't that more accurate than gnrc_pkt_len(pkt->next)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IPv6 header length + ipv6->len; that would be. pkt->next may contain the netif header that isn't really data that is send over the interface.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that IPv6 header length + ipv6->len sounds like a good idea, but in which case can pkt->next contain a netif header and which type would pkt be in this case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, looking at the code again, I wonder if the current solution is not more reasonable: we add the amount of data that is actually passed to the lower layer here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this amount of data can also include padding, if I am not mistaken? AFAIK, the pkts in the pktbuf need to be size aligned(?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, who does actually remove the padding before sending?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, no idea. In gnrc_pktbuf_static.c:423 the size for a pktnsip gets aligned, but I have no idea where the magic happens that gnrc_pkt_len reports the correct size. Maybe in gnrc_pktbuf_static.c:449?

@OlegHahm

Copy link
Copy Markdown
Member Author

Btw I don't know how to handle traffic from unknown interfaces.

@cgundogan

Copy link
Copy Markdown
Member

Btw I don't know how to handle traffic from unknown interfaces.

IMO, if there is no interface, then just skip the statistics for those packets.

@cgundogan

Copy link
Copy Markdown
Member

IMO, if there is no interface, then just skip the statistics for those packets.

On the other hand, you could also aggregate the statistics for KERNEL_PID_UNDEF in a seperate struct

@OlegHahm

Copy link
Copy Markdown
Member Author

If we had a separate dedicated descriptors for pseudo interfaces (like loopback), netstats could help to find bugs like #5257.

Comment thread sys/shell/commands/sc_netif.c Outdated
module = NETSTATS_IPV6;
}
else {
printf("Module %s doesn't exist or do not provide statistics.\n", argv[3]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/do/does/

@cgundogan

Copy link
Copy Markdown
Member

I guess for the first iteration everything seems fine. ACK once you addressed my comments. Please squash.

@OlegHahm

Copy link
Copy Markdown
Member Author

Sorry for the delay. Addressed remaining issues and rebased to master.

@miri64

miri64 commented May 18, 2016

Copy link
Copy Markdown
Member

Can you squash then, please?

@OlegHahm OlegHahm added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable labels May 18, 2016
@OlegHahm

Copy link
Copy Markdown
Member Author

Squashed into a single commit.

@miri64

miri64 commented May 19, 2016

Copy link
Copy Markdown
Member

There is an error on some boards in the netstats app.

@OlegHahm

Copy link
Copy Markdown
Member Author

The last commit should fix it.

@OlegHahm

Copy link
Copy Markdown
Member Author

okay to squash?

@miri64

miri64 commented May 25, 2016

Copy link
Copy Markdown
Member

Yes. ACK, as soon as Murdock is happy.

@OlegHahm OlegHahm merged commit b3a4a0f into RIOT-OS:master May 25, 2016
@OlegHahm OlegHahm deleted the netstats_l3 branch May 25, 2016 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants