]> git.baikalelectronics.ru Git - kernel.git/commit
net: tun: track dropped skb via kfree_skb_reason()
authorDongli Zhang <dongli.zhang@oracle.com>
Fri, 4 Mar 2022 14:55:07 +0000 (06:55 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 6 Mar 2022 11:04:01 +0000 (11:04 +0000)
commit5f87fd30d56a675318f958fb9a8cfe09b15acb2d
tree55ae97b17bc598e205cf4908021040685f8a4a7b
parentbfd41a0e98cef27f8933a1e2d07ffb52af4230e2
net: tun: track dropped skb via kfree_skb_reason()

The TUN can be used as vhost-net backend. E.g, the tun_net_xmit() is the
interface to forward the skb from TUN to vhost-net/virtio-net.

However, there are many "goto drop" in the TUN driver. Therefore, the
kfree_skb_reason() is involved at each "goto drop" to help userspace
ftrace/ebpf to track the reason for the loss of packets.

The below reasons are introduced:

- SKB_DROP_REASON_DEV_READY
- SKB_DROP_REASON_NOMEM
- SKB_DROP_REASON_HDR_TRUNC
- SKB_DROP_REASON_TAP_FILTER
- SKB_DROP_REASON_TAP_TXFILTER

Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c
include/linux/skbuff.h
include/trace/events/skb.h