1 /** @file
2  * @brief Network statistics
3  *
4  * Network statistics data. This should only be enabled when
5  * debugging as it consumes memory.
6  */
7 
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 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /**
26  * @brief Network statistics library
27  * @defgroup net_stats Network Statistics Library
28  * @since 1.5
29  * @version 0.8.0
30  * @ingroup networking
31  * @{
32  */
33 
34 /**
35  * @typedef net_stats_t
36  * @brief Network statistics counter
37  */
38 typedef uint32_t net_stats_t;
39 
40 /**
41  * @brief Number of bytes sent and received.
42  */
43 struct net_stats_bytes {
44 	/** Number of bytes sent */
45 	net_stats_t sent;
46 	/** Number of bytes received */
47 	net_stats_t received;
48 };
49 
50 /**
51  * @brief Number of network packets sent and received.
52  */
53 struct net_stats_pkts {
54 	/** Number of packets sent */
55 	net_stats_t tx;
56 	/** Number of packets received */
57 	net_stats_t rx;
58 };
59 
60 /**
61  * @brief IP layer statistics
62  */
63 struct net_stats_ip {
64 	/** Number of received packets at the IP layer. */
65 	net_stats_t recv;
66 
67 	/** Number of sent packets at the IP layer. */
68 	net_stats_t sent;
69 
70 	/** Number of forwarded packets at the IP layer. */
71 	net_stats_t forwarded;
72 
73 	/** Number of dropped packets at the IP layer. */
74 	net_stats_t drop;
75 };
76 
77 /**
78  * @brief IP layer error statistics
79  */
80 struct net_stats_ip_errors {
81 	/** Number of packets dropped due to wrong IP version
82 	 * or header length.
83 	 */
84 	net_stats_t vhlerr;
85 
86 	 /** Number of packets dropped due to wrong IP length, high byte. */
87 	net_stats_t hblenerr;
88 
89 	/** Number of packets dropped due to wrong IP length, low byte. */
90 	net_stats_t lblenerr;
91 
92 	/** Number of packets dropped because they were IP fragments. */
93 	net_stats_t fragerr;
94 
95 	/** Number of packets dropped due to IP checksum errors. */
96 	net_stats_t chkerr;
97 
98 	/** Number of packets dropped because they were neither ICMP,
99 	 * UDP nor TCP.
100 	 */
101 	net_stats_t protoerr;
102 };
103 
104 /**
105  * @brief ICMP statistics
106  */
107 struct net_stats_icmp {
108 	/** Number of received ICMP packets. */
109 	net_stats_t recv;
110 
111 	/** Number of sent ICMP packets. */
112 	net_stats_t sent;
113 
114 	/** Number of dropped ICMP packets. */
115 	net_stats_t drop;
116 
117 	/** Number of ICMP packets with a wrong type. */
118 	net_stats_t typeerr;
119 
120 	/** Number of ICMP packets with a bad checksum. */
121 	net_stats_t chkerr;
122 };
123 
124 /**
125  * @brief TCP statistics
126  */
127 struct net_stats_tcp {
128 	/** Amount of received and sent TCP application data. */
129 	struct net_stats_bytes bytes;
130 
131 	/** Amount of retransmitted data. */
132 	net_stats_t resent;
133 
134 	/** Number of dropped packets at the TCP layer. */
135 	net_stats_t drop;
136 
137 	/** Number of received TCP segments. */
138 	net_stats_t recv;
139 
140 	/** Number of sent TCP segments. */
141 	net_stats_t sent;
142 
143 	/** Number of dropped TCP segments. */
144 	net_stats_t seg_drop;
145 
146 	/** Number of TCP segments with a bad checksum. */
147 	net_stats_t chkerr;
148 
149 	/** Number of received TCP segments with a bad ACK number. */
150 	net_stats_t ackerr;
151 
152 	/** Number of received bad TCP RST (reset) segments. */
153 	net_stats_t rsterr;
154 
155 	/** Number of received TCP RST (reset) segments. */
156 	net_stats_t rst;
157 
158 	/** Number of retransmitted TCP segments. */
159 	net_stats_t rexmit;
160 
161 	/** Number of dropped connection attempts because too few connections
162 	 * were available.
163 	 */
164 	net_stats_t conndrop;
165 
166 	/** Number of connection attempts for closed ports, triggering a RST. */
167 	net_stats_t connrst;
168 };
169 
170 /**
171  * @brief UDP statistics
172  */
173 struct net_stats_udp {
174 	/** Number of dropped UDP segments. */
175 	net_stats_t drop;
176 
177 	/** Number of received UDP segments. */
178 	net_stats_t recv;
179 
180 	/** Number of sent UDP segments. */
181 	net_stats_t sent;
182 
183 	/** Number of UDP segments with a bad checksum. */
184 	net_stats_t chkerr;
185 };
186 
187 /**
188  * @brief IPv6 neighbor discovery statistics
189  */
190 struct net_stats_ipv6_nd {
191 	/** Number of dropped IPv6 neighbor discovery packets. */
192 	net_stats_t drop;
193 
194 	/** Number of received IPv6 neighbor discovery packets. */
195 	net_stats_t recv;
196 
197 	/** Number of sent IPv6 neighbor discovery packets. */
198 	net_stats_t sent;
199 };
200 
201 /**
202  * @brief IPv6 multicast listener daemon statistics
203  */
204 struct net_stats_ipv6_mld {
205 	/** Number of received IPv6 MLD queries. */
206 	net_stats_t recv;
207 
208 	/** Number of sent IPv6 MLD reports. */
209 	net_stats_t sent;
210 
211 	/** Number of dropped IPv6 MLD packets. */
212 	net_stats_t drop;
213 };
214 
215 /**
216  * @brief IPv4 IGMP daemon statistics
217  */
218 struct net_stats_ipv4_igmp {
219 	/** Number of received IPv4 IGMP queries */
220 	net_stats_t recv;
221 
222 	/** Number of sent IPv4 IGMP reports */
223 	net_stats_t sent;
224 
225 	/** Number of dropped IPv4 IGMP packets */
226 	net_stats_t drop;
227 };
228 
229 /**
230  * @brief Network packet transfer times for calculating average TX time
231  */
232 struct net_stats_tx_time {
233 	/** Sum of network packet transfer times. */
234 	uint64_t sum;
235 
236 	/** Number of network packets transferred. */
237 	net_stats_t count;
238 };
239 
240 /**
241  * @brief Network packet receive times for calculating average RX time
242  */
243 struct net_stats_rx_time {
244 	/** Sum of network packet receive times. */
245 	uint64_t sum;
246 
247 	/** Number of network packets received. */
248 	net_stats_t count;
249 };
250 
251 /** @cond INTERNAL_HIDDEN */
252 
253 #if NET_TC_TX_COUNT == 0
254 #define NET_TC_TX_STATS_COUNT 1
255 #else
256 #define NET_TC_TX_STATS_COUNT NET_TC_TX_COUNT
257 #endif
258 
259 #if NET_TC_RX_COUNT == 0
260 #define NET_TC_RX_STATS_COUNT 1
261 #else
262 #define NET_TC_RX_STATS_COUNT NET_TC_RX_COUNT
263 #endif
264 
265 /** @endcond */
266 
267 /**
268  * @brief Traffic class statistics
269  */
270 struct net_stats_tc {
271 	/** TX statistics for each traffic class */
272 	struct {
273 		/** Helper for calculating average TX time statistics */
274 		struct net_stats_tx_time tx_time;
275 #if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
276 		/** Detailed TX time statistics inside network stack */
277 		struct net_stats_tx_time
278 				tx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
279 #endif
280 		/** Number of packets sent for this traffic class */
281 		net_stats_t pkts;
282 		/** Number of bytes sent for this traffic class */
283 		net_stats_t bytes;
284 		/** Priority of this traffic class */
285 		uint8_t priority;
286 	} sent[NET_TC_TX_STATS_COUNT];
287 
288 	/** RX statistics for each traffic class */
289 	struct {
290 		/** Helper for calculating average RX time statistics */
291 		struct net_stats_rx_time rx_time;
292 #if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
293 		/** Detailed RX time statistics inside network stack */
294 		struct net_stats_rx_time
295 				rx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
296 #endif
297 		/** Number of packets received for this traffic class */
298 		net_stats_t pkts;
299 		/** Number of bytes received for this traffic class */
300 		net_stats_t bytes;
301 		/** Priority of this traffic class */
302 		uint8_t priority;
303 	} recv[NET_TC_RX_STATS_COUNT];
304 };
305 
306 
307 /**
308  * @brief Power management statistics
309  */
310 struct net_stats_pm {
311 	/** Total suspend time */
312 	uint64_t overall_suspend_time;
313 	/** How many times we were suspended */
314 	net_stats_t suspend_count;
315 	/** How long the last suspend took */
316 	uint32_t last_suspend_time;
317 	/** Network interface last suspend start time */
318 	uint32_t start_time;
319 };
320 
321 
322 /**
323  * @brief All network statistics in one struct.
324  */
325 struct net_stats {
326 	/** Count of malformed packets or packets we do not have handler for */
327 	net_stats_t processing_error;
328 
329 	/**
330 	 * This calculates amount of data transferred through all the
331 	 * network interfaces.
332 	 */
333 	struct net_stats_bytes bytes;
334 
335 	/** IP layer errors */
336 	struct net_stats_ip_errors ip_errors;
337 
338 #if defined(CONFIG_NET_STATISTICS_IPV6)
339 	/** IPv6 statistics */
340 	struct net_stats_ip ipv6;
341 #endif
342 
343 #if defined(CONFIG_NET_STATISTICS_IPV4)
344 	/** IPv4 statistics */
345 	struct net_stats_ip ipv4;
346 #endif
347 
348 #if defined(CONFIG_NET_STATISTICS_ICMP)
349 	/** ICMP statistics */
350 	struct net_stats_icmp icmp;
351 #endif
352 
353 #if defined(CONFIG_NET_STATISTICS_TCP)
354 	/** TCP statistics */
355 	struct net_stats_tcp tcp;
356 #endif
357 
358 #if defined(CONFIG_NET_STATISTICS_UDP)
359 	/** UDP statistics */
360 	struct net_stats_udp udp;
361 #endif
362 
363 #if defined(CONFIG_NET_STATISTICS_IPV6_ND)
364 	/** IPv6 neighbor discovery statistics */
365 	struct net_stats_ipv6_nd ipv6_nd;
366 #endif
367 
368 #if defined(CONFIG_NET_STATISTICS_MLD)
369 	/** IPv6 MLD statistics */
370 	struct net_stats_ipv6_mld ipv6_mld;
371 #endif
372 
373 #if defined(CONFIG_NET_STATISTICS_IGMP)
374 	/** IPv4 IGMP statistics */
375 	struct net_stats_ipv4_igmp ipv4_igmp;
376 #endif
377 
378 #if NET_TC_COUNT > 1
379 	/** Traffic class statistics */
380 	struct net_stats_tc tc;
381 #endif
382 
383 #if defined(CONFIG_NET_PKT_TXTIME_STATS)
384 	/** Network packet TX time statistics */
385 	struct net_stats_tx_time tx_time;
386 #endif
387 
388 #if defined(CONFIG_NET_PKT_RXTIME_STATS)
389 	/** Network packet RX time statistics */
390 	struct net_stats_rx_time rx_time;
391 #endif
392 
393 #if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL)
394 	/** Network packet TX time detail statistics */
395 	struct net_stats_tx_time tx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
396 #endif
397 #if defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
398 	/** Network packet RX time detail statistics */
399 	struct net_stats_rx_time rx_time_detail[NET_PKT_DETAIL_STATS_COUNT];
400 #endif
401 
402 #if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
403 	/** Power management statistics */
404 	struct net_stats_pm pm;
405 #endif
406 };
407 
408 /**
409  * @brief Ethernet error statistics
410  */
411 struct net_stats_eth_errors {
412 	/** Number of RX length errors */
413 	net_stats_t rx_length_errors;
414 
415 	/** Number of RX overrun errors */
416 	net_stats_t rx_over_errors;
417 
418 	/** Number of RX CRC errors */
419 	net_stats_t rx_crc_errors;
420 
421 	/** Number of RX frame errors */
422 	net_stats_t rx_frame_errors;
423 
424 	/** Number of RX net_pkt allocation errors */
425 	net_stats_t rx_no_buffer_count;
426 
427 	/** Number of RX missed errors */
428 	net_stats_t rx_missed_errors;
429 
430 	/** Number of RX long length errors */
431 	net_stats_t rx_long_length_errors;
432 
433 	/** Number of RX short length errors */
434 	net_stats_t rx_short_length_errors;
435 
436 	/** Number of RX buffer align errors */
437 	net_stats_t rx_align_errors;
438 
439 	/** Number of RX DMA failed errors */
440 	net_stats_t rx_dma_failed;
441 
442 	/** Number of RX net_buf allocation errors */
443 	net_stats_t rx_buf_alloc_failed;
444 
445 	/** Number of TX aborted errors */
446 	net_stats_t tx_aborted_errors;
447 
448 	/** Number of TX carrier errors */
449 	net_stats_t tx_carrier_errors;
450 
451 	/** Number of TX FIFO errors */
452 	net_stats_t tx_fifo_errors;
453 
454 	/** Number of TX heartbeat errors */
455 	net_stats_t tx_heartbeat_errors;
456 
457 	/** Number of TX window errors */
458 	net_stats_t tx_window_errors;
459 
460 	/** Number of TX DMA failed errors */
461 	net_stats_t tx_dma_failed;
462 
463 	/** Number of uncorrected ECC errors */
464 	net_stats_t uncorr_ecc_errors;
465 
466 	/** Number of corrected ECC errors */
467 	net_stats_t corr_ecc_errors;
468 };
469 
470 /**
471  * @brief Ethernet flow control statistics
472  */
473 struct net_stats_eth_flow {
474 	/** Number of RX XON flow control */
475 	net_stats_t rx_flow_control_xon;
476 
477 	/** Number of RX XOFF flow control */
478 	net_stats_t rx_flow_control_xoff;
479 
480 	/** Number of TX XON flow control */
481 	net_stats_t tx_flow_control_xon;
482 
483 	/** Number of TX XOFF flow control */
484 	net_stats_t tx_flow_control_xoff;
485 };
486 
487 /**
488  * @brief Ethernet checksum statistics
489  */
490 struct net_stats_eth_csum {
491 	/** Number of good RX checksum offloading */
492 	net_stats_t rx_csum_offload_good;
493 
494 	/** Number of failed RX checksum offloading */
495 	net_stats_t rx_csum_offload_errors;
496 };
497 
498 /**
499  * @brief Ethernet hardware timestamp statistics
500  */
501 struct net_stats_eth_hw_timestamp {
502 	/** Number of RX hardware timestamp cleared */
503 	net_stats_t rx_hwtstamp_cleared;
504 
505 	/** Number of RX hardware timestamp timeout */
506 	net_stats_t tx_hwtstamp_timeouts;
507 
508 	/** Number of RX hardware timestamp skipped */
509 	net_stats_t tx_hwtstamp_skipped;
510 };
511 
512 #ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR
513 /**
514  * @brief Ethernet vendor specific statistics
515  */
516 struct net_stats_eth_vendor {
517 	const char * const key; /**< Key name of vendor statistics */
518 	uint32_t value;         /**< Value of the statistics key */
519 };
520 #endif
521 
522 /**
523  * @brief All Ethernet specific statistics
524  */
525 struct net_stats_eth {
526 	/** Total number of bytes received and sent */
527 	struct net_stats_bytes bytes;
528 
529 	/** Total number of packets received and sent */
530 	struct net_stats_pkts pkts;
531 
532 	/** Total number of broadcast packets received and sent */
533 	struct net_stats_pkts broadcast;
534 
535 	/** Total number of multicast packets received and sent */
536 	struct net_stats_pkts multicast;
537 
538 	/** Total number of errors in RX and TX */
539 	struct net_stats_pkts errors;
540 
541 	/** Total number of errors in RX and TX */
542 	struct net_stats_eth_errors error_details;
543 
544 	/** Total number of flow control errors in RX and TX */
545 	struct net_stats_eth_flow flow_control;
546 
547 	/** Total number of checksum errors in RX and TX */
548 	struct net_stats_eth_csum csum;
549 
550 	/** Total number of hardware timestamp errors in RX and TX */
551 	struct net_stats_eth_hw_timestamp hw_timestamp;
552 
553 	/** Total number of collisions */
554 	net_stats_t collisions;
555 
556 	/** Total number of dropped TX packets */
557 	net_stats_t tx_dropped;
558 
559 	/** Total number of TX timeout errors */
560 	net_stats_t tx_timeout_count;
561 
562 	/** Total number of TX queue restarts */
563 	net_stats_t tx_restart_queue;
564 
565 	/** Total number of RX unknown protocol packets */
566 	net_stats_t unknown_protocol;
567 
568 #ifdef CONFIG_NET_STATISTICS_ETHERNET_VENDOR
569 	/** Array is terminated with an entry containing a NULL key */
570 	struct net_stats_eth_vendor *vendor;
571 #endif
572 };
573 
574 /**
575  * @brief All PPP specific statistics
576  */
577 struct net_stats_ppp {
578 	/** Total number of bytes received and sent */
579 	struct net_stats_bytes bytes;
580 
581 	/** Total number of packets received and sent */
582 	struct net_stats_pkts pkts;
583 
584 	/** Number of received and dropped PPP frames. */
585 	net_stats_t drop;
586 
587 	/** Number of received PPP frames with a bad checksum. */
588 	net_stats_t chkerr;
589 };
590 
591 /**
592  * @brief All Wi-Fi management statistics
593  */
594 struct net_stats_sta_mgmt {
595 	/** Number of received beacons */
596 	net_stats_t beacons_rx;
597 
598 	/** Number of missed beacons */
599 	net_stats_t beacons_miss;
600 };
601 
602 /**
603  * @brief All Wi-Fi specific statistics
604  */
605 struct net_stats_wifi {
606 	/** Total number of beacon errors */
607 	struct net_stats_sta_mgmt sta_mgmt;
608 
609 	/** Total number of bytes received and sent */
610 	struct net_stats_bytes bytes;
611 
612 	/** Total number of packets received and sent */
613 	struct net_stats_pkts pkts;
614 
615 	/** Total number of broadcast packets received and sent */
616 	struct net_stats_pkts broadcast;
617 
618 	/** Total number of multicast packets received and sent */
619 	struct net_stats_pkts multicast;
620 
621 	/** Total number of errors in RX and TX */
622 	struct net_stats_pkts errors;
623 
624 	/** Total number of unicast packets received and sent */
625 	struct net_stats_pkts unicast;
626 };
627 
628 #if defined(CONFIG_NET_STATISTICS_USER_API)
629 /* Management part definitions */
630 
631 /** @cond INTERNAL_HIDDEN */
632 
633 #define _NET_STATS_LAYER	NET_MGMT_LAYER_L3
634 #define _NET_STATS_CODE		0x101
635 #define _NET_STATS_BASE		(NET_MGMT_LAYER(_NET_STATS_LAYER) |	\
636 				 NET_MGMT_LAYER_CODE(_NET_STATS_CODE))
637 
638 enum net_request_stats_cmd {
639 	NET_REQUEST_STATS_CMD_GET_ALL = 1,
640 	NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR,
641 	NET_REQUEST_STATS_CMD_GET_BYTES,
642 	NET_REQUEST_STATS_CMD_GET_IP_ERRORS,
643 	NET_REQUEST_STATS_CMD_GET_IPV4,
644 	NET_REQUEST_STATS_CMD_GET_IPV6,
645 	NET_REQUEST_STATS_CMD_GET_IPV6_ND,
646 	NET_REQUEST_STATS_CMD_GET_ICMP,
647 	NET_REQUEST_STATS_CMD_GET_UDP,
648 	NET_REQUEST_STATS_CMD_GET_TCP,
649 	NET_REQUEST_STATS_CMD_GET_ETHERNET,
650 	NET_REQUEST_STATS_CMD_GET_PPP,
651 	NET_REQUEST_STATS_CMD_GET_PM,
652 	NET_REQUEST_STATS_CMD_GET_WIFI,
653 };
654 
655 /** @endcond */
656 
657 /** Request all network statistics */
658 #define NET_REQUEST_STATS_GET_ALL				\
659 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ALL)
660 
661 /** Request all processing error statistics */
662 #define NET_REQUEST_STATS_GET_PROCESSING_ERROR				\
663 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PROCESSING_ERROR)
664 
665 /** Request number of received and sent bytes */
666 #define NET_REQUEST_STATS_GET_BYTES				\
667 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_BYTES)
668 
669 /** Request IP error statistics */
670 #define NET_REQUEST_STATS_GET_IP_ERRORS				\
671 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IP_ERRORS)
672 
673 /** @cond INTERNAL_HIDDEN */
674 
675 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ALL);
676 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_PROCESSING_ERROR);
677 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_BYTES);
678 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IP_ERRORS);
679 
680 /** @endcond */
681 
682 #if defined(CONFIG_NET_STATISTICS_IPV4)
683 /** Request IPv4 statistics */
684 #define NET_REQUEST_STATS_GET_IPV4				\
685 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV4)
686 
687 /** @cond INTERNAL_HIDDEN */
688 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV4);
689 /** @endcond */
690 #endif /* CONFIG_NET_STATISTICS_IPV4 */
691 
692 #if defined(CONFIG_NET_STATISTICS_IPV6)
693 /** Request IPv6 statistics */
694 #define NET_REQUEST_STATS_GET_IPV6				\
695 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6)
696 
697 /** @cond INTERNAL_HIDDEN */
698 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6);
699 /** @endcond */
700 #endif /* CONFIG_NET_STATISTICS_IPV6 */
701 
702 #if defined(CONFIG_NET_STATISTICS_IPV6_ND)
703 /** Request IPv6 neighbor discovery statistics */
704 #define NET_REQUEST_STATS_GET_IPV6_ND				\
705 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_IPV6_ND)
706 
707 /** @cond INTERNAL_HIDDEN */
708 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_IPV6_ND);
709 /** @endcond */
710 #endif /* CONFIG_NET_STATISTICS_IPV6_ND */
711 
712 #if defined(CONFIG_NET_STATISTICS_ICMP)
713 /** Request ICMPv4 and ICMPv6 statistics */
714 #define NET_REQUEST_STATS_GET_ICMP				\
715 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ICMP)
716 
717 /** @cond INTERNAL_HIDDEN */
718 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ICMP);
719 /** @endcond */
720 #endif /* CONFIG_NET_STATISTICS_ICMP */
721 
722 #if defined(CONFIG_NET_STATISTICS_UDP)
723 /** Request UDP statistics */
724 #define NET_REQUEST_STATS_GET_UDP				\
725 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_UDP)
726 
727 /** @cond INTERNAL_HIDDEN */
728 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_UDP);
729 /** @endcond */
730 #endif /* CONFIG_NET_STATISTICS_UDP */
731 
732 #if defined(CONFIG_NET_STATISTICS_TCP)
733 /** Request TCP statistics */
734 #define NET_REQUEST_STATS_GET_TCP				\
735 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_TCP)
736 
737 /** @cond INTERNAL_HIDDEN */
738 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_TCP);
739 /** @endcond */
740 #endif /* CONFIG_NET_STATISTICS_TCP */
741 
742 #if defined(CONFIG_NET_STATISTICS_ETHERNET)
743 /** Request Ethernet statistics */
744 #define NET_REQUEST_STATS_GET_ETHERNET				\
745 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_ETHERNET)
746 
747 /** @cond INTERNAL_HIDDEN */
748 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ETHERNET);
749 /** @endcond */
750 #endif /* CONFIG_NET_STATISTICS_ETHERNET */
751 
752 #if defined(CONFIG_NET_STATISTICS_PPP)
753 /** Request PPP statistics */
754 #define NET_REQUEST_STATS_GET_PPP				\
755 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PPP)
756 
757 /** @cond INTERNAL_HIDDEN */
758 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_PPP);
759 /** @endcond */
760 #endif /* CONFIG_NET_STATISTICS_PPP */
761 
762 #endif /* CONFIG_NET_STATISTICS_USER_API */
763 
764 #if defined(CONFIG_NET_STATISTICS_POWER_MANAGEMENT)
765 /** Request network power management statistics */
766 #define NET_REQUEST_STATS_GET_PM				\
767 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PM)
768 
769 /** @cond INTERNAL_HIDDEN */
770 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_PM);
771 /** @endcond */
772 #endif /* CONFIG_NET_STATISTICS_POWER_MANAGEMENT */
773 
774 #if defined(CONFIG_NET_STATISTICS_WIFI)
775 /** Request Wi-Fi statistics */
776 #define NET_REQUEST_STATS_GET_WIFI				\
777 	(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_WIFI)
778 
779 /** @cond INTERNAL_HIDDEN */
780 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI);
781 /** @endcond */
782 #endif /* CONFIG_NET_STATISTICS_WIFI */
783 
784 /**
785  * @}
786  */
787 
788 #ifdef __cplusplus
789 }
790 #endif
791 
792 #endif /* ZEPHYR_INCLUDE_NET_NET_STATS_H_ */
793