Commit 8edf19c2 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: sk_drops consolidation part 2

- skb_kill_datagram() can increment sk->sk_drops itself, not callers.

- UDP on IPV4 & IPV6 dropped frames (because of bad checksum or policy checks) increment sk_drops
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c720c7e8
...@@ -262,6 +262,7 @@ int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) ...@@ -262,6 +262,7 @@ int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags)
} }
kfree_skb(skb); kfree_skb(skb);
atomic_inc(&sk->sk_drops);
sk_mem_reclaim_partial(sk); sk_mem_reclaim_partial(sk);
return err; return err;
......
...@@ -867,6 +867,7 @@ static unsigned int first_packet_length(struct sock *sk) ...@@ -867,6 +867,7 @@ static unsigned int first_packet_length(struct sock *sk)
udp_lib_checksum_complete(skb)) { udp_lib_checksum_complete(skb)) {
UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS,
IS_UDPLITE(sk)); IS_UDPLITE(sk));
atomic_inc(&sk->sk_drops);
__skb_unlink(skb, rcvq); __skb_unlink(skb, rcvq);
__skb_queue_tail(&list_kill, skb); __skb_queue_tail(&list_kill, skb);
} }
...@@ -1186,6 +1187,7 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) ...@@ -1186,6 +1187,7 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
drop: drop:
UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
atomic_inc(&sk->sk_drops);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
} }
......
...@@ -517,7 +517,6 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, ...@@ -517,7 +517,6 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
as some normal condition. as some normal condition.
*/ */
err = (flags&MSG_DONTWAIT) ? -EAGAIN : -EHOSTUNREACH; err = (flags&MSG_DONTWAIT) ? -EAGAIN : -EHOSTUNREACH;
atomic_inc(&sk->sk_drops);
goto out; goto out;
} }
......
...@@ -390,11 +390,13 @@ int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) ...@@ -390,11 +390,13 @@ int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
if (rc == -ENOMEM) if (rc == -ENOMEM)
UDP6_INC_STATS_BH(sock_net(sk), UDP6_INC_STATS_BH(sock_net(sk),
UDP_MIB_RCVBUFERRORS, is_udplite); UDP_MIB_RCVBUFERRORS, is_udplite);
goto drop; goto drop_no_sk_drops_inc;
} }
return 0; return 0;
drop: drop:
atomic_inc(&sk->sk_drops);
drop_no_sk_drops_inc:
UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment