mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 20:58:14 -04:00
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>
This commit is contained in:
committed by
David S. Miller
parent
45a15d89fb
commit
4b4f052e2d
@@ -424,7 +424,25 @@ enum skb_drop_reason {
|
||||
SKB_DROP_REASON_DEV_HDR, /* device driver specific
|
||||
* header/metadata is invalid
|
||||
*/
|
||||
/* the device is not ready to xmit/recv due to any of its data
|
||||
* structure that is not up/ready/initialized, e.g., the IFF_UP is
|
||||
* not set, or driver specific tun->tfiles[txq] is not initialized
|
||||
*/
|
||||
SKB_DROP_REASON_DEV_READY,
|
||||
SKB_DROP_REASON_FULL_RING, /* ring buffer is full */
|
||||
SKB_DROP_REASON_NOMEM, /* error due to OOM */
|
||||
SKB_DROP_REASON_HDR_TRUNC, /* failed to trunc/extract the header
|
||||
* from networking data, e.g., failed
|
||||
* to pull the protocol header from
|
||||
* frags via pskb_may_pull()
|
||||
*/
|
||||
SKB_DROP_REASON_TAP_FILTER, /* dropped by (ebpf) filter directly
|
||||
* attached to tun/tap, e.g., via
|
||||
* TUNSETFILTEREBPF
|
||||
*/
|
||||
SKB_DROP_REASON_TAP_TXFILTER, /* dropped by tx filter implemented
|
||||
* at tun/tap, e.g., check_filter()
|
||||
*/
|
||||
SKB_DROP_REASON_MAX,
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,12 @@
|
||||
EM(SKB_DROP_REASON_SKB_GSO_SEG, SKB_GSO_SEG) \
|
||||
EM(SKB_DROP_REASON_SKB_UCOPY_FAULT, SKB_UCOPY_FAULT) \
|
||||
EM(SKB_DROP_REASON_DEV_HDR, DEV_HDR) \
|
||||
EM(SKB_DROP_REASON_DEV_READY, DEV_READY) \
|
||||
EM(SKB_DROP_REASON_FULL_RING, FULL_RING) \
|
||||
EM(SKB_DROP_REASON_NOMEM, NOMEM) \
|
||||
EM(SKB_DROP_REASON_HDR_TRUNC, HDR_TRUNC) \
|
||||
EM(SKB_DROP_REASON_TAP_FILTER, TAP_FILTER) \
|
||||
EM(SKB_DROP_REASON_TAP_TXFILTER, TAP_TXFILTER) \
|
||||
EMe(SKB_DROP_REASON_MAX, MAX)
|
||||
|
||||
#undef EM
|
||||
|
||||
Reference in New Issue
Block a user