From fe3e9371eef90fa522c4db7f04ef4622643416d8 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Tue, 9 Apr 2019 13:17:43 +0200 Subject: [PATCH 1/3] netstats: add counter for retransmissions --- sys/include/net/netstats.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/include/net/netstats.h b/sys/include/net/netstats.h index c517b1e3c849..3f164176fc30 100644 --- a/sys/include/net/netstats.h +++ b/sys/include/net/netstats.h @@ -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 */ uint32_t tx_bytes; /**< sent bytes */ uint32_t rx_count; /**< received (data) packets */ uint32_t rx_bytes; /**< received bytes */ From aa4b31a31c591c64495dfbc78a59a4b294c61505 Mon Sep 17 00:00:00 2001 From: "Martine S. Lenders" Date: Fri, 12 Jul 2019 16:25:23 +0200 Subject: [PATCH 2/3] gnrc_netif: count TX_NOACK events as L2 retransmissions --- sys/net/gnrc/netif/gnrc_netif.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index 404c430a016c..3069d1960a13 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -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 */ From 0c4e598af8aeb2d8185b02c9583be1d21958619a Mon Sep 17 00:00:00 2001 From: "Martine S. Lenders" Date: Fri, 12 Jul 2019 16:25:46 +0200 Subject: [PATCH 3/3] shell_commands: print retransmissions with netstats output --- sys/shell/commands/sc_gnrc_netif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/shell/commands/sc_gnrc_netif.c b/sys/shell/commands/sc_gnrc_netif.c index b6404c656a84..0a8cdeffa71b 100644 --- a/sys/shell/commands/sc_gnrc_netif.c +++ b/sys/shell/commands/sc_gnrc_netif.c @@ -126,7 +126,7 @@ 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, @@ -134,7 +134,8 @@ static int _netif_stats(kernel_pid_t iface, unsigned module, bool reset) (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;