Added link-stats module to keep strack of link statistics and their freshness

This commit is contained in:
Simon Duquennoy 2015-11-29 21:31:59 +01:00 committed by Simon Duquennoy
parent 4e9b027141
commit 2fa239ee8d
4 changed files with 286 additions and 0 deletions

View file

@ -62,6 +62,7 @@
#include "contiki.h"
#include "dev/watchdog.h"
#include "net/link-stats.h"
#include "net/ip/tcpip.h"
#include "net/ip/uip.h"
#include "net/ipv6/uip-ds6.h"
@ -1516,6 +1517,9 @@ input(void)
uint8_t first_fragment = 0, last_fragment = 0;
#endif /*SICSLOWPAN_CONF_FRAG*/
/* Update link statistics */
link_stats_input_callback(packetbuf_addr(PACKETBUF_ADDR_SENDER));
/* init */
uncomp_hdr_len = 0;
packetbuf_hdr_len = 0;

View file

@ -47,6 +47,7 @@
#include <stdlib.h>
#include <stddef.h>
#include "lib/list.h"
#include "net/link-stats.h"
#include "net/linkaddr.h"
#include "net/packetbuf.h"
#include "net/ipv6/uip-ds6-nbr.h"
@ -74,6 +75,7 @@ NBR_TABLE_GLOBAL(uip_ds6_nbr_t, ds6_neighbors);
void
uip_ds6_neighbors_init(void)
{
link_stats_init();
nbr_table_register(ds6_neighbors, (nbr_table_callback *)uip_ds6_nbr_rm);
}
/*---------------------------------------------------------------------------*/
@ -204,6 +206,9 @@ uip_ds6_link_neighbor_callback(int status, int numtx)
return;
}
/* Update neighbor link statistics */
link_stats_packet_sent(dest, status, numtx);
/* Call upper-layer callback (e.g. RPL) */
LINK_NEIGHBOR_CALLBACK(dest, status, numtx);
#if UIP_DS6_LL_NUD