net: stats: Separate dropped TCP data segments and TCP packets

Track the number of dropped TCP data segments and number of dropped
TCP packets in network statistics. It is useful to see these
numbers separately.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2020-11-05 17:23:44 +02:00 committed by Maureen Helm
parent d4320eedf2
commit ab8fd8270a
2 changed files with 12 additions and 3 deletions

View file

@ -129,6 +129,9 @@ struct net_stats_tcp {
/** Amount of retransmitted data. */
net_stats_t resent;
/** Number of dropped packets at the TCP layer. */
net_stats_t drop;
/** Number of received TCP segments. */
net_stats_t recv;
@ -136,7 +139,7 @@ struct net_stats_tcp {
net_stats_t sent;
/** Number of dropped TCP segments. */
net_stats_t drop;
net_stats_t seg_drop;
/** Number of TCP segments with a bad checksum. */
net_stats_t chkerr;

View file

@ -204,6 +204,11 @@ static inline void net_stats_update_tcp_resent(struct net_if *iface,
UPDATE_STAT(iface, stats.tcp.resent += bytes);
}
static inline void net_stats_update_tcp_drop(struct net_if *iface)
{
UPDATE_STAT(iface, stats.tcp.drop++);
}
static inline void net_stats_update_tcp_seg_sent(struct net_if *iface)
{
UPDATE_STAT(iface, stats.tcp.sent++);
@ -216,7 +221,7 @@ static inline void net_stats_update_tcp_seg_recv(struct net_if *iface)
static inline void net_stats_update_tcp_seg_drop(struct net_if *iface)
{
UPDATE_STAT(iface, stats.tcp.drop++);
UPDATE_STAT(iface, stats.tcp.seg_drop++);
}
static inline void net_stats_update_tcp_seg_rst(struct net_if *iface)
@ -257,6 +262,7 @@ static inline void net_stats_update_tcp_seg_rexmit(struct net_if *iface)
#define net_stats_update_tcp_sent(iface, bytes)
#define net_stats_update_tcp_resent(iface, bytes)
#define net_stats_update_tcp_recv(iface, bytes)
#define net_stats_update_tcp_drop(iface)
#define net_stats_update_tcp_seg_sent(iface)
#define net_stats_update_tcp_seg_recv(iface)
#define net_stats_update_tcp_seg_drop(iface)
@ -293,7 +299,7 @@ static inline void net_stats_update_per_proto_drop(struct net_if *iface,
if (IS_ENABLED(CONFIG_NET_UDP) && proto == IPPROTO_UDP) {
net_stats_update_udp_drop(iface);
} else if (IS_ENABLED(CONFIG_NET_TCP) && proto == IPPROTO_TCP) {
net_stats_update_tcp_seg_drop(iface);
net_stats_update_tcp_drop(iface);
}
}