Records statistics about link layer neighbors. More...
Records statistics about link layer neighbors.
Neighbor stats definitions
Definition in file neighbor.h.
Include dependency graph for neighbor.h:Go to the source code of this file.
Functions | |
| void | netstats_nb_init (netif_t *netif) |
| Initialize the neighbor stats. More... | |
| bool | netstats_nb_get (netif_t *netif, const uint8_t *l2_addr, uint8_t len, netstats_nb_t *out) |
| Find a neighbor stat by the mac address. More... | |
| void | netstats_nb_record (netif_t *netif, const uint8_t *l2_addr, uint8_t len) |
| Store this neighbor as next in the transmission queue. More... | |
| netstats_nb_t * | netstats_nb_update_tx (netif_t *netif, netstats_nb_result_t result, uint8_t transmissions) |
| Update the next recorded neighbor with the provided numbers. More... | |
| netstats_nb_t * | netstats_nb_update_rx (netif_t *netif, const uint8_t *l2_addr, uint8_t l2_addr_len, uint8_t rssi, uint8_t lqi) |
| Record rx stats for the l2_addr. More... | |
| bool | netstats_nb_isfresh (netif_t *netif, netstats_nb_t *stats) |
| Check if a record is fresh. More... | |
@ref EWMA parameters | |
| #define | NETSTATS_NB_EWMA_SCALE 100 |
| Multiplication factor of the EWMA. | |
| #define | NETSTATS_NB_EWMA_ALPHA 15 |
| Alpha factor of the EWMA. | |
| #define | NETSTATS_NB_EWMA_ALPHA_RAMP 30 |
| Alpha factor of the EWMA when stats are not fresh. | |
@ref ETX parameters | |
| #define | NETSTATS_NB_ETX_NOACK_PENALTY 6 |
| ETX penalty for not receiving any ACK. | |
| #define | NETSTATS_NB_ETX_DIVISOR 128 |
| ETX fixed point divisor (rfc 6551) | |
| #define | NETSTATS_NB_ETX_INIT 2 |
| Initial ETX, assume a mediocre link. | |
@ref Freshness parameters | |
| #define | NETSTATS_NB_FRESHNESS_HALF 600 |
| seconds after the freshness counter is halved | |
| #define | NETSTATS_NB_FRESHNESS_TARGET 4 |
| freshness count needed before considering the statistics fresh | |
| #define | NETSTATS_NB_FRESHNESS_MAX 16 |
| Maximum freshness. | |
| #define | NETSTATS_NB_FRESHNESS_EXPIRATION 1200 |
| seconds after statistics have expired | |
@ref Timeout Parameters | |
| #define | NETSTATS_NB_TX_TIMEOUT_MS 100 |
| milliseconds without TX done notification after which a TX event is discarded | |
| enum | netstats_nb_result_t { NETSTATS_NB_SUCCESS = 0 , NETSTATS_NB_NOACK , NETSTATS_NB_BUSY } |
| Result of the transmission. More... | |
| enum netstats_nb_result_t |
Result of the transmission.
| Enumerator | |
|---|---|
| NETSTATS_NB_SUCCESS | Successful transmission. |
| NETSTATS_NB_NOACK | Failed due to no ack received. |
| NETSTATS_NB_BUSY | Failed due to medium busy. |
Definition at line 34 of file neighbor.h.
| bool netstats_nb_get | ( | netif_t * | netif, |
| const uint8_t * | l2_addr, | ||
| uint8_t | len, | ||
| netstats_nb_t * | out | ||
| ) |
Find a neighbor stat by the mac address.
| [in] | netif | network interface descriptor |
| [in] | l2_addr | pointer to the L2 address |
| [in] | len | length of the L2 address |
| [out] | out | destination for the matching neighbor entry |
| void netstats_nb_init | ( | netif_t * | netif | ) |
Initialize the neighbor stats.
| [in] | netif | network interface descriptor |
| bool netstats_nb_isfresh | ( | netif_t * | netif, |
| netstats_nb_t * | stats | ||
| ) |
Check if a record is fresh.
Freshness half time is checked and updated before verifying freshness.
| [in] | netif | network interface the statistic belongs to |
| [in] | stats | pointer to the statistic |
| void netstats_nb_record | ( | netif_t * | netif, |
| const uint8_t * | l2_addr, | ||
| uint8_t | len | ||
| ) |
Store this neighbor as next in the transmission queue.
Set len to zero if a nop record is needed, for example if the transmission has a multicast address as a destination.
| [in] | netif | network interface descriptor |
| [in] | l2_addr | pointer to the L2 address |
| [in] | len | length of the L2 address |
| netstats_nb_t* netstats_nb_update_rx | ( | netif_t * | netif, |
| const uint8_t * | l2_addr, | ||
| uint8_t | l2_addr_len, | ||
| uint8_t | rssi, | ||
| uint8_t | lqi | ||
| ) |
Record rx stats for the l2_addr.
| [in] | netif | network interface descriptor |
| [in] | l2_addr | pointer to the L2 address |
| [in] | l2_addr_len | length of the L2 address |
| [in] | rssi | RSSI of the received transmission in abs([dBm]) |
| [in] | lqi | Link Quality Indication provided by the radio |
| netstats_nb_t* netstats_nb_update_tx | ( | netif_t * | netif, |
| netstats_nb_result_t | result, | ||
| uint8_t | transmissions | ||
| ) |
Update the next recorded neighbor with the provided numbers.
This only increments the statistics if the length of the l2-address of the retrieved record is non-zero. See also netstats_nb_record. The numbers indicate the number of transmissions the radio had to perform before a successful transmission was performed. For example: in the case of a single send operation needing 3 tries before an ACK was received, there are 2 failed transmissions and 1 successful transmission.
| [in] | netif | network interface descriptor |
| [in] | result | Result of the transmission |
| [in] | transmissions | Number of times the packet was sent over the air |