summaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2016-04-01 17:52:19 +0200
committerDavid S. Miller <davem@davemloft.net>2016-04-05 04:11:20 +0200
commit532182cd610782db8c18230c2747626562032205 (patch)
tree6a2e21d238971e8eaccb22a872a1506a31f6f420 /include/net/sock.h
parentsock_diag: add SK_MEMINFO_DROPS (diff)
downloadlinux-532182cd610782db8c18230c2747626562032205.tar.xz
linux-532182cd610782db8c18230c2747626562032205.zip
tcp: increment sk_drops for dropped rx packets
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>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 7ad73db9dde2..310c4367ea83 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2012,6 +2012,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,