net: stats: Add IGMP statistics support
Collect IPv4 IGMP sent/received/dropped statistics. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
e5043f5a7f
commit
d28e64c602
4 changed files with 53 additions and 1 deletions
|
@ -205,6 +205,20 @@ struct net_stats_ipv6_mld {
|
|||
net_stats_t drop;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IPv4 IGMP daemon statistics
|
||||
*/
|
||||
struct net_stats_ipv4_igmp {
|
||||
/** Number of received IPv4 IGMP queries */
|
||||
net_stats_t recv;
|
||||
|
||||
/** Number of sent IPv4 IGMP reports */
|
||||
net_stats_t sent;
|
||||
|
||||
/** Number of dropped IPv4 IGMP packets */
|
||||
net_stats_t drop;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Network packet transfer times for calculating average TX time
|
||||
*/
|
||||
|
@ -323,6 +337,11 @@ struct net_stats {
|
|||
struct net_stats_ipv6_mld ipv6_mld;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS_IGMP)
|
||||
/** IPv4 IGMP statistics */
|
||||
struct net_stats_ipv4_igmp ipv4_igmp;
|
||||
#endif
|
||||
|
||||
#if NET_TC_COUNT > 1
|
||||
/** Traffic class statistics */
|
||||
struct net_stats_tc tc;
|
||||
|
|
|
@ -86,6 +86,13 @@ config NET_STATISTICS_MLD
|
|||
help
|
||||
Keep track of MLD related statistics
|
||||
|
||||
config NET_STATISTICS_IGMP
|
||||
bool "Internet Group Management Protocol (IGMP) statistics"
|
||||
depends on NET_IPV4_IGMP
|
||||
default y
|
||||
help
|
||||
Keep track of IGMP related statistics
|
||||
|
||||
config NET_STATISTICS_PPP
|
||||
bool "Point-to-point (PPP) statistics"
|
||||
depends on NET_PPP
|
||||
|
|
|
@ -1236,7 +1236,12 @@ static void net_shell_print_statistics(struct net_if *iface, void *user_data)
|
|||
GET_STAT(iface, icmp.typeerr),
|
||||
GET_STAT(iface, icmp.chkerr));
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS_IGMP)
|
||||
PR("IGMP recv %d\tsent\t%d\tdrop\t%d\n",
|
||||
GET_STAT(iface, ipv4_igmp.recv),
|
||||
GET_STAT(iface, ipv4_igmp.sent),
|
||||
GET_STAT(iface, ipv4_igmp.drop));
|
||||
#endif /* CONFIG_NET_STATISTICS_IGMP */
|
||||
#if defined(CONFIG_NET_STATISTICS_UDP) && defined(CONFIG_NET_NATIVE_UDP)
|
||||
PR("UDP recv %d\tsent\t%d\tdrop\t%d\n",
|
||||
GET_STAT(iface, udp.recv),
|
||||
|
|
|
@ -324,6 +324,27 @@ static inline void net_stats_update_ipv6_mld_drop(struct net_if *iface)
|
|||
#define net_stats_update_ipv6_mld_drop(iface)
|
||||
#endif /* CONFIG_NET_STATISTICS_MLD */
|
||||
|
||||
#if defined(CONFIG_NET_STATISTICS_IGMP) && defined(CONFIG_NET_NATIVE)
|
||||
static inline void net_stats_update_ipv4_igmp_recv(struct net_if *iface)
|
||||
{
|
||||
UPDATE_STAT(iface, stats.ipv4_igmp.recv++);
|
||||
}
|
||||
|
||||
static inline void net_stats_update_ipv4_igmp_sent(struct net_if *iface)
|
||||
{
|
||||
UPDATE_STAT(iface, stats.ipv4_igmp.sent++);
|
||||
}
|
||||
|
||||
static inline void net_stats_update_ipv4_igmp_drop(struct net_if *iface)
|
||||
{
|
||||
UPDATE_STAT(iface, stats.ipv4_igmp.drop++);
|
||||
}
|
||||
#else
|
||||
#define net_stats_update_ipv4_igmp_recv(iface)
|
||||
#define net_stats_update_ipv4_igmp_sent(iface)
|
||||
#define net_stats_update_ipv4_igmp_drop(iface)
|
||||
#endif /* CONFIG_NET_STATISTICS_IGMP */
|
||||
|
||||
#if defined(CONFIG_NET_PKT_TXTIME_STATS) && defined(CONFIG_NET_STATISTICS)
|
||||
static inline void net_stats_update_tx_time(struct net_if *iface,
|
||||
uint32_t start_time,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue