Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
net_stats.h
Go to the documentation of this file.
1
8/*
9 * Copyright (c) 2016 Intel Corporation
10 *
11 * SPDX-License-Identifier: Apache-2.0
12 */
13
14#ifndef ZEPHYR_INCLUDE_NET_NET_STATS_H_
15#define ZEPHYR_INCLUDE_NET_NET_STATS_H_
16
17#include <zephyr/types.h>
18#include <zephyr/net/net_core.h>
19#include <zephyr/net/net_mgmt.h>
20
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
46
56
66
83
110
130
176
193
207
221
235
249
263
277
288
299
302#if NET_TC_TX_COUNT == 0
303#define NET_TC_TX_STATS_COUNT 1
304#else
305#define NET_TC_TX_STATS_COUNT NET_TC_TX_COUNT
306#endif
307
308#if NET_TC_RX_COUNT == 0
309#define NET_TC_RX_STATS_COUNT 1
310#else
311#define NET_TC_RX_STATS_COUNT NET_TC_RX_COUNT
312#endif
313
321 struct {
324#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
326 struct net_stats_tx_time
327 tx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
328#endif
335 } sent[NET_TC_TX_STATS_COUNT];
336
338 struct {
340 struct net_stats_rx_time rx_time;
341#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
343 struct net_stats_rx_time
344 rx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
345#endif
347 net_stats_t pkts;
349 net_stats_t bytes;
351 uint8_t priority;
352 } recv[NET_TC_RX_STATS_COUNT];
353};
354
355
369
370
374struct net_stats {
377
383
386
387#if defined(CONFIG_NET_STATISTICS_IPV6)
389 struct net_stats_ip ipv6;
390#endif
391
392#if defined(CONFIG_NET_STATISTICS_IPV4)
394 struct net_stats_ip ipv4;
395#endif
396
397#if defined(CONFIG_NET_STATISTICS_ICMP)
399 struct net_stats_icmp icmp;
400#endif
401
402#if defined(CONFIG_NET_STATISTICS_TCP)
404 struct net_stats_tcp tcp;
405#endif
406
407#if defined(CONFIG_NET_STATISTICS_UDP)
409 struct net_stats_udp udp;
410#endif
411
412#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
414 struct net_stats_ipv6_nd ipv6_nd;
415#endif
416
417#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU)
419 struct net_stats_ipv6_pmtu ipv6_pmtu;
420#endif
421
422#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU)
424 struct net_stats_ipv4_pmtu ipv4_pmtu;
425#endif
426
427#if defined(CONFIG_NET_STATISTICS_MLD)
429 struct net_stats_ipv6_mld ipv6_mld;
430#endif
431
432#if defined(CONFIG_NET_STATISTICS_IGMP)
434 struct net_stats_ipv4_igmp ipv4_igmp;
435#endif
436
437#if defined(CONFIG_NET_STATISTICS_DNS)
439 struct net_stats_dns dns;
440#endif
441
442#if NET_TC_COUNT > 1
444 struct net_stats_tc tc;
445#endif
446
447#if defined(CONFIG_NET_PKT_TXTIME_STATS)
449 struct net_stats_tx_time tx_time;
450#endif
451
452#if defined(CONFIG_NET_PKT_RXTIME_STATS)
454 struct net_stats_rx_time rx_time;
455#endif
456
457#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
459 struct net_stats_tx_time tx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
460#endif
461#if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
463 struct net_stats_rx_time rx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
464#endif
465
466#if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
468 struct net_stats_pm pm;
469#endif
470};
471
533
550
561
575
576#ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR
580struct net_stats_eth_vendor {
581 const char * const key;
582 uint32_t value;
583};
584#endif
585
637
654
665
694
695#if defined(CONFIG_NET_STATISTICS_USER_API)
696/* Management part definitions */
697
700#define _NET_STATS_LAYER NET_MGMT_LAYER_L3
701#define _NET_STATS_CODE 0x101
702#define _NET_STATS_BASE (NET_MGMT_LAYER(_NET_STATS_LAYER) | \
703 NET_MGMT_LAYER_CODE(_NET_STATS_CODE))
704
705enum net_request_stats_cmd {
706 NET_REQUEST_STATS_CMD_GET_ALL = 1,
707 NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR,
708 NET_REQUEST_STATS_CMD_GET_BYTES,
709 NET_REQUEST_STATS_CMD_GET_IP_ERRORS,
710 NET_REQUEST_STATS_CMD_GET_IPV4,
711 NET_REQUEST_STATS_CMD_GET_IPV6,
712 NET_REQUEST_STATS_CMD_GET_IPV6_ND,
713 NET_REQUEST_STATS_CMD_GET_IPV6_PMTU,
714 NET_REQUEST_STATS_CMD_GET_IPV4_PMTU,
715 NET_REQUEST_STATS_CMD_GET_ICMP,
716 NET_REQUEST_STATS_CMD_GET_UDP,
717 NET_REQUEST_STATS_CMD_GET_TCP,
718 NET_REQUEST_STATS_CMD_GET_ETHERNET,
719 NET_REQUEST_STATS_CMD_GET_PPP,
720 NET_REQUEST_STATS_CMD_GET_PM,
721 NET_REQUEST_STATS_CMD_GET_WIFI,
722 NET_REQUEST_STATS_CMD_RESET_WIFI,
723};
724
728#define NET_REQUEST_STATS_GET_ALL \
729 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ALL)
730
732#define NET_REQUEST_STATS_GET_PROCESSING_ERROR \
733 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR)
734
736#define NET_REQUEST_STATS_GET_BYTES \
737 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_BYTES)
738
740#define NET_REQUEST_STATS_GET_IP_ERRORS \
741 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IP_ERRORS)
742
745NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ALL);
746NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_PROCESSING_ERROR);
747NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_BYTES);
748NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IP_ERRORS);
749
752#if defined(CONFIG_NET_STATISTICS_IPV4)
754#define NET_REQUEST_STATS_GET_IPV4 \
755 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV4)
756
758NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV4);
760#endif /* CONFIG_NET_STATISTICS_IPV4 */
761
762#if defined(CONFIG_NET_STATISTICS_IPV6)
764#define NET_REQUEST_STATS_GET_IPV6 \
765 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6)
766
768NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6);
770#endif /* CONFIG_NET_STATISTICS_IPV6 */
771
772#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
774#define NET_REQUEST_STATS_GET_IPV6_ND \
775 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6_ND)
776
778NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_ND);
780#endif /* CONFIG_NET_STATISTICS_IPV6_ND */
781
782#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU)
784#define NET_REQUEST_STATS_GET_IPV6_PMTU \
785 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6_PMTU)
786
788NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_PMTU);
790#endif /* CONFIG_NET_STATISTICS_IPV6_PMTU */
791
792#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU)
794#define NET_REQUEST_STATS_GET_IPV4_PMTU \
795 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV4_PMTU)
796
798NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV4_PMTU);
800#endif /* CONFIG_NET_STATISTICS_IPV4_PMTU */
801
802#if defined(CONFIG_NET_STATISTICS_ICMP)
804#define NET_REQUEST_STATS_GET_ICMP \
805 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ICMP)
806
808NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ICMP);
810#endif /* CONFIG_NET_STATISTICS_ICMP */
811
812#if defined(CONFIG_NET_STATISTICS_UDP)
814#define NET_REQUEST_STATS_GET_UDP \
815 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_UDP)
816
818NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_UDP);
820#endif /* CONFIG_NET_STATISTICS_UDP */
821
822#if defined(CONFIG_NET_STATISTICS_TCP)
824#define NET_REQUEST_STATS_GET_TCP \
825 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_TCP)
826
828NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_TCP);
830#endif /* CONFIG_NET_STATISTICS_TCP */
831
832#if defined(CONFIG_NET_STATISTICS_ETHERNET)
834#define NET_REQUEST_STATS_GET_ETHERNET \
835 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ETHERNET)
836
838NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ETHERNET);
840#endif /* CONFIG_NET_STATISTICS_ETHERNET */
841
842#if defined(CONFIG_NET_STATISTICS_PPP)
844#define NET_REQUEST_STATS_GET_PPP \
845 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PPP)
846
848NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_PPP);
850#endif /* CONFIG_NET_STATISTICS_PPP */
851
852#endif /* CONFIG_NET_STATISTICS_USER_API */
853
854#if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
856#define NET_REQUEST_STATS_GET_PM \
857 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PM)
858
860NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_PM);
862#endif /* CONFIG_NET_STATISTICS_POWER_MANAGEMENT */
863
864#if defined(CONFIG_NET_STATISTICS_WIFI)
866#define NET_REQUEST_STATS_GET_WIFI \
867 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_WIFI)
868
870NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI);
874#define NET_REQUEST_STATS_RESET_WIFI \
875 (_NET_STATS_BASE | NET_REQUEST_STATS_CMD_RESET_WIFI)
876
878NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_RESET_WIFI);
880#endif /* CONFIG_NET_STATISTICS_WIFI */
881
882#define NET_STATS_GET_METRIC_NAME(_name) _name
883#define NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx) net_stats_##dev_id##_##sfx##_collector
884#define NET_STATS_GET_VAR(dev_id, sfx, var) zephyr_net_##var
885#define NET_STATS_GET_INSTANCE(dev_id, sfx, _not_used) STRINGIFY(_##dev_id##_##sfx)
886
887/* The label value is set to be the network interface name. Note that we skip
888 * the first character (_) when setting the label value. This can be changed
889 * if there is a way to token paste the instance name without the prefix character.
890 * Note also that the below macros have some parameters that are not used atm.
891 */
892#define NET_STATS_PROMETHEUS_COUNTER_DEFINE(_desc, _labelval, _not_used, \
893 _collector, _name, _stat_var_ptr) \
894 static PROMETHEUS_COUNTER_DEFINE( \
895 NET_STATS_GET_METRIC_NAME(_name), \
896 _desc, ({ .key = "nic", .value = &_labelval[1] }), \
897 &(_collector), _stat_var_ptr)
898
899#define NET_STATS_PROMETHEUS_GAUGE_DEFINE(_desc, _labelval, _not_used, \
900 _collector, _name, _stat_var_ptr) \
901 static PROMETHEUS_GAUGE_DEFINE( \
902 NET_STATS_GET_METRIC_NAME(_name), \
903 _desc, ({ .key = "nic", .value = &_labelval[1] }), \
904 &(_collector), _stat_var_ptr)
905
906#define NET_STATS_PROMETHEUS_SUMMARY_DEFINE(_desc, _labelval, _not_used, \
907 _collector, _name, _stat_var_ptr) \
908 static PROMETHEUS_SUMMARY_DEFINE( \
909 NET_STATS_GET_METRIC_NAME(_name), \
910 _desc, ({ .key = "nic", .value = &_labelval[1] }), \
911 &(_collector), _stat_var_ptr)
912
913#define NET_STATS_PROMETHEUS_HISTOGRAM_DEFINE(_desc, _labelval, _not_used, \
914 _collector, _name, _stat_var_ptr) \
915 static PROMETHEUS_HISTOGRAM_DEFINE( \
916 NET_STATS_GET_METRIC_NAME(_name), \
917 _desc, ({ .key = "nic", .value = &_labelval[1] }), \
918 &(_collector), _stat_var_ptr)
919
920/* IPv6 layer statistics */
921#if defined(CONFIG_NET_STATISTICS_IPV6)
922#define NET_STATS_PROMETHEUS_IPV6(iface, dev_id, sfx) \
923 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
924 "IPv6 packets sent", \
925 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_sent), \
926 "packet_count", \
927 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
928 NET_STATS_GET_VAR(dev_id, sfx, ipv6_sent), \
929 &(iface)->stats.ipv6.sent); \
930 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
931 "IPv6 packets received", \
932 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_recv), \
933 "packet_count", \
934 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
935 NET_STATS_GET_VAR(dev_id, sfx, ipv6_recv), \
936 &(iface)->stats.ipv6.recv); \
937 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
938 "IPv6 packets dropped", \
939 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_drop), \
940 "packet_count", \
941 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
942 NET_STATS_GET_VAR(dev_id, sfx, ipv6_drop), \
943 &(iface)->stats.ipv6.drop); \
944 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
945 "IPv6 packets forwarded", \
946 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_forward), \
947 "packet_count", \
948 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
949 NET_STATS_GET_VAR(dev_id, sfx, ipv6_forwarded), \
950 &(iface)->stats.ipv6.forwarded)
951#else
952#define NET_STATS_PROMETHEUS_IPV6(iface, dev_id, sfx)
953#endif
954
955/* IPv4 layer statistics */
956#if defined(CONFIG_NET_STATISTICS_IPV4)
957#define NET_STATS_PROMETHEUS_IPV4(iface, dev_id, sfx) \
958 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
959 "IPv4 packets sent", \
960 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_sent), \
961 "packet_count", \
962 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
963 NET_STATS_GET_VAR(dev_id, sfx, ipv4_sent), \
964 &(iface)->stats.ipv4.sent); \
965 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
966 "IPv4 packets received", \
967 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_recv), \
968 "packet_count", \
969 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
970 NET_STATS_GET_VAR(dev_id, sfx, ipv4_recv), \
971 &(iface)->stats.ipv4.recv); \
972 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
973 "IPv4 packets dropped", \
974 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_drop), \
975 "packet_count", \
976 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
977 NET_STATS_GET_VAR(dev_id, sfx, ipv4_drop), \
978 &(iface)->stats.ipv4.drop); \
979 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
980 "IPv4 packets forwarded", \
981 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_forwarded), \
982 "packet_count", \
983 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
984 NET_STATS_GET_VAR(dev_id, sfx, ipv4_forwarded), \
985 &(iface)->stats.ipv4.forwarded)
986#else
987#define NET_STATS_PROMETHEUS_IPV4(iface, dev_id, sfx)
988#endif
989
990/* ICMP layer statistics */
991#if defined(CONFIG_NET_STATISTICS_ICMP)
992#define NET_STATS_PROMETHEUS_ICMP(iface, dev_id, sfx) \
993 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
994 "ICMP packets sent", \
995 NET_STATS_GET_INSTANCE(dev_id, sfx, icmp_sent), \
996 "packet_count", \
997 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
998 NET_STATS_GET_VAR(dev_id, sfx, icmp_sent), \
999 &(iface)->stats.icmp.sent); \
1000 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1001 "ICMP packets received", \
1002 NET_STATS_GET_INSTANCE(dev_id, sfx, icmp_recv), \
1003 "packet_count", \
1004 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1005 NET_STATS_GET_VAR(dev_id, sfx, icmp_recv), \
1006 &(iface)->stats.icmp.recv); \
1007 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1008 "ICMP packets dropped", \
1009 NET_STATS_GET_INSTANCE(dev_id, sfx, icmp_drop), \
1010 "packet_count", \
1011 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1012 NET_STATS_GET_VAR(dev_id, sfx, icmp_drop), \
1013 &(iface)->stats.icmp.drop); \
1014 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1015 "ICMP packets checksum error", \
1016 NET_STATS_GET_INSTANCE(dev_id, sfx, icmp_chkerr), \
1017 "packet_count", \
1018 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1019 NET_STATS_GET_VAR(dev_id, sfx, icmp_chkerr), \
1020 &(iface)->stats.icmp.chkerr); \
1021 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1022 "ICMP packets type error", \
1023 NET_STATS_GET_INSTANCE(dev_id, sfx, icmp_typeerr), \
1024 "packet_count", \
1025 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1026 NET_STATS_GET_VAR(dev_id, sfx, icmp_typeerr), \
1027 &(iface)->stats.icmp.typeerr)
1028#else
1029#define NET_STATS_PROMETHEUS_ICMP(iface, dev_id, sfx)
1030#endif
1031
1032/* UDP layer statistics */
1033#if defined(CONFIG_NET_STATISTICS_UDP)
1034#define NET_STATS_PROMETHEUS_UDP(iface, dev_id, sfx) \
1035 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1036 "UDP packets sent", \
1037 NET_STATS_GET_INSTANCE(dev_id, sfx, udp_sent), \
1038 "packet_count", \
1039 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1040 NET_STATS_GET_VAR(dev_id, sfx, udp_sent), \
1041 &(iface)->stats.udp.sent); \
1042 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1043 "UDP packets received", \
1044 NET_STATS_GET_INSTANCE(dev_id, sfx, udp_recv), \
1045 "packet_count", \
1046 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1047 NET_STATS_GET_VAR(dev_id, sfx, udp_recv), \
1048 &(iface)->stats.udp.recv); \
1049 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1050 "UDP packets dropped", \
1051 NET_STATS_GET_INSTANCE(dev_id, sfx, udp_drop), \
1052 "packet_count", \
1053 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1054 NET_STATS_GET_VAR(dev_id, sfx, udp_drop), \
1055 &(iface)->stats.udp.drop); \
1056 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1057 "UDP packets checksum error", \
1058 NET_STATS_GET_INSTANCE(dev_id, sfx, udp_chkerr), \
1059 "packet_count", \
1060 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1061 NET_STATS_GET_VAR(dev_id, sfx, udp_chkerr), \
1062 &(iface)->stats.udp.chkerr)
1063#else
1064#define NET_STATS_PROMETHEUS_UDP(iface, dev_id, sfx)
1065#endif
1066
1067/* TCP layer statistics */
1068#if defined(CONFIG_NET_STATISTICS_TCP)
1069#define NET_STATS_PROMETHEUS_TCP(iface, dev_id, sfx) \
1070 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1071 "TCP bytes sent", \
1072 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_bytes_sent), \
1073 "byte_count", \
1074 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1075 NET_STATS_GET_VAR(dev_id, sfx, tcp_bytes_sent), \
1076 &(iface)->stats.tcp.bytes.sent); \
1077 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1078 "TCP bytes received", \
1079 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_bytes_recv), \
1080 "byte_count", \
1081 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1082 NET_STATS_GET_VAR(dev_id, sfx, tcp_bytes_recv), \
1083 &(iface)->stats.tcp.bytes.received); \
1084 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1085 "TCP bytes resent", \
1086 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_bytes_resent), \
1087 "byte_count", \
1088 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1089 NET_STATS_GET_VAR(dev_id, sfx, tcp_bytes_resent), \
1090 &(iface)->stats.tcp.resent); \
1091 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1092 "TCP packets sent", \
1093 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_sent), \
1094 "packet_count", \
1095 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1096 NET_STATS_GET_VAR(dev_id, sfx, tcp_sent), \
1097 &(iface)->stats.tcp.sent); \
1098 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1099 "TCP packets received", \
1100 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_recv), \
1101 "packet_count", \
1102 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1103 NET_STATS_GET_VAR(dev_id, sfx, tcp_recv), \
1104 &(iface)->stats.tcp.recv); \
1105 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1106 "TCP packets dropped", \
1107 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_drop), \
1108 "packet_count", \
1109 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1110 NET_STATS_GET_VAR(dev_id, sfx, tcp_drop), \
1111 &(iface)->stats.tcp.drop); \
1112 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1113 "TCP packets checksum error", \
1114 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_chkerr), \
1115 "packet_count", \
1116 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1117 NET_STATS_GET_VAR(dev_id, sfx, tcp_chkerr), \
1118 &(iface)->stats.tcp.chkerr); \
1119 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1120 "TCP packets ack error", \
1121 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_ackerr), \
1122 "packet_count", \
1123 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1124 NET_STATS_GET_VAR(dev_id, sfx, tcp_ackerr), \
1125 &(iface)->stats.tcp.ackerr); \
1126 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1127 "TCP packets reset error", \
1128 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_rsterr), \
1129 "packet_count", \
1130 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1131 NET_STATS_GET_VAR(dev_id, sfx, tcp_rsterr), \
1132 &(iface)->stats.tcp.rsterr); \
1133 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1134 "TCP packets retransmitted", \
1135 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_rexmit), \
1136 "packet_count", \
1137 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1138 NET_STATS_GET_VAR(dev_id, sfx, tcp_rexmit), \
1139 &(iface)->stats.tcp.rexmit); \
1140 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1141 "TCP reset received", \
1142 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_rst_recv), \
1143 "packet_count", \
1144 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1145 NET_STATS_GET_VAR(dev_id, sfx, tcp_rst), \
1146 &(iface)->stats.tcp.rst); \
1147 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1148 "TCP connection drop", \
1149 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_conndrop), \
1150 "packet_count", \
1151 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1152 NET_STATS_GET_VAR(dev_id, sfx, tcp_conndrop), \
1153 &(iface)->stats.tcp.conndrop); \
1154 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1155 "TCP connection reset", \
1156 NET_STATS_GET_INSTANCE(dev_id, sfx, tcp_connrst), \
1157 "packet_count", \
1158 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1159 NET_STATS_GET_VAR(dev_id, sfx, tcp_connrst), \
1160 &(iface)->stats.tcp.connrst)
1161#else
1162#define NET_STATS_PROMETHEUS_TCP(iface, dev_id, sfx)
1163#endif
1164
1165/* IPv6 Neighbor Discovery statistics */
1166#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
1167#define NET_STATS_PROMETHEUS_IPV6_ND(iface, dev_id, sfx) \
1168 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1169 "IPv6 ND packets sent", \
1170 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_nd_sent), \
1171 "packet_count", \
1172 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1173 NET_STATS_GET_VAR(dev_id, sfx, ipv6_nd_sent), \
1174 &(iface)->stats.ipv6_nd.sent); \
1175 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1176 "IPv6 ND packets received", \
1177 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_nd_recv), \
1178 "packet_count", \
1179 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1180 NET_STATS_GET_VAR(dev_id, sfx, ipv6_nd_recv), \
1181 &(iface)->stats.ipv6_nd.recv); \
1182 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1183 "IPv6 ND packets dropped", \
1184 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_nd_drop), \
1185 "packet_count", \
1186 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1187 NET_STATS_GET_VAR(dev_id, sfx, ipv6_nd_drop), \
1188 &(iface)->stats.ipv6_nd.drop)
1189#else
1190#define NET_STATS_PROMETHEUS_IPV6_ND(iface, dev_id, sfx)
1191#endif
1192
1193/* IPv6 Path MTU Discovery statistics */
1194#if defined(CONFIG_NET_STATISTICS_IPV6_PMTU)
1195#define NET_STATS_PROMETHEUS_IPV6_PMTU(iface, dev_id, sfx) \
1196 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1197 "IPv6 PMTU packets sent", \
1198 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_pmtu_sent), \
1199 "packet_count", \
1200 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1201 NET_STATS_GET_VAR(dev_id, sfx, ipv6_pmtu_sent), \
1202 &(iface)->stats.ipv6_pmtu.sent); \
1203 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1204 "IPv6 PMTU packets received", \
1205 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_pmtu_recv), \
1206 "packet_count", \
1207 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1208 NET_STATS_GET_VAR(dev_id, sfx, ipv6_pmtu_recv), \
1209 &(iface)->stats.ipv6_pmtu.recv); \
1210 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1211 "IPv6 PMTU packets dropped", \
1212 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_pmtu_drop), \
1213 "packet_count", \
1214 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1215 NET_STATS_GET_VAR(dev_id, sfx, ipv6_pmtu_drop), \
1216 &(iface)->stats.ipv6_pmtu.drop)
1217#else
1218#define NET_STATS_PROMETHEUS_IPV6_PMTU(iface, dev_id, sfx)
1219#endif
1220
1221/* IPv4 Path MTU Discovery statistics */
1222#if defined(CONFIG_NET_STATISTICS_IPV4_PMTU)
1223#define NET_STATS_PROMETHEUS_IPV4_PMTU(iface, dev_id, sfx) \
1224 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1225 "IPv4 PMTU packets sent", \
1226 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_pmtu_sent), \
1227 "packet_count", \
1228 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1229 NET_STATS_GET_VAR(dev_id, sfx, ipv4_pmtu_sent), \
1230 &(iface)->stats.ipv4_pmtu.sent); \
1231 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1232 "IPv4 PMTU packets received", \
1233 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_pmtu_recv), \
1234 "packet_count", \
1235 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1236 NET_STATS_GET_VAR(dev_id, sfx, ipv4_pmtu_recv), \
1237 &(iface)->stats.ipv4_pmtu.recv); \
1238 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1239 "IPv4 PMTU packets dropped", \
1240 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_pmtu_drop), \
1241 "packet_count", \
1242 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1243 NET_STATS_GET_VAR(dev_id, sfx, ipv4_pmtu_drop), \
1244 &(iface)->stats.ipv4_pmtu.drop)
1245#else
1246#define NET_STATS_PROMETHEUS_IPV4_PMTU(iface, dev_id, sfx)
1247#endif
1248
1249/* IPv6 Multicast Listener Discovery statistics */
1250#if defined(CONFIG_NET_STATISTICS_MLD)
1251#define NET_STATS_PROMETHEUS_MLD(iface, dev_id, sfx) \
1252 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1253 "IPv6 MLD packets sent", \
1254 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_mld_sent), \
1255 "packet_count", \
1256 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1257 NET_STATS_GET_VAR(dev_id, sfx, ipv6_mld_sent), \
1258 &(iface)->stats.ipv6_mld.sent); \
1259 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1260 "IPv6 MLD packets received", \
1261 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_mld_recv), \
1262 "packet_count", \
1263 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1264 NET_STATS_GET_VAR(dev_id, sfx, ipv6_mld_recv), \
1265 &(iface)->stats.ipv6_mld.recv); \
1266 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1267 "IPv6 MLD packets dropped", \
1268 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv6_mld_drop), \
1269 "packet_count", \
1270 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1271 NET_STATS_GET_VAR(dev_id, sfx, ipv6_mld_drop), \
1272 &(iface)->stats.ipv6_mld.drop)
1273#else
1274#define NET_STATS_PROMETHEUS_MLD(iface, dev_id, sfx)
1275#endif
1276
1277/* IPv4 IGMP statistics */
1278#if defined(CONFIG_NET_STATISTICS_IGMP)
1279#define NET_STATS_PROMETHEUS_IGMP(iface, dev_id, sfx) \
1280 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1281 "IPv4 IGMP packets sent", \
1282 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_igmp_sent), \
1283 "packet_count", \
1284 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1285 NET_STATS_GET_VAR(dev_id, sfx, ipv4_igmp_sent), \
1286 &(iface)->stats.ipv4_igmp.sent); \
1287 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1288 "IPv4 IGMP packets received", \
1289 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_igmp_recv), \
1290 "packet_count", \
1291 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1292 NET_STATS_GET_VAR(dev_id, sfx, ipv4_igmp_recv), \
1293 &(iface)->stats.ipv4_igmp.recv); \
1294 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1295 "IPv4 IGMP packets dropped", \
1296 NET_STATS_GET_INSTANCE(dev_id, sfx, ipv4_igmp_drop), \
1297 "packet_count", \
1298 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1299 NET_STATS_GET_VAR(dev_id, sfx, ipv4_igmp_drop), \
1300 &(iface)->stats.ipv4_igmp.drop)
1301#else
1302#define NET_STATS_PROMETHEUS_IGMP(iface, dev_id, sfx)
1303#endif
1304
1305/* DNS statistics */
1306#if defined(CONFIG_NET_STATISTICS_DNS)
1307#define NET_STATS_PROMETHEUS_DNS(iface, dev_id, sfx) \
1308 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1309 "DNS packets sent", \
1310 NET_STATS_GET_INSTANCE(dev_id, sfx, dns_sent), \
1311 "packet_count", \
1312 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1313 NET_STATS_GET_VAR(dev_id, sfx, dns_sent), \
1314 &(iface)->stats.dns.sent); \
1315 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1316 "DNS packets received", \
1317 NET_STATS_GET_INSTANCE(dev_id, sfx, dns_recv), \
1318 "packet_count", \
1319 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1320 NET_STATS_GET_VAR(dev_id, sfx, dns_recv), \
1321 &(iface)->stats.dns.recv); \
1322 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1323 "DNS packets dropped", \
1324 NET_STATS_GET_INSTANCE(dev_id, sfx, dns_drop), \
1325 "packet_count", \
1326 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1327 NET_STATS_GET_VAR(dev_id, sfx, dns_drop), \
1328 &(iface)->stats.dns.drop)
1329#else
1330#define NET_STATS_PROMETHEUS_DNS(iface, dev_id, sfx)
1331#endif
1332
1333/* TX time statistics */
1334#if defined(CONFIG_NET_PKT_TXTIME_STATS)
1335#define NET_STATS_PROMETHEUS_TX_TIME(iface, dev_id, sfx) \
1336 NET_STATS_PROMETHEUS_SUMMARY_DEFINE( \
1337 "TX time in microseconds", \
1338 NET_STATS_GET_INSTANCE(dev_id, sfx, tx_time), \
1339 "time", \
1340 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1341 NET_STATS_GET_VAR(dev_id, sfx, tx_time), \
1342 &(iface)->stats.tx_time)
1343#else
1344#define NET_STATS_PROMETHEUS_TX_TIME(iface, dev_id, sfx)
1345#endif
1346
1347/* RX time statistics */
1348#if defined(CONFIG_NET_PKT_RXTIME_STATS)
1349#define NET_STATS_PROMETHEUS_RX_TIME(iface, dev_id, sfx) \
1350 NET_STATS_PROMETHEUS_SUMMARY_DEFINE( \
1351 "RX time in microseconds", \
1352 NET_STATS_GET_INSTANCE(dev_id, sfx, rx_time), \
1353 "time", \
1354 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1355 NET_STATS_GET_VAR(dev_id, sfx, rx_time), \
1356 &(iface)->stats.rx_time)
1357#else
1358#define NET_STATS_PROMETHEUS_RX_TIME(iface, dev_id, sfx)
1359#endif
1360
1361/* Per network interface statistics via Prometheus */
1362#define NET_STATS_PROMETHEUS(iface, dev_id, sfx) \
1363 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1364 "Processing error", \
1365 NET_STATS_GET_INSTANCE(dev_id, sfx, process_error), \
1366 "error_count", \
1367 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1368 NET_STATS_GET_VAR(dev_id, sfx, processing_error), \
1369 &(iface)->stats.processing_error); \
1370 /* IP layer error statistics */ \
1371 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1372 "IP proto error", \
1373 NET_STATS_GET_INSTANCE(dev_id, sfx, ip_proto_error), \
1374 "error_count", \
1375 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1376 NET_STATS_GET_VAR(dev_id, sfx, ip_errors_protoerr), \
1377 &(iface)->stats.ip_errors.protoerr); \
1378 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1379 "IP version/header len error", \
1380 NET_STATS_GET_INSTANCE(dev_id, sfx, ip_vhl_error), \
1381 "error_count", \
1382 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1383 NET_STATS_GET_VAR(dev_id, sfx, ip_errors_vhlerr), \
1384 &(iface)->stats.ip_errors.vhlerr); \
1385 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1386 "IP header len error (high byte)", \
1387 NET_STATS_GET_INSTANCE(dev_id, sfx, ip_hblen_error), \
1388 "error_count", \
1389 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1390 NET_STATS_GET_VAR(dev_id, sfx, ip_errors_hblenerr), \
1391 &(iface)->stats.ip_errors.hblenerr); \
1392 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1393 "IP header len error (low byte)", \
1394 NET_STATS_GET_INSTANCE(dev_id, sfx, ip_lblen_error), \
1395 "error_count", \
1396 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1397 NET_STATS_GET_VAR(dev_id, sfx, ip_errors_lblenerr), \
1398 &(iface)->stats.ip_errors.lblenerr); \
1399 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1400 "IP fragment error", \
1401 NET_STATS_GET_INSTANCE(dev_id, sfx, ip_frag_error), \
1402 "error_count", \
1403 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1404 NET_STATS_GET_VAR(dev_id, sfx, ip_errors_fragerr), \
1405 &(iface)->stats.ip_errors.fragerr); \
1406 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1407 "IP checksum error", \
1408 NET_STATS_GET_INSTANCE(dev_id, sfx, ip_chk_error), \
1409 "error_count", \
1410 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1411 NET_STATS_GET_VAR(dev_id, sfx, ip_errors_chkerr), \
1412 &(iface)->stats.ip_errors.chkerr); \
1413 /* General network statistics */ \
1414 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1415 "Bytes received", \
1416 NET_STATS_GET_INSTANCE(dev_id, sfx, bytes_recv), \
1417 "byte_count", \
1418 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1419 NET_STATS_GET_VAR(dev_id, sfx, bytes_recv), \
1420 &(iface)->stats.bytes.received); \
1421 NET_STATS_PROMETHEUS_COUNTER_DEFINE( \
1422 "Bytes sent", \
1423 NET_STATS_GET_INSTANCE(dev_id, sfx, bytes_sent), \
1424 "byte_count", \
1425 NET_STATS_GET_COLLECTOR_NAME(dev_id, sfx), \
1426 NET_STATS_GET_VAR(dev_id, sfx, bytes_sent), \
1427 &(iface)->stats.bytes.sent); \
1428 NET_STATS_PROMETHEUS_IPV6(iface, dev_id, sfx); \
1429 NET_STATS_PROMETHEUS_IPV4(iface, dev_id, sfx); \
1430 NET_STATS_PROMETHEUS_ICMP(iface, dev_id, sfx); \
1431 NET_STATS_PROMETHEUS_UDP(iface, dev_id, sfx); \
1432 NET_STATS_PROMETHEUS_TCP(iface, dev_id, sfx); \
1433 NET_STATS_PROMETHEUS_IPV6_ND(iface, dev_id, sfx); \
1434 NET_STATS_PROMETHEUS_IPV6_PMTU(iface, dev_id, sfx); \
1435 NET_STATS_PROMETHEUS_IPV4_PMTU(iface, dev_id, sfx); \
1436 NET_STATS_PROMETHEUS_MLD(iface, dev_id, sfx); \
1437 NET_STATS_PROMETHEUS_IGMP(iface, dev_id, sfx); \
1438 NET_STATS_PROMETHEUS_DNS(iface, dev_id, sfx); \
1439 NET_STATS_PROMETHEUS_TX_TIME(iface, dev_id, sfx); \
1440 NET_STATS_PROMETHEUS_RX_TIME(iface, dev_id, sfx)
1441
1446#ifdef __cplusplus
1447}
1448#endif
1449
1450#endif /* ZEPHYR_INCLUDE_NET_NET_STATS_H_ */
Prometheus collector APIs.
Prometheus gauge APIs.
#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:45
Prometheus histogram APIs.
Prometheus metric interface.
Prometheus counter APIs.
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:50
net_stats_t sent
Number of bytes sent.
Definition net_stats.h:52
net_stats_t received
Number of bytes received.
Definition net_stats.h:54
DNS statistics.
Definition net_stats.h:267
net_stats_t drop
Number of dropped DNS packets.
Definition net_stats.h:275
net_stats_t recv
Number of received DNS queries.
Definition net_stats.h:269
net_stats_t sent
Number of sent DNS responses.
Definition net_stats.h:272
Ethernet checksum statistics.
Definition net_stats.h:554
net_stats_t rx_csum_offload_good
Number of good RX checksum offloading.
Definition net_stats.h:556
net_stats_t rx_csum_offload_errors
Number of failed RX checksum offloading.
Definition net_stats.h:559
Ethernet error statistics.
Definition net_stats.h:475
net_stats_t tx_carrier_errors
Number of TX carrier errors.
Definition net_stats.h:513
net_stats_t uncorr_ecc_errors
Number of uncorrected ECC errors.
Definition net_stats.h:528
net_stats_t rx_long_length_errors
Number of RX long length errors.
Definition net_stats.h:495
net_stats_t tx_window_errors
Number of TX window errors.
Definition net_stats.h:522
net_stats_t corr_ecc_errors
Number of corrected ECC errors.
Definition net_stats.h:531
net_stats_t rx_missed_errors
Number of RX missed errors.
Definition net_stats.h:492
net_stats_t rx_crc_errors
Number of RX CRC errors.
Definition net_stats.h:483
net_stats_t rx_short_length_errors
Number of RX short length errors.
Definition net_stats.h:498
net_stats_t rx_align_errors
Number of RX buffer align errors.
Definition net_stats.h:501
net_stats_t rx_dma_failed
Number of RX DMA failed errors.
Definition net_stats.h:504
net_stats_t rx_no_buffer_count
Number of RX net_pkt allocation errors.
Definition net_stats.h:489
net_stats_t tx_fifo_errors
Number of TX FIFO errors.
Definition net_stats.h:516
net_stats_t rx_frame_errors
Number of RX frame errors.
Definition net_stats.h:486
net_stats_t rx_over_errors
Number of RX overrun errors.
Definition net_stats.h:480
net_stats_t tx_dma_failed
Number of TX DMA failed errors.
Definition net_stats.h:525
net_stats_t rx_length_errors
Number of RX length errors.
Definition net_stats.h:477
net_stats_t rx_buf_alloc_failed
Number of RX net_buf allocation errors.
Definition net_stats.h:507
net_stats_t tx_heartbeat_errors
Number of TX heartbeat errors.
Definition net_stats.h:519
net_stats_t tx_aborted_errors
Number of TX aborted errors.
Definition net_stats.h:510
Ethernet flow control statistics.
Definition net_stats.h:537
net_stats_t rx_flow_control_xon
Number of RX XON flow control.
Definition net_stats.h:539
net_stats_t tx_flow_control_xon
Number of TX XON flow control.
Definition net_stats.h:545
net_stats_t rx_flow_control_xoff
Number of RX XOFF flow control.
Definition net_stats.h:542
net_stats_t tx_flow_control_xoff
Number of TX XOFF flow control.
Definition net_stats.h:548
Ethernet hardware timestamp statistics.
Definition net_stats.h:565
net_stats_t tx_hwtstamp_timeouts
Number of RX hardware timestamp timeout.
Definition net_stats.h:570
net_stats_t rx_hwtstamp_cleared
Number of RX hardware timestamp cleared.
Definition net_stats.h:567
net_stats_t tx_hwtstamp_skipped
Number of RX hardware timestamp skipped.
Definition net_stats.h:573
All Ethernet specific statistics.
Definition net_stats.h:589
struct net_stats_pkts broadcast
Total number of broadcast packets received and sent.
Definition net_stats.h:597
struct net_stats_eth_csum csum
Total number of checksum errors in RX and TX.
Definition net_stats.h:612
net_stats_t tx_dropped
Total number of dropped TX packets.
Definition net_stats.h:621
struct net_stats_eth_hw_timestamp hw_timestamp
Total number of hardware timestamp errors in RX and TX.
Definition net_stats.h:615
struct net_stats_pkts multicast
Total number of multicast packets received and sent.
Definition net_stats.h:600
struct net_stats_eth_flow flow_control
Total number of flow control errors in RX and TX.
Definition net_stats.h:609
net_stats_t tx_restart_queue
Total number of TX queue restarts.
Definition net_stats.h:627
net_stats_t collisions
Total number of collisions.
Definition net_stats.h:618
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:591
struct net_stats_eth_errors error_details
Total number of errors in RX and TX.
Definition net_stats.h:606
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:594
struct net_stats_pkts errors
Total number of errors in RX and TX.
Definition net_stats.h:603
net_stats_t tx_timeout_count
Total number of TX timeout errors.
Definition net_stats.h:624
net_stats_t unknown_protocol
Total number of RX unknown protocol packets.
Definition net_stats.h:630
ICMP statistics.
Definition net_stats.h:114
net_stats_t sent
Number of sent ICMP packets.
Definition net_stats.h:119
net_stats_t chkerr
Number of ICMP packets with a bad checksum.
Definition net_stats.h:128
net_stats_t drop
Number of dropped ICMP packets.
Definition net_stats.h:122
net_stats_t typeerr
Number of ICMP packets with a wrong type.
Definition net_stats.h:125
net_stats_t recv
Number of received ICMP packets.
Definition net_stats.h:116
IP layer error statistics.
Definition net_stats.h:87
net_stats_t hblenerr
Number of packets dropped due to wrong IP length, high byte.
Definition net_stats.h:94
net_stats_t vhlerr
Number of packets dropped due to wrong IP version or header length.
Definition net_stats.h:91
net_stats_t chkerr
Number of packets dropped due to IP checksum errors.
Definition net_stats.h:103
net_stats_t protoerr
Number of packets dropped because they were neither ICMP, UDP nor TCP.
Definition net_stats.h:108
net_stats_t lblenerr
Number of packets dropped due to wrong IP length, low byte.
Definition net_stats.h:97
net_stats_t fragerr
Number of packets dropped because they were IP fragments.
Definition net_stats.h:100
IP layer statistics.
Definition net_stats.h:70
net_stats_t forwarded
Number of forwarded packets at the IP layer.
Definition net_stats.h:78
net_stats_t recv
Number of received packets at the IP layer.
Definition net_stats.h:72
net_stats_t sent
Number of sent packets at the IP layer.
Definition net_stats.h:75
net_stats_t drop
Number of dropped packets at the IP layer.
Definition net_stats.h:81
IPv4 IGMP daemon statistics.
Definition net_stats.h:253
net_stats_t drop
Number of dropped IPv4 IGMP packets.
Definition net_stats.h:261
net_stats_t recv
Number of received IPv4 IGMP queries.
Definition net_stats.h:255
net_stats_t sent
Number of sent IPv4 IGMP reports.
Definition net_stats.h:258
IPv4 Path MTU Discovery statistics.
Definition net_stats.h:225
net_stats_t sent
Number of sent IPv4 PMTU packets.
Definition net_stats.h:233
net_stats_t recv
Number of received IPv4 PMTU packets.
Definition net_stats.h:230
net_stats_t drop
Number of dropped IPv4 PMTU packets.
Definition net_stats.h:227
IPv6 multicast listener daemon statistics.
Definition net_stats.h:239
net_stats_t recv
Number of received IPv6 MLD queries.
Definition net_stats.h:241
net_stats_t sent
Number of sent IPv6 MLD reports.
Definition net_stats.h:244
net_stats_t drop
Number of dropped IPv6 MLD packets.
Definition net_stats.h:247
IPv6 neighbor discovery statistics.
Definition net_stats.h:197
net_stats_t sent
Number of sent IPv6 neighbor discovery packets.
Definition net_stats.h:205
net_stats_t recv
Number of received IPv6 neighbor discovery packets.
Definition net_stats.h:202
net_stats_t drop
Number of dropped IPv6 neighbor discovery packets.
Definition net_stats.h:199
IPv6 Path MTU Discovery statistics.
Definition net_stats.h:211
net_stats_t recv
Number of received IPv6 PMTU packets.
Definition net_stats.h:216
net_stats_t drop
Number of dropped IPv6 PMTU packets.
Definition net_stats.h:213
net_stats_t sent
Number of sent IPv6 PMTU packets.
Definition net_stats.h:219
Number of network packets sent and received.
Definition net_stats.h:60
net_stats_t rx
Number of packets received.
Definition net_stats.h:64
net_stats_t tx
Number of packets sent.
Definition net_stats.h:62
Power management statistics.
Definition net_stats.h:359
uint32_t last_suspend_time
How long the last suspend took.
Definition net_stats.h:365
uint32_t start_time
Network interface last suspend start time.
Definition net_stats.h:367
uint64_t overall_suspend_time
Total suspend time.
Definition net_stats.h:361
net_stats_t suspend_count
How many times we were suspended.
Definition net_stats.h:363
All PPP specific statistics.
Definition net_stats.h:641
net_stats_t chkerr
Number of received PPP frames with a bad checksum.
Definition net_stats.h:652
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:646
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:643
net_stats_t drop
Number of received and dropped PPP frames.
Definition net_stats.h:649
Network packet receive times for calculating average RX time.
Definition net_stats.h:292
uint64_t sum
Sum of network packet receive times.
Definition net_stats.h:294
net_stats_t count
Number of network packets received.
Definition net_stats.h:297
All Wi-Fi management statistics.
Definition net_stats.h:658
net_stats_t beacons_miss
Number of missed beacons.
Definition net_stats.h:663
net_stats_t beacons_rx
Number of received beacons.
Definition net_stats.h:660
Traffic class statistics.
Definition net_stats.h:319
net_stats_t bytes
Number of bytes sent for this traffic class.
Definition net_stats.h:332
struct net_stats_tx_time tx_time
Helper for calculating average TX time statistics.
Definition net_stats.h:323
net_stats_t pkts
Number of packets sent for this traffic class.
Definition net_stats.h:330
uint8_t priority
Priority of this traffic class.
Definition net_stats.h:334
struct net_stats_tc::@406 sent[NET_TC_TX_STATS_COUNT]
TX statistics for each traffic class.
struct net_stats_tc::@407 recv[NET_TC_RX_STATS_COUNT]
RX statistics for each traffic class.
TCP statistics.
Definition net_stats.h:134
net_stats_t ackerr
Number of received TCP segments with a bad ACK number.
Definition net_stats.h:157
net_stats_t rsterr
Number of received bad TCP RST (reset) segments.
Definition net_stats.h:160
net_stats_t rexmit
Number of retransmitted TCP segments.
Definition net_stats.h:166
net_stats_t chkerr
Number of TCP segments with a bad checksum.
Definition net_stats.h:154
net_stats_t seg_drop
Number of dropped TCP segments.
Definition net_stats.h:151
net_stats_t connrst
Number of connection attempts for closed ports, triggering a RST.
Definition net_stats.h:174
net_stats_t drop
Number of dropped packets at the TCP layer.
Definition net_stats.h:142
net_stats_t rst
Number of received TCP RST (reset) segments.
Definition net_stats.h:163
net_stats_t sent
Number of sent TCP segments.
Definition net_stats.h:148
net_stats_t resent
Amount of retransmitted data.
Definition net_stats.h:139
net_stats_t conndrop
Number of dropped connection attempts because too few connections were available.
Definition net_stats.h:171
net_stats_t recv
Number of received TCP segments.
Definition net_stats.h:145
struct net_stats_bytes bytes
Amount of received and sent TCP application data.
Definition net_stats.h:136
Network packet transfer times for calculating average TX time.
Definition net_stats.h:281
net_stats_t count
Number of network packets transferred.
Definition net_stats.h:286
uint64_t sum
Sum of network packet transfer times.
Definition net_stats.h:283
UDP statistics.
Definition net_stats.h:180
net_stats_t recv
Number of received UDP segments.
Definition net_stats.h:185
net_stats_t drop
Number of dropped UDP segments.
Definition net_stats.h:182
net_stats_t chkerr
Number of UDP segments with a bad checksum.
Definition net_stats.h:191
net_stats_t sent
Number of sent UDP segments.
Definition net_stats.h:188
All Wi-Fi specific statistics.
Definition net_stats.h:669
struct net_stats_pkts broadcast
Total number of broadcast packets received and sent.
Definition net_stats.h:680
struct net_stats_pkts multicast
Total number of multicast packets received and sent.
Definition net_stats.h:683
struct net_stats_sta_mgmt sta_mgmt
Total number of beacon errors.
Definition net_stats.h:671
struct net_stats_bytes bytes
Total number of bytes received and sent.
Definition net_stats.h:674
net_stats_t overrun_count
Total number of dropped packets at received and sent.
Definition net_stats.h:692
struct net_stats_pkts pkts
Total number of packets received and sent.
Definition net_stats.h:677
struct net_stats_pkts errors
Total number of errors in RX and TX.
Definition net_stats.h:686
struct net_stats_pkts unicast
Total number of unicast packets received and sent.
Definition net_stats.h:689
All network statistics in one struct.
Definition net_stats.h:374
net_stats_t processing_error
Count of malformed packets or packets we do not have handler for.
Definition net_stats.h:376
struct net_stats_bytes bytes
This calculates amount of data transferred through all the network interfaces.
Definition net_stats.h:382
struct net_stats_ip_errors ip_errors
IP layer errors.
Definition net_stats.h:385
Prometheus summary APIs.