net: statistics: Provide specific Kconfig options
This will help to track only what's wanted (ipv6, tpc, udp, else...) if needed to. Change-Id: I5c2e5e582db629b5d0e1cd98004f693c50f532a4 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
06e2b421af
commit
cbd1609bf6
|
@ -193,29 +193,31 @@ struct net_stats {
|
|||
|
||||
struct net_stats_ip_errors ip_errors;
|
||||
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV6)
|
||||
struct net_stats_ip ipv6;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_IPV4)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV4)
|
||||
struct net_stats_ip ipv4;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS_ICMP)
|
||||
struct net_stats_icmp icmp;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_TCP)
|
||||
#if defined(CONFIG_NET_STATISTICS_TCP)
|
||||
struct net_stats_tcp tcp;
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_NET_UDP)
|
||||
#if defined(CONFIG_NET_STATISTICS_UDP)
|
||||
struct net_stats_udp udp;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_IPV6_ND)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
|
||||
struct net_stats_ipv6_nd ipv6_nd;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_RPL_STATS)
|
||||
#if defined(CONFIG_NET_STATISTICS_RPL)
|
||||
struct {
|
||||
uint16_t mem_overflows;
|
||||
uint16_t local_repairs;
|
||||
|
@ -233,7 +235,7 @@ struct net_stats {
|
|||
struct net_stats_rpl_dao dao;
|
||||
struct net_stats_rpl_dao_ack dao_ack;
|
||||
} rpl;
|
||||
#endif /* CONFIG_NET_RPL_STATS */
|
||||
#endif /* CONFIG_NET_STATISTICS_RPL */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -28,6 +28,7 @@ CONFIG_NET_DEBUG_IF=n
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_L2_IEEE802154=y
|
||||
CONFIG_NET_DEBUG_L2_IEEE802154=y
|
||||
|
|
|
@ -30,6 +30,7 @@ CONFIG_NET_DEBUG_IF=n
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_L2_IEEE802154=y
|
||||
CONFIG_NET_DEBUG_L2_IEEE802154=y
|
||||
|
|
|
@ -28,6 +28,7 @@ CONFIG_NET_DEBUG_IF=n
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_L2_IEEE802154=y
|
||||
CONFIG_NET_DEBUG_L2_IEEE802154=y
|
||||
|
|
|
@ -29,6 +29,7 @@ CONFIG_NET_DEBUG_IF=y
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_6LO=y
|
||||
CONFIG_NET_DEBUG_6LO=n
|
||||
|
|
|
@ -28,6 +28,7 @@ CONFIG_NET_DEBUG_IF=n
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_L2_IEEE802154=y
|
||||
CONFIG_NET_DEBUG_L2_IEEE802154=y
|
||||
|
|
|
@ -32,6 +32,7 @@ CONFIG_NET_DEBUG_IF=n
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_L2_IEEE802154=y
|
||||
CONFIG_NET_DEBUG_L2_IEEE802154=y
|
||||
|
|
|
@ -28,6 +28,7 @@ CONFIG_NET_DEBUG_IF=n
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_L2_IEEE802154=y
|
||||
CONFIG_NET_DEBUG_L2_IEEE802154=y
|
||||
|
|
|
@ -29,6 +29,7 @@ CONFIG_NET_DEBUG_IF=y
|
|||
CONFIG_NET_DEBUG_ICMPV6=y
|
||||
CONFIG_NET_DEBUG_CONN=n
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS_PERIODIC_OUTPUT=y
|
||||
|
||||
CONFIG_NET_6LO=y
|
||||
CONFIG_NET_DEBUG_6LO=n
|
||||
|
|
|
@ -260,6 +260,8 @@ source "subsys/net/ip/Kconfig.mgmt"
|
|||
|
||||
source "subsys/net/ip/Kconfig.rpl"
|
||||
|
||||
source "subsys/net/ip/Kconfig.stats"
|
||||
|
||||
source "subsys/net/ip/Kconfig.samples"
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -78,11 +78,4 @@ config NET_DEBUG_ROUTE
|
|||
help
|
||||
Enables routing engine debug messages
|
||||
|
||||
config NET_STATISTICS
|
||||
bool "Print network statistics"
|
||||
default n
|
||||
help
|
||||
Print network send/receive statistics to console.
|
||||
This takes memory so say 'n' if unsure.
|
||||
|
||||
endif # NET_LOG
|
||||
|
|
|
@ -240,12 +240,4 @@ config NET_DEBUG_RPL
|
|||
help
|
||||
Enables RPL output debug messages
|
||||
|
||||
config NET_RPL_STATS
|
||||
bool "Enable RPL statistics"
|
||||
depends on NET_RPL && NET_LOG
|
||||
select NET_STATISTICS
|
||||
default n
|
||||
help
|
||||
Enable RPL statistics support.
|
||||
|
||||
endif # NET_RPL
|
||||
|
|
85
subsys/net/ip/Kconfig.stats
Normal file
85
subsys/net/ip/Kconfig.stats
Normal file
|
@ -0,0 +1,85 @@
|
|||
# Kconfig.stats - Statistics Options
|
||||
|
||||
#
|
||||
# Copyright (c) 2016 Intel Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
menuconfig NET_STATISTICS
|
||||
bool "Network statistics"
|
||||
default n
|
||||
help
|
||||
Manage statistics accounting. This takes memory so say 'n' if unsure.
|
||||
|
||||
if NET_STATISTICS
|
||||
|
||||
config NET_STATISTICS_PERIODIC_OUTPUT
|
||||
bool "Simple periodic output"
|
||||
depends on NET_LOG
|
||||
default n
|
||||
help
|
||||
Print out all the statistics periodically through logging.
|
||||
This is meant for testing mostly.
|
||||
|
||||
config NET_STATISTICS_IPV4
|
||||
bool "IPv4 statistics"
|
||||
depends on NET_IPV4
|
||||
default y
|
||||
help
|
||||
Keep track of IPv4 related statistics
|
||||
|
||||
config NET_STATISTICS_IPV6
|
||||
bool "IPv6 statistics"
|
||||
depends on NET_IPV6
|
||||
default y
|
||||
help
|
||||
Keep track of IPv6 related statistics
|
||||
|
||||
config NET_STATISTICS_IPV6_ND
|
||||
bool "IPv6 statistics"
|
||||
depends on NET_IPV6_ND
|
||||
default y
|
||||
help
|
||||
Keep track of IPv6 Neighbor Discovery related statistics
|
||||
|
||||
config NET_STATISTICS_ICMP
|
||||
bool "ICMP statistics"
|
||||
depends on NET_IPV6 || NET_IPV4
|
||||
default y
|
||||
help
|
||||
Keep track of ICMPv4/6 related statistics, depending whether IPv4
|
||||
and/or IPv6 is/are enabled.
|
||||
|
||||
config NET_STATISTICS_UDP
|
||||
bool "UDP statistics"
|
||||
depends on NET_UDP
|
||||
default y
|
||||
help
|
||||
Keep track of UDP related statistics
|
||||
|
||||
config NET_STATISTICS_TCP
|
||||
bool "TCP statistics"
|
||||
depends on NET_TCP
|
||||
default n
|
||||
help
|
||||
Keep track of TCP related statistics
|
||||
|
||||
config NET_STATISTICS_RPL
|
||||
bool "RPL statistics"
|
||||
depends on NET_RPL
|
||||
default n
|
||||
help
|
||||
Keep track of RPL related statistics
|
||||
|
||||
endif # NET_STATISTICS
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
struct net_stats net_stats;
|
||||
|
||||
#ifdef CONFIG_NET_STATISTICS_PERIODIC_OUTPUT
|
||||
|
||||
#define PRINT_STATISTICS_INTERVAL (30 * MSEC_PER_SEC)
|
||||
|
||||
void net_print_statistics(void)
|
||||
|
@ -37,27 +39,27 @@ void net_print_statistics(void)
|
|||
(!((curr - next_print) > PRINT_STATISTICS_INTERVAL)))) {
|
||||
int64_t new_print;
|
||||
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV6)
|
||||
NET_INFO("IPv6 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d",
|
||||
GET_STAT(ipv6.recv),
|
||||
GET_STAT(ipv6.sent),
|
||||
GET_STAT(ipv6.drop),
|
||||
GET_STAT(ipv6.forwarded));
|
||||
#if defined(CONFIG_NET_IPV6_ND)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
|
||||
NET_INFO("IPv6 ND recv %d\tsent\t%d\tdrop\t%d",
|
||||
GET_STAT(ipv6_nd.recv),
|
||||
GET_STAT(ipv6_nd.sent),
|
||||
GET_STAT(ipv6_nd.drop));
|
||||
#endif /* CONFIG_NET_IPV6_ND */
|
||||
#endif /* CONFIG_NET_IPV6 */
|
||||
#endif /* CONFIG_NET_STATISTICS_IPV6_ND */
|
||||
#endif /* CONFIG_NET_STATISTICS_IPV6 */
|
||||
|
||||
#if defined(CONFIG_NET_IPV4)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV4)
|
||||
NET_INFO("IPv4 recv %d\tsent\t%d\tdrop\t%d\tforwarded\t%d",
|
||||
GET_STAT(ipv4.recv),
|
||||
GET_STAT(ipv4.sent),
|
||||
GET_STAT(ipv4.drop),
|
||||
GET_STAT(ipv4.forwarded));
|
||||
#endif /* CONFIG_NET_IPV4 */
|
||||
#endif /* CONFIG_NET_STATISTICS_IPV4 */
|
||||
|
||||
NET_INFO("IP vhlerr %d\thblener\t%d\tlblener\t%d",
|
||||
GET_STAT(ip_errors.vhlerr),
|
||||
|
@ -76,7 +78,7 @@ void net_print_statistics(void)
|
|||
GET_STAT(icmp.typeerr),
|
||||
GET_STAT(icmp.chkerr));
|
||||
|
||||
#if defined(CONFIG_NET_UDP)
|
||||
#if defined(CONFIG_NET_STATISTICS_UDP)
|
||||
NET_INFO("UDP recv %d\tsent\t%d\tdrop\t%d",
|
||||
GET_STAT(udp.recv),
|
||||
GET_STAT(udp.sent),
|
||||
|
@ -85,7 +87,7 @@ void net_print_statistics(void)
|
|||
GET_STAT(udp.chkerr));
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_RPL_STATS)
|
||||
#if defined(CONFIG_NET_STATISTICS_RPL_STATS)
|
||||
NET_INFO("RPL DIS recv %d\tsent\t%d\tdrop\t%d",
|
||||
GET_STAT(rpl.dis.recv),
|
||||
GET_STAT(rpl.dis.sent),
|
||||
|
@ -131,3 +133,5 @@ void net_print_statistics(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET_STATISTICS_PERIODIC_OUTPUT */
|
||||
|
|
|
@ -47,7 +47,7 @@ static inline void net_stats_update_ip_errors_vhlerr(void)
|
|||
#define net_stats_update_ip_errors_vhlerr()
|
||||
#endif /* CONFIG_NET_STATISTICS */
|
||||
|
||||
#if defined(CONFIG_NET_IPV6) && defined(CONFIG_NET_STATISTICS)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV6)
|
||||
/* IPv6 stats */
|
||||
|
||||
static inline void net_stats_update_ipv6_sent(void)
|
||||
|
@ -68,9 +68,9 @@ static inline void net_stats_update_ipv6_drop(void)
|
|||
#define net_stats_update_ipv6_drop()
|
||||
#define net_stats_update_ipv6_sent()
|
||||
#define net_stats_update_ipv6_recv()
|
||||
#endif /* CONFIG_NET_IPV6 */
|
||||
#endif /* CONFIG_NET_STATISTICS_IPV6 */
|
||||
|
||||
#if defined(CONFIG_NET_IPV6_ND) && defined(CONFIG_NET_STATISTICS)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV6_ND)
|
||||
/* IPv6 Neighbor Discovery stats*/
|
||||
|
||||
static inline void net_stats_update_ipv6_nd_sent(void)
|
||||
|
@ -91,9 +91,9 @@ static inline void net_stats_update_ipv6_nd_drop(void)
|
|||
#define net_stats_update_ipv6_nd_sent()
|
||||
#define net_stats_update_ipv6_nd_recv()
|
||||
#define net_stats_update_ipv6_nd_drop()
|
||||
#endif /* CONFIG_NET_IPV6_ND */
|
||||
#endif /* CONFIG_NET_STATISTICS_IPV6_ND */
|
||||
|
||||
#if defined(CONFIG_NET_IPV4) && defined(CONFIG_NET_STATISTICS)
|
||||
#if defined(CONFIG_NET_STATISTICS_IPV4)
|
||||
/* IPv4 stats */
|
||||
|
||||
static inline void net_stats_update_ipv4_drop(void)
|
||||
|
@ -114,9 +114,9 @@ static inline void net_stats_update_ipv4_recv(void)
|
|||
#define net_stats_update_ipv4_drop()
|
||||
#define net_stats_update_ipv4_sent()
|
||||
#define net_stats_update_ipv4_recv()
|
||||
#endif /* CONFIG_NET_IPV4 */
|
||||
#endif /* CONFIG_NET_STATISTICS_IPV4 */
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS)
|
||||
#if defined(CONFIG_NET_STATISTICS_ICMP)
|
||||
/* Common ICMPv4/ICMPv6 stats */
|
||||
static inline void net_stats_update_icmp_sent(void)
|
||||
{
|
||||
|
@ -136,9 +136,9 @@ static inline void net_stats_update_icmp_drop(void)
|
|||
#define net_stats_update_icmp_sent()
|
||||
#define net_stats_update_icmp_recv()
|
||||
#define net_stats_update_icmp_drop()
|
||||
#endif
|
||||
#endif /* CONFIG_NET_STATISTICS_ICMP */
|
||||
|
||||
#if defined(CONFIG_NET_UDP) && defined(CONFIG_NET_STATISTICS)
|
||||
#if defined(CONFIG_NET_STATISTICS_UDP)
|
||||
/* UDP stats */
|
||||
static inline void net_stats_update_udp_sent(void)
|
||||
{
|
||||
|
@ -158,9 +158,9 @@ static inline void net_stats_update_udp_drop(void)
|
|||
#define net_stats_update_udp_sent()
|
||||
#define net_stats_update_udp_recv()
|
||||
#define net_stats_update_udp_drop()
|
||||
#endif /* CONFIG_NET_UDP */
|
||||
#endif /* CONFIG_NET_STATISTICS_UDP */
|
||||
|
||||
#if defined(CONFIG_NET_RPL_STATS)
|
||||
#if defined(CONFIG_NET_STATISTICS_RPL)
|
||||
/* RPL stats */
|
||||
static inline void net_stats_update_rpl_resets(void)
|
||||
{
|
||||
|
@ -258,17 +258,13 @@ static inline void net_stats_update_rpl_dao_ack_recv(void)
|
|||
#define net_stats_update_rpl_dao_forwarded()
|
||||
#define net_stats_update_rpl_dao_ack_sent()
|
||||
#define net_stats_update_rpl_dao_ack_recv()
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS)
|
||||
#endif /* CONFIG_NET_STATISTICS_RPL */
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS_PERIODIC_OUTPUT)
|
||||
/* A simple periodic statistic printer, used only in net core */
|
||||
void net_print_statistics(void);
|
||||
|
||||
#else
|
||||
|
||||
#define net_print_statistics()
|
||||
|
||||
#endif /* CONFIG_NET_STATISTICS */
|
||||
#endif
|
||||
|
||||
#endif /* __NET_STATS_H__ */
|
||||
|
|
Loading…
Reference in a new issue