14#ifndef ZEPHYR_INCLUDE_NET_NET_STATS_H_
15#define ZEPHYR_INCLUDE_NET_NET_STATS_H_
251#if NET_TC_TX_COUNT == 0
252#define NET_TC_TX_STATS_COUNT 1
254#define NET_TC_TX_STATS_COUNT NET_TC_TX_COUNT
257#if NET_TC_RX_COUNT == 0
258#define NET_TC_RX_STATS_COUNT 1
260#define NET_TC_RX_STATS_COUNT NET_TC_RX_COUNT
273#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
276 tx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
290#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
293 rx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
336#if defined(CONFIG_NET_STATISTICS_IPV6)
341#if defined(CONFIG_NET_STATISTICS_IPV4)
346#if defined(CONFIG_NET_STATISTICS_ICMP)
351#if defined(CONFIG_NET_STATISTICS_TCP)
356#if defined(CONFIG_NET_STATISTICS_UDP)
361#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
366#if defined(CONFIG_NET_STATISTICS_MLD)
371#if defined(CONFIG_NET_STATISTICS_IGMP)
381#if defined(CONFIG_NET_PKT_TXTIME_STATS)
386#if defined(CONFIG_NET_PKT_RXTIME_STATS)
391#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
395#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
400#if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
510#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR
514struct net_stats_eth_vendor {
515 const char *
const key;
566#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR
568 struct net_stats_eth_vendor *vendor;
626#if defined(CONFIG_NET_STATISTICS_USER_API)
631#define _NET_STATS_LAYER NET_MGMT_LAYER_L3
632#define _NET_STATS_CODE 0x101
633#define _NET_STATS_BASE (NET_MGMT_LAYER(_NET_STATS_LAYER) | \
634 NET_MGMT_LAYER_CODE(_NET_STATS_CODE))
636enum net_request_stats_cmd {
637 NET_REQUEST_STATS_CMD_GET_ALL = 1,
638 NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR,
639 NET_REQUEST_STATS_CMD_GET_BYTES,
640 NET_REQUEST_STATS_CMD_GET_IP_ERRORS,
641 NET_REQUEST_STATS_CMD_GET_IPV4,
642 NET_REQUEST_STATS_CMD_GET_IPV6,
643 NET_REQUEST_STATS_CMD_GET_IPV6_ND,
644 NET_REQUEST_STATS_CMD_GET_ICMP,
645 NET_REQUEST_STATS_CMD_GET_UDP,
646 NET_REQUEST_STATS_CMD_GET_TCP,
647 NET_REQUEST_STATS_CMD_GET_ETHERNET,
648 NET_REQUEST_STATS_CMD_GET_PPP,
649 NET_REQUEST_STATS_CMD_GET_PM,
650 NET_REQUEST_STATS_CMD_GET_WIFI,
656#define NET_REQUEST_STATS_GET_ALL \
657 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ALL)
660#define NET_REQUEST_STATS_GET_PROCESSING_ERROR \
661 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR)
664#define NET_REQUEST_STATS_GET_BYTES \
665 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_BYTES)
668#define NET_REQUEST_STATS_GET_IP_ERRORS \
669 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IP_ERRORS)
680#if defined(CONFIG_NET_STATISTICS_IPV4)
682#define NET_REQUEST_STATS_GET_IPV4 \
683 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV4)
690#if defined(CONFIG_NET_STATISTICS_IPV6)
692#define NET_REQUEST_STATS_GET_IPV6 \
693 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6)
700#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
702#define NET_REQUEST_STATS_GET_IPV6_ND \
703 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6_ND)
710#if defined(CONFIG_NET_STATISTICS_ICMP)
712#define NET_REQUEST_STATS_GET_ICMP \
713 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ICMP)
720#if defined(CONFIG_NET_STATISTICS_UDP)
722#define NET_REQUEST_STATS_GET_UDP \
723 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_UDP)
730#if defined(CONFIG_NET_STATISTICS_TCP)
732#define NET_REQUEST_STATS_GET_TCP \
733 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_TCP)
740#if defined(CONFIG_NET_STATISTICS_ETHERNET)
742#define NET_REQUEST_STATS_GET_ETHERNET \
743 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ETHERNET)
750#if defined(CONFIG_NET_STATISTICS_PPP)
752#define NET_REQUEST_STATS_GET_PPP \
753 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PPP)
762#if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
764#define NET_REQUEST_STATS_GET_PM \
765 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PM)
772#if defined(CONFIG_NET_STATISTICS_WIFI)
774#define NET_REQUEST_STATS_GET_WIFI \
775 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_WIFI)
#define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request)
Declare a request handler function for the given network event.
Definition net_mgmt.h:109
uint32_t net_stats_t
Network statistics counter.
Definition net_stats.h:36
Network core definitions.
Network Management API public header.
static k_spinlock_key_t key
Definition spinlock_error_case.c:15
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Number of bytes sent and received.
Definition net_stats.h:41
net_stats_t sent
Number of bytes sent.
Definition net_stats.h:43
net_stats_t received
Number of bytes received.
Definition net_stats.h:45
Ethernet checksum statistics.
Definition net_stats.h:488
net_stats_t rx_csum_offload_good
Number of good RX checksum offloading.
Definition net_stats.h:490
net_stats_t rx_csum_offload_errors
Number of failed RX checksum offloading.
Definition net_stats.h:493
Ethernet error statistics.
Definition net_stats.h:409
net_stats_t tx_carrier_errors
Number of TX carrier errors.
Definition net_stats.h:447
net_stats_t uncorr_ecc_errors
Number of uncorrected ECC errors.
Definition net_stats.h:462
net_stats_t rx_long_length_errors
Number of RX long length errors.
Definition net_stats.h:429
net_stats_t tx_window_errors
Number of TX window errors.
Definition net_stats.h:456
net_stats_t corr_ecc_errors
Number of corrected ECC errors.
Definition net_stats.h:465
net_stats_t rx_missed_errors
Number of RX missed errors.
Definition net_stats.h:426
net_stats_t rx_crc_errors
Number of RX CRC errors.
Definition net_stats.h:417
net_stats_t rx_short_length_errors
Number of RX short length errors.
Definition net_stats.h:432
net_stats_t rx_align_errors
Number of RX buffer align errors.
Definition net_stats.h:435
net_stats_t rx_dma_failed
Number of RX DMA failed errors.
Definition net_stats.h:438
net_stats_t rx_no_buffer_count
Number of RX net_pkt allocation errors.
Definition net_stats.h:423
net_stats_t tx_fifo_errors
Number of TX FIFO errors.
Definition net_stats.h:450
net_stats_t rx_frame_errors
Number of RX frame errors.
Definition net_stats.h:420
net_stats_t rx_over_errors
Number of RX overrun errors.
Definition net_stats.h:414
net_stats_t tx_dma_failed
Number of TX DMA failed errors.
Definition net_stats.h:459
net_stats_t rx_length_errors
Number of RX length errors.
Definition net_stats.h:411
net_stats_t rx_buf_alloc_failed
Number of RX net_buf allocation errors.
Definition net_stats.h:441
net_stats_t tx_heartbeat_errors
Number of TX heartbeat errors.
Definition net_stats.h:453
net_stats_t tx_aborted_errors
Number of TX aborted errors.
Definition net_stats.h:444
Ethernet flow control statistics.
Definition net_stats.h:471
net_stats_t rx_flow_control_xon
Number of RX XON flow control.
Definition net_stats.h:473
net_stats_t tx_flow_control_xon
Number of TX XON flow control.
Definition net_stats.h:479
net_stats_t rx_flow_control_xoff
Number of RX XOFF flow control.
Definition net_stats.h:476
net_stats_t tx_flow_control_xoff
Number of TX XOFF flow control.
Definition net_stats.h:482
Ethernet hardware timestamp statistics.
Definition net_stats.h:499
net_stats_t tx_hwtstamp_timeouts
Number of RX hardware timestamp timeout.
Definition net_stats.h:504
net_stats_t rx_hwtstamp_cleared
Number of RX hardware timestamp cleared.
Definition net_stats.h:501
net_stats_t tx_hwtstamp_skipped
Number of RX hardware timestamp skipped.
Definition net_stats.h:507
All Ethernet specific statistics.
Definition net_stats.h:523
struct net_stats_pkts broadcast
Total number of broadcast packets received and sent.
Definition net_stats.h:531
struct net_stats_eth_csum csum
Total number of checksum errors in RX and TX.
Definition net_stats.h:546
net_stats_t tx_dropped
Total number of dropped TX packets.
Definition net_stats.h:555
struct net_stats_eth_hw_timestamp hw_timestamp
Total number of hardware timestamp errors in RX and TX.
Definition net_stats.h:549
struct net_stats_pkts multicast
Total number of multicast packets received and sent.
Definition net_stats.h:534
struct net_stats_eth_flow flow_control
Total number of flow control errors in RX and TX.
Definition net_stats.h:543
net_stats_t tx_restart_queue
Total number of TX queue restarts.
Definition net_stats.h:561
net_stats_t collisions
Total number of collisions.
Definition net_stats.h:552
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:525
struct net_stats_eth_errors error_details
Total number of errors in RX and TX.
Definition net_stats.h:540
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:528
struct net_stats_pkts errors
Total number of errors in RX and TX.
Definition net_stats.h:537
net_stats_t tx_timeout_count
Total number of TX timeout errors.
Definition net_stats.h:558
net_stats_t unknown_protocol
Total number of RX unknown protocol packets.
Definition net_stats.h:564
ICMP statistics.
Definition net_stats.h:105
net_stats_t sent
Number of sent ICMP packets.
Definition net_stats.h:110
net_stats_t chkerr
Number of ICMP packets with a bad checksum.
Definition net_stats.h:119
net_stats_t drop
Number of dropped ICMP packets.
Definition net_stats.h:113
net_stats_t typeerr
Number of ICMP packets with a wrong type.
Definition net_stats.h:116
net_stats_t recv
Number of received ICMP packets.
Definition net_stats.h:107
IP layer error statistics.
Definition net_stats.h:78
net_stats_t hblenerr
Number of packets dropped due to wrong IP length, high byte.
Definition net_stats.h:85
net_stats_t vhlerr
Number of packets dropped due to wrong IP version or header length.
Definition net_stats.h:82
net_stats_t chkerr
Number of packets dropped due to IP checksum errors.
Definition net_stats.h:94
net_stats_t protoerr
Number of packets dropped because they were neither ICMP, UDP nor TCP.
Definition net_stats.h:99
net_stats_t lblenerr
Number of packets dropped due to wrong IP length, low byte.
Definition net_stats.h:88
net_stats_t fragerr
Number of packets dropped because they were IP fragments.
Definition net_stats.h:91
IP layer statistics.
Definition net_stats.h:61
net_stats_t forwarded
Number of forwarded packets at the IP layer.
Definition net_stats.h:69
net_stats_t recv
Number of received packets at the IP layer.
Definition net_stats.h:63
net_stats_t sent
Number of sent packets at the IP layer.
Definition net_stats.h:66
net_stats_t drop
Number of dropped packets at the IP layer.
Definition net_stats.h:72
IPv4 IGMP daemon statistics.
Definition net_stats.h:216
net_stats_t drop
Number of dropped IPv4 IGMP packets.
Definition net_stats.h:224
net_stats_t recv
Number of received IPv4 IGMP queries.
Definition net_stats.h:218
net_stats_t sent
Number of sent IPv4 IGMP reports.
Definition net_stats.h:221
IPv6 multicast listener daemon statistics.
Definition net_stats.h:202
net_stats_t recv
Number of received IPv6 MLD queries.
Definition net_stats.h:204
net_stats_t sent
Number of sent IPv6 MLD reports.
Definition net_stats.h:207
net_stats_t drop
Number of dropped IPv6 MLD packets.
Definition net_stats.h:210
IPv6 neighbor discovery statistics.
Definition net_stats.h:188
net_stats_t sent
Number of sent IPv6 neighbor discovery packets.
Definition net_stats.h:196
net_stats_t recv
Number of received IPv6 neighbor discovery packets.
Definition net_stats.h:193
net_stats_t drop
Number of dropped IPv6 neighbor discovery packets.
Definition net_stats.h:190
Number of network packets sent and received.
Definition net_stats.h:51
net_stats_t rx
Number of packets received.
Definition net_stats.h:55
net_stats_t tx
Number of packets sent.
Definition net_stats.h:53
Power management statistics.
Definition net_stats.h:308
uint32_t last_suspend_time
How long the last suspend took.
Definition net_stats.h:314
uint32_t start_time
Network interface last suspend start time.
Definition net_stats.h:316
uint64_t overall_suspend_time
Total suspend time.
Definition net_stats.h:310
net_stats_t suspend_count
How many times we were suspended.
Definition net_stats.h:312
All PPP specific statistics.
Definition net_stats.h:575
net_stats_t chkerr
Number of received PPP frames with a bad checksum.
Definition net_stats.h:586
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:580
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:577
net_stats_t drop
Number of received and dropped PPP frames.
Definition net_stats.h:583
Network packet receive times for calculating average RX time.
Definition net_stats.h:241
uint64_t sum
Sum of network packet receive times.
Definition net_stats.h:243
net_stats_t count
Number of network packets received.
Definition net_stats.h:246
All Wi-Fi management statistics.
Definition net_stats.h:592
net_stats_t beacons_miss
Number of missed beacons.
Definition net_stats.h:597
net_stats_t beacons_rx
Number of received beacons.
Definition net_stats.h:594
Traffic class statistics.
Definition net_stats.h:268
net_stats_t bytes
Number of bytes sent for this traffic class.
Definition net_stats.h:281
struct net_stats_tx_time tx_time
Helper for calculating average TX time statistics.
Definition net_stats.h:272
struct net_stats_tc::@349 sent[NET_TC_TX_STATS_COUNT]
TX statistics for each traffic class.
struct net_stats_tc::@350 recv[NET_TC_RX_STATS_COUNT]
RX statistics for each traffic class.
net_stats_t pkts
Number of packets sent for this traffic class.
Definition net_stats.h:279
uint8_t priority
Priority of this traffic class.
Definition net_stats.h:283
TCP statistics.
Definition net_stats.h:125
net_stats_t ackerr
Number of received TCP segments with a bad ACK number.
Definition net_stats.h:148
net_stats_t rsterr
Number of received bad TCP RST (reset) segments.
Definition net_stats.h:151
net_stats_t rexmit
Number of retransmitted TCP segments.
Definition net_stats.h:157
net_stats_t chkerr
Number of TCP segments with a bad checksum.
Definition net_stats.h:145
net_stats_t seg_drop
Number of dropped TCP segments.
Definition net_stats.h:142
net_stats_t connrst
Number of connection attempts for closed ports, triggering a RST.
Definition net_stats.h:165
net_stats_t drop
Number of dropped packets at the TCP layer.
Definition net_stats.h:133
net_stats_t rst
Number of received TCP RST (reset) segments.
Definition net_stats.h:154
net_stats_t sent
Number of sent TCP segments.
Definition net_stats.h:139
net_stats_t resent
Amount of retransmitted data.
Definition net_stats.h:130
net_stats_t conndrop
Number of dropped connection attempts because too few connections were available.
Definition net_stats.h:162
net_stats_t recv
Number of received TCP segments.
Definition net_stats.h:136
struct net_stats_bytes bytes
Amount of received and sent TCP application data.
Definition net_stats.h:127
Network packet transfer times for calculating average TX time.
Definition net_stats.h:230
net_stats_t count
Number of network packets transferred.
Definition net_stats.h:235
uint64_t sum
Sum of network packet transfer times.
Definition net_stats.h:232
UDP statistics.
Definition net_stats.h:171
net_stats_t recv
Number of received UDP segments.
Definition net_stats.h:176
net_stats_t drop
Number of dropped UDP segments.
Definition net_stats.h:173
net_stats_t chkerr
Number of UDP segments with a bad checksum.
Definition net_stats.h:182
net_stats_t sent
Number of sent UDP segments.
Definition net_stats.h:179
All Wi-Fi specific statistics.
Definition net_stats.h:603
struct net_stats_pkts broadcast
Total number of broadcast packets received and sent.
Definition net_stats.h:614
struct net_stats_pkts multicast
Total number of multicast packets received and sent.
Definition net_stats.h:617
struct net_stats_sta_mgmt sta_mgmt
Total number of beacon errors.
Definition net_stats.h:605
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:608
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:611
struct net_stats_pkts errors
Total number of errors in RX and TX.
Definition net_stats.h:620
struct net_stats_pkts unicast
Total number of unicast packets received and sent.
Definition net_stats.h:623
All network statistics in one struct.
Definition net_stats.h:323
net_stats_t processing_error
Count of malformed packets or packets we do not have handler for.
Definition net_stats.h:325
struct net_stats_bytes bytes
This calculates amount of data transferred through all the network interfaces.
Definition net_stats.h:331
struct net_stats_ip_errors ip_errors
IP layer errors.
Definition net_stats.h:334