14#ifndef ZEPHYR_INCLUDE_NET_NET_STATS_H_
15#define ZEPHYR_INCLUDE_NET_NET_STATS_H_
253#if NET_TC_TX_COUNT == 0
254#define NET_TC_TX_STATS_COUNT 1
256#define NET_TC_TX_STATS_COUNT NET_TC_TX_COUNT
259#if NET_TC_RX_COUNT == 0
260#define NET_TC_RX_STATS_COUNT 1
262#define NET_TC_RX_STATS_COUNT NET_TC_RX_COUNT
275#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
278 tx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
292#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
295 rx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
338#if defined(CONFIG_NET_STATISTICS_IPV6)
343#if defined(CONFIG_NET_STATISTICS_IPV4)
348#if defined(CONFIG_NET_STATISTICS_ICMP)
353#if defined(CONFIG_NET_STATISTICS_TCP)
358#if defined(CONFIG_NET_STATISTICS_UDP)
363#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
368#if defined(CONFIG_NET_STATISTICS_MLD)
373#if defined(CONFIG_NET_STATISTICS_IGMP)
383#if defined(CONFIG_NET_PKT_TXTIME_STATS)
388#if defined(CONFIG_NET_PKT_RXTIME_STATS)
393#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
397#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
402#if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
512#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR
516struct net_stats_eth_vendor {
517 const char *
const key;
568#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR
570 struct net_stats_eth_vendor *vendor;
631#if defined(CONFIG_NET_STATISTICS_USER_API)
636#define _NET_STATS_LAYER NET_MGMT_LAYER_L3
637#define _NET_STATS_CODE 0x101
638#define _NET_STATS_BASE (NET_MGMT_LAYER(_NET_STATS_LAYER) | \
639 NET_MGMT_LAYER_CODE(_NET_STATS_CODE))
641enum net_request_stats_cmd {
642 NET_REQUEST_STATS_CMD_GET_ALL = 1,
643 NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR,
644 NET_REQUEST_STATS_CMD_GET_BYTES,
645 NET_REQUEST_STATS_CMD_GET_IP_ERRORS,
646 NET_REQUEST_STATS_CMD_GET_IPV4,
647 NET_REQUEST_STATS_CMD_GET_IPV6,
648 NET_REQUEST_STATS_CMD_GET_IPV6_ND,
649 NET_REQUEST_STATS_CMD_GET_ICMP,
650 NET_REQUEST_STATS_CMD_GET_UDP,
651 NET_REQUEST_STATS_CMD_GET_TCP,
652 NET_REQUEST_STATS_CMD_GET_ETHERNET,
653 NET_REQUEST_STATS_CMD_GET_PPP,
654 NET_REQUEST_STATS_CMD_GET_PM,
655 NET_REQUEST_STATS_CMD_GET_WIFI,
656 NET_REQUEST_STATS_CMD_RESET_WIFI,
662#define NET_REQUEST_STATS_GET_ALL \
663 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ALL)
666#define NET_REQUEST_STATS_GET_PROCESSING_ERROR \
667 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR)
670#define NET_REQUEST_STATS_GET_BYTES \
671 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_BYTES)
674#define NET_REQUEST_STATS_GET_IP_ERRORS \
675 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IP_ERRORS)
686#if defined(CONFIG_NET_STATISTICS_IPV4)
688#define NET_REQUEST_STATS_GET_IPV4 \
689 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV4)
696#if defined(CONFIG_NET_STATISTICS_IPV6)
698#define NET_REQUEST_STATS_GET_IPV6 \
699 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6)
706#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
708#define NET_REQUEST_STATS_GET_IPV6_ND \
709 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6_ND)
716#if defined(CONFIG_NET_STATISTICS_ICMP)
718#define NET_REQUEST_STATS_GET_ICMP \
719 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ICMP)
726#if defined(CONFIG_NET_STATISTICS_UDP)
728#define NET_REQUEST_STATS_GET_UDP \
729 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_UDP)
736#if defined(CONFIG_NET_STATISTICS_TCP)
738#define NET_REQUEST_STATS_GET_TCP \
739 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_TCP)
746#if defined(CONFIG_NET_STATISTICS_ETHERNET)
748#define NET_REQUEST_STATS_GET_ETHERNET \
749 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ETHERNET)
756#if defined(CONFIG_NET_STATISTICS_PPP)
758#define NET_REQUEST_STATS_GET_PPP \
759 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PPP)
768#if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
770#define NET_REQUEST_STATS_GET_PM \
771 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PM)
778#if defined(CONFIG_NET_STATISTICS_WIFI)
780#define NET_REQUEST_STATS_GET_WIFI \
781 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_WIFI)
788#define NET_REQUEST_STATS_RESET_WIFI \
789 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_RESET_WIFI)
#define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request)
Declare a request handler function for the given network event.
Definition net_mgmt.h:111
uint32_t net_stats_t
Network statistics counter.
Definition net_stats.h:38
Network core definitions.
Network Management API public header.
__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:43
net_stats_t sent
Number of bytes sent.
Definition net_stats.h:45
net_stats_t received
Number of bytes received.
Definition net_stats.h:47
Ethernet checksum statistics.
Definition net_stats.h:490
net_stats_t rx_csum_offload_good
Number of good RX checksum offloading.
Definition net_stats.h:492
net_stats_t rx_csum_offload_errors
Number of failed RX checksum offloading.
Definition net_stats.h:495
Ethernet error statistics.
Definition net_stats.h:411
net_stats_t tx_carrier_errors
Number of TX carrier errors.
Definition net_stats.h:449
net_stats_t uncorr_ecc_errors
Number of uncorrected ECC errors.
Definition net_stats.h:464
net_stats_t rx_long_length_errors
Number of RX long length errors.
Definition net_stats.h:431
net_stats_t tx_window_errors
Number of TX window errors.
Definition net_stats.h:458
net_stats_t corr_ecc_errors
Number of corrected ECC errors.
Definition net_stats.h:467
net_stats_t rx_missed_errors
Number of RX missed errors.
Definition net_stats.h:428
net_stats_t rx_crc_errors
Number of RX CRC errors.
Definition net_stats.h:419
net_stats_t rx_short_length_errors
Number of RX short length errors.
Definition net_stats.h:434
net_stats_t rx_align_errors
Number of RX buffer align errors.
Definition net_stats.h:437
net_stats_t rx_dma_failed
Number of RX DMA failed errors.
Definition net_stats.h:440
net_stats_t rx_no_buffer_count
Number of RX net_pkt allocation errors.
Definition net_stats.h:425
net_stats_t tx_fifo_errors
Number of TX FIFO errors.
Definition net_stats.h:452
net_stats_t rx_frame_errors
Number of RX frame errors.
Definition net_stats.h:422
net_stats_t rx_over_errors
Number of RX overrun errors.
Definition net_stats.h:416
net_stats_t tx_dma_failed
Number of TX DMA failed errors.
Definition net_stats.h:461
net_stats_t rx_length_errors
Number of RX length errors.
Definition net_stats.h:413
net_stats_t rx_buf_alloc_failed
Number of RX net_buf allocation errors.
Definition net_stats.h:443
net_stats_t tx_heartbeat_errors
Number of TX heartbeat errors.
Definition net_stats.h:455
net_stats_t tx_aborted_errors
Number of TX aborted errors.
Definition net_stats.h:446
Ethernet flow control statistics.
Definition net_stats.h:473
net_stats_t rx_flow_control_xon
Number of RX XON flow control.
Definition net_stats.h:475
net_stats_t tx_flow_control_xon
Number of TX XON flow control.
Definition net_stats.h:481
net_stats_t rx_flow_control_xoff
Number of RX XOFF flow control.
Definition net_stats.h:478
net_stats_t tx_flow_control_xoff
Number of TX XOFF flow control.
Definition net_stats.h:484
Ethernet hardware timestamp statistics.
Definition net_stats.h:501
net_stats_t tx_hwtstamp_timeouts
Number of RX hardware timestamp timeout.
Definition net_stats.h:506
net_stats_t rx_hwtstamp_cleared
Number of RX hardware timestamp cleared.
Definition net_stats.h:503
net_stats_t tx_hwtstamp_skipped
Number of RX hardware timestamp skipped.
Definition net_stats.h:509
All Ethernet specific statistics.
Definition net_stats.h:525
struct net_stats_pkts broadcast
Total number of broadcast packets received and sent.
Definition net_stats.h:533
struct net_stats_eth_csum csum
Total number of checksum errors in RX and TX.
Definition net_stats.h:548
net_stats_t tx_dropped
Total number of dropped TX packets.
Definition net_stats.h:557
struct net_stats_eth_hw_timestamp hw_timestamp
Total number of hardware timestamp errors in RX and TX.
Definition net_stats.h:551
struct net_stats_pkts multicast
Total number of multicast packets received and sent.
Definition net_stats.h:536
struct net_stats_eth_flow flow_control
Total number of flow control errors in RX and TX.
Definition net_stats.h:545
net_stats_t tx_restart_queue
Total number of TX queue restarts.
Definition net_stats.h:563
net_stats_t collisions
Total number of collisions.
Definition net_stats.h:554
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:527
struct net_stats_eth_errors error_details
Total number of errors in RX and TX.
Definition net_stats.h:542
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:530
struct net_stats_pkts errors
Total number of errors in RX and TX.
Definition net_stats.h:539
net_stats_t tx_timeout_count
Total number of TX timeout errors.
Definition net_stats.h:560
net_stats_t unknown_protocol
Total number of RX unknown protocol packets.
Definition net_stats.h:566
ICMP statistics.
Definition net_stats.h:107
net_stats_t sent
Number of sent ICMP packets.
Definition net_stats.h:112
net_stats_t chkerr
Number of ICMP packets with a bad checksum.
Definition net_stats.h:121
net_stats_t drop
Number of dropped ICMP packets.
Definition net_stats.h:115
net_stats_t typeerr
Number of ICMP packets with a wrong type.
Definition net_stats.h:118
net_stats_t recv
Number of received ICMP packets.
Definition net_stats.h:109
IP layer error statistics.
Definition net_stats.h:80
net_stats_t hblenerr
Number of packets dropped due to wrong IP length, high byte.
Definition net_stats.h:87
net_stats_t vhlerr
Number of packets dropped due to wrong IP version or header length.
Definition net_stats.h:84
net_stats_t chkerr
Number of packets dropped due to IP checksum errors.
Definition net_stats.h:96
net_stats_t protoerr
Number of packets dropped because they were neither ICMP, UDP nor TCP.
Definition net_stats.h:101
net_stats_t lblenerr
Number of packets dropped due to wrong IP length, low byte.
Definition net_stats.h:90
net_stats_t fragerr
Number of packets dropped because they were IP fragments.
Definition net_stats.h:93
IP layer statistics.
Definition net_stats.h:63
net_stats_t forwarded
Number of forwarded packets at the IP layer.
Definition net_stats.h:71
net_stats_t recv
Number of received packets at the IP layer.
Definition net_stats.h:65
net_stats_t sent
Number of sent packets at the IP layer.
Definition net_stats.h:68
net_stats_t drop
Number of dropped packets at the IP layer.
Definition net_stats.h:74
IPv4 IGMP daemon statistics.
Definition net_stats.h:218
net_stats_t drop
Number of dropped IPv4 IGMP packets.
Definition net_stats.h:226
net_stats_t recv
Number of received IPv4 IGMP queries.
Definition net_stats.h:220
net_stats_t sent
Number of sent IPv4 IGMP reports.
Definition net_stats.h:223
IPv6 multicast listener daemon statistics.
Definition net_stats.h:204
net_stats_t recv
Number of received IPv6 MLD queries.
Definition net_stats.h:206
net_stats_t sent
Number of sent IPv6 MLD reports.
Definition net_stats.h:209
net_stats_t drop
Number of dropped IPv6 MLD packets.
Definition net_stats.h:212
IPv6 neighbor discovery statistics.
Definition net_stats.h:190
net_stats_t sent
Number of sent IPv6 neighbor discovery packets.
Definition net_stats.h:198
net_stats_t recv
Number of received IPv6 neighbor discovery packets.
Definition net_stats.h:195
net_stats_t drop
Number of dropped IPv6 neighbor discovery packets.
Definition net_stats.h:192
Number of network packets sent and received.
Definition net_stats.h:53
net_stats_t rx
Number of packets received.
Definition net_stats.h:57
net_stats_t tx
Number of packets sent.
Definition net_stats.h:55
Power management statistics.
Definition net_stats.h:310
uint32_t last_suspend_time
How long the last suspend took.
Definition net_stats.h:316
uint32_t start_time
Network interface last suspend start time.
Definition net_stats.h:318
uint64_t overall_suspend_time
Total suspend time.
Definition net_stats.h:312
net_stats_t suspend_count
How many times we were suspended.
Definition net_stats.h:314
All PPP specific statistics.
Definition net_stats.h:577
net_stats_t chkerr
Number of received PPP frames with a bad checksum.
Definition net_stats.h:588
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:582
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:579
net_stats_t drop
Number of received and dropped PPP frames.
Definition net_stats.h:585
Network packet receive times for calculating average RX time.
Definition net_stats.h:243
uint64_t sum
Sum of network packet receive times.
Definition net_stats.h:245
net_stats_t count
Number of network packets received.
Definition net_stats.h:248
All Wi-Fi management statistics.
Definition net_stats.h:594
net_stats_t beacons_miss
Number of missed beacons.
Definition net_stats.h:599
net_stats_t beacons_rx
Number of received beacons.
Definition net_stats.h:596
Traffic class statistics.
Definition net_stats.h:270
net_stats_t bytes
Number of bytes sent for this traffic class.
Definition net_stats.h:283
struct net_stats_tx_time tx_time
Helper for calculating average TX time statistics.
Definition net_stats.h:274
net_stats_t pkts
Number of packets sent for this traffic class.
Definition net_stats.h:281
uint8_t priority
Priority of this traffic class.
Definition net_stats.h:285
struct net_stats_tc::@398 recv[NET_TC_RX_STATS_COUNT]
RX statistics for each traffic class.
struct net_stats_tc::@397 sent[NET_TC_TX_STATS_COUNT]
TX statistics for each traffic class.
TCP statistics.
Definition net_stats.h:127
net_stats_t ackerr
Number of received TCP segments with a bad ACK number.
Definition net_stats.h:150
net_stats_t rsterr
Number of received bad TCP RST (reset) segments.
Definition net_stats.h:153
net_stats_t rexmit
Number of retransmitted TCP segments.
Definition net_stats.h:159
net_stats_t chkerr
Number of TCP segments with a bad checksum.
Definition net_stats.h:147
net_stats_t seg_drop
Number of dropped TCP segments.
Definition net_stats.h:144
net_stats_t connrst
Number of connection attempts for closed ports, triggering a RST.
Definition net_stats.h:167
net_stats_t drop
Number of dropped packets at the TCP layer.
Definition net_stats.h:135
net_stats_t rst
Number of received TCP RST (reset) segments.
Definition net_stats.h:156
net_stats_t sent
Number of sent TCP segments.
Definition net_stats.h:141
net_stats_t resent
Amount of retransmitted data.
Definition net_stats.h:132
net_stats_t conndrop
Number of dropped connection attempts because too few connections were available.
Definition net_stats.h:164
net_stats_t recv
Number of received TCP segments.
Definition net_stats.h:138
struct net_stats_bytes bytes
Amount of received and sent TCP application data.
Definition net_stats.h:129
Network packet transfer times for calculating average TX time.
Definition net_stats.h:232
net_stats_t count
Number of network packets transferred.
Definition net_stats.h:237
uint64_t sum
Sum of network packet transfer times.
Definition net_stats.h:234
UDP statistics.
Definition net_stats.h:173
net_stats_t recv
Number of received UDP segments.
Definition net_stats.h:178
net_stats_t drop
Number of dropped UDP segments.
Definition net_stats.h:175
net_stats_t chkerr
Number of UDP segments with a bad checksum.
Definition net_stats.h:184
net_stats_t sent
Number of sent UDP segments.
Definition net_stats.h:181
All Wi-Fi specific statistics.
Definition net_stats.h:605
struct net_stats_pkts broadcast
Total number of broadcast packets received and sent.
Definition net_stats.h:616
struct net_stats_pkts multicast
Total number of multicast packets received and sent.
Definition net_stats.h:619
struct net_stats_sta_mgmt sta_mgmt
Total number of beacon errors.
Definition net_stats.h:607
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:610
net_stats_t overrun_count
Total number of dropped packets at received and sent.
Definition net_stats.h:628
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:613
struct net_stats_pkts errors
Total number of errors in RX and TX.
Definition net_stats.h:622
struct net_stats_pkts unicast
Total number of unicast packets received and sent.
Definition net_stats.h:625
All network statistics in one struct.
Definition net_stats.h:325
net_stats_t processing_error
Count of malformed packets or packets we do not have handler for.
Definition net_stats.h:327
struct net_stats_bytes bytes
This calculates amount of data transferred through all the network interfaces.
Definition net_stats.h:333
struct net_stats_ip_errors ip_errors
IP layer errors.
Definition net_stats.h:336