diff options
author | Eric Dumazet <edumazet@google.com> | 2018-09-14 16:24:05 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-10-13 09:11:34 +0200 |
commit | ec7055c62714326c56dabcf7757069ac7f276bda (patch) | |
tree | ec2397011a176618e1a4414e0028d13a4bdb24a9 /include | |
parent | c4c84454902516b7648a18d5173304da7dffa9d6 (diff) | |
download | linux-stable-ec7055c62714326c56dabcf7757069ac7f276bda.tar.gz linux-stable-ec7055c62714326c56dabcf7757069ac7f276bda.tar.bz2 linux-stable-ec7055c62714326c56dabcf7757069ac7f276bda.zip |
tcp: increment sk_drops for dropped rx packets
[ Upstream commit 532182cd610782db8c18230c2747626562032205 ]
Now ss can report sk_drops, we can instruct TCP to increment
this per socket counter when it drops an incoming frame, to refine
monitoring and debugging.
Following patch takes care of listeners drops.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mao Wenan <maowenan@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/sock.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 3d5ff7436f41..577075713ad5 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2139,6 +2139,13 @@ sock_skb_set_dropcount(const struct sock *sk, struct sk_buff *skb) SOCK_SKB_CB(skb)->dropcount = atomic_read(&sk->sk_drops); } +static inline void sk_drops_add(struct sock *sk, const struct sk_buff *skb) +{ + int segs = max_t(u16, 1, skb_shinfo(skb)->gso_segs); + + atomic_add(segs, &sk->sk_drops); +} + void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, |