Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sys/include/net/netstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ typedef struct {
(either acknowledged or unconfirmed
sending operation, e.g. multicast) */
uint32_t tx_failed; /**< failed sending operations */
uint32_t tx_retrans; /**< total number of retransmissions */

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.

AFAIK (at least on the Atmel radio) this is not the total number of retransmissions but the number of transmissions where all retransmission attemts failed to get an ACK back.

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 think that comment was supposed to the event handler? And isn't this the same? At least that is what we used in the past to count L2 retransmissions in our experiments. Or am I misunderstanding something?

@PeterKietzmann PeterKietzmann Jul 15, 2019

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.

Ideally, we would count the absolute number of retransmissions here but this is not always the case (only speaking for the Atmel radio, we would need to lookup others). When this interrupt fires, MAX_RETIRES retransmissions failed to get an ACK, which is 4 by default. When an ACK appears after the second retransmission you won't notice.

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.

If this event imposes radio-specific corner cases to the upper layer, the design is already broken. So we should really be sure what this event does exactly.

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.

So we should really be sure what this event does exactly.

Behavior of the Atmel radio was explained above. Next would be to find out handling on other devices.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I remember a really old question from @OlegHahm asking if I knew how to get the hardware auto-retransmission counter, and I think we did not find anything.
So if the re-transmission is done by the hardware itself, it would not be noticed.

I think that is what Peter is talking about.

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.

@PeterKietzmann I think in some old branch of mine I fiddled around with setting the retry amount to zero and handle the retransmissions within the driver, but I don't remember the details any more.

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.

Thanks for your feedback. @cladmi yes, at least this is the case for AT86RF2XX. No idea about other devices that we support. @OlegHahm yes I know, that was even a (never merged) PR of yours that I reference from time to time.
To conclude: If "all" other devices than the Atmel radio do support this count, we could go with this PR. If not we might delay the discussion until there is more from the software MAC initiative (by @jia200x )

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.

Ok. I'm leaving this PR open for now for later reference though (or if we need the counter for experiments again ;-)).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It should not be used for experiments with samr21-xpro or iotlab-m3 though or results would be based on a too low value.

uint32_t tx_bytes; /**< sent bytes */
uint32_t rx_count; /**< received (data) packets */
uint32_t rx_bytes; /**< received bytes */
Expand Down
3 changes: 3 additions & 0 deletions sys/net/gnrc/netif/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,9 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
}
break;
#ifdef MODULE_NETSTATS_L2
case NETDEV_EVENT_TX_NOACK:
netif->stats.tx_retrans++;
break;
case NETDEV_EVENT_TX_MEDIUM_BUSY:
/* we are the only ones supposed to touch this variable,
* so no acquire necessary */
Expand Down
5 changes: 3 additions & 2 deletions sys/shell/commands/sc_gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,16 @@ static int _netif_stats(kernel_pid_t iface, unsigned module, bool reset)
printf(" Statistics for %s\n"
" RX packets %u bytes %u\n"
" TX packets %u (Multicast: %u) bytes %u\n"
" TX succeeded %u errors %u\n",
" TX succeeded %u errors %u retransmissions %u\n",
_netstats_module_to_str(module),
(unsigned) stats->rx_count,
(unsigned) stats->rx_bytes,
(unsigned) (stats->tx_unicast_count + stats->tx_mcast_count),
(unsigned) stats->tx_mcast_count,
(unsigned) stats->tx_bytes,
(unsigned) stats->tx_success,
(unsigned) stats->tx_failed);
(unsigned) stats->tx_failed,
(unsigned) stats->tx_retrans);
res = 0;
}
return res;
Expand Down