SOCK_DEBUG is a very ancient debugging interface, and it's not very useful for debugging. This pacthset cleanups SOCK_DEBUG() and replace it with a new methord based on BPF.
I cleanup SOCK_DEBUG() only for TCP, and other protocols are kept as is. After this patchset, the SO_DEBUG interface will not take any effect for TCP, but I still keep it in sock_{s,g}etsockopt() for TCP to avoid breaking applications. In the future we may extend tcp_stats() as bellow or something else to cover all the LINUX_MIB_* and TCP_MIB_* proposaled[0] in the netconf2018. now: tcp_stats(struct sock *sk, int mib_idx) future: tcp_stats(struct sock *sk, int mib_idx, int packets) The argument packets can be 1 to indicates this is a event only; and skb_shinfo(skb)->gso_segs to indicates the number of packets are also concerned. [0] page 14, http://vger.kernel.org/netconf2018_files/BrendanGregg_netconf2018.pdf Yafang Shao (2): tcp: replace SOCK_DEBUG() with tcp_stats() bpf: add BPF_SOCK_OPS_STATS_CB for tcp_stats() include/uapi/linux/bpf.h | 5 +++++ include/uapi/linux/snmp.h | 3 +++ net/ipv4/proc.c | 3 +++ net/ipv4/tcp_input.c | 27 ++++++++++++--------------- net/ipv6/tcp_ipv6.c | 2 -- 5 files changed, 23 insertions(+), 17 deletions(-) -- 1.8.3.1