Problems: 1.kfree_skb_reason provides tools for monitoring packet drop reasons but cannot retain historical drop counts. 2.There is no unified interface to display all packet drop statistics. Solution: 1.Implement skb drop reason counting through the tracepoint of kfree_skb to decouple the functionality. 2.Implement a proc interface to display the counts of skb drop reasons. Usage: bash-4.4# cat /proc/net/drop_reason_stat REASON TOTAL GROUP DESC --------------------------------------------------------------------------- NOT_SPECIFIED 0 Other Drop reason not specified NO_SOCKET 0 Input Socket not found PKT_TOO_SMALL 0 Input Packet size too small TCP_CSUM 0 TCP TCP checksum error SOCKET_FILTER 0 Input Dropped by socket filter UDP_CSUM 0 UDP UDP checksum error NETFILTER_DROP 0 Input Dropped by netfilter OTHERHOST 0 Input Packet not for this host IP_CSUM 0 IP IP checksum error IP_INHDR 0 IP IP header error IP_RPFILTER 0 IP IP rpfilter failed UNICAST_IN_L2_MULTICAST 0 Input L2 multicast, L3 unicast XFRM_POLICY 0 IPSec XFRM policy check failed IP_NOPROTO 0 IP No support for IP protocol SOCKET_RCVBUFF 0 Input Socket receive buffer full PROTO_MEM 0 Input Protocol memory limit TCP_MD5NOTFOUND 0 TCP TCP-MD5 not found ... IPV6_NDISC_HOP_LIMIT 0 IPv6 IPv6 NDISC hop limit IPV6_NDISC_BAD_CODE 0 IPv6 IPv6 NDISC bad code IPV6_NDISC_BAD_OPTIONS 0 IPv6 IPv6 NDISC bad options IPV6_NDISC_NS_OTHERHOST 0 IPv6 IPv6 NDISC NS for other host QUEUE_PURGE 0 Other Queue purged
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/5826