1. 06 Mar, 2022 5 commits
    • David S. Miller's avatar
      Merge branch 'tuntap-kfree_skb_reason' · 4c22aac3
      David S. Miller authored
      Dongli Zhang says:
      
      ====================
      tun/tap: use kfree_skb_reason() to trace dropped skb
      
      The commit c504e5c2 ("net: skb: introduce kfree_skb_reason()") has
      introduced the kfree_skb_reason() to help track the reason.
      
      The tun and tap are commonly used as virtio-net/vhost-net backend. This is to
      use kfree_skb_reason() to trace the dropped skb for those two drivers.
      
      Changed since v1:
      - I have renamed many of the reasons since v1. I make them as generic as
        possible so that they can be re-used by core networking and drivers.
      
      Changed since v2:
      - declare drop_reason as type "enum skb_drop_reason"
      - handle the drop in skb_list_walk_safe() case for tap driver, and
        kfree_skb_list_reason() is introduced
      
      Changed since v3 (only for PATCH 4/4):
      - rename to TAP_FILTER and TAP_TXFILTER
      - honor reverse xmas tree style declaration for 'drop_reason' in
        tun_net_xmit()
      
      Changed since v4:
      - make kfree_skb_list() static inline
      - add 'computation' to SKB_CSUM comment
      - change COPY_DATA to UCOPY_FAULT
      - add 'metadata' to DEV_HDR comment
      - expand comment on DEV_READY
      - change SKB_TRIM to NOMEM
      - chnage SKB_PULL to HDR_TRUNC
      Changed since v5:
      - rebase to net-next
      
      The following reasons are introduced.
      
      - SKB_DROP_REASON_SKB_CSUM
      - SKB_DROP_REASON_SKB_GSO_SEG
      - SKB_DROP_REASON_SKB_UCOPY_FAULT
      - SKB_DROP_REASON_DEV_HDR
      - SKB_DROP_REASON_FULL_RING
      - SKB_DROP_REASON_DEV_READY
      - SKB_DROP_REASON_NOMEM
      - SKB_DROP_REASON_HDR_TRUNC
      - SKB_DROP_REASON_TAP_FILTER
      - SKB_DROP_REASON_TAP_TXFILTER
      
      This is the output for TUN device.
      
                <idle>-0       [029] ..s1.   450.727651: kfree_skb: skbaddr=0000000023d235cc protocol=0 location=00000000a6748854 reason: NOT_SPECIFIED
                <idle>-0       [000] b.s3.   451.165671: kfree_skb: skbaddr=000000006b5de7cc protocol=4 location=000000007c2b9eae reason: FULL_RING
                <idle>-0       [000] b.s3.   453.149650: kfree_skb: skbaddr=000000006b5de7cc protocol=4 location=000000007c2b9eae reason: FULL_RING
                <idle>-0       [000] b.s3.   455.133576: kfree_skb: skbaddr=000000006b5de7cc protocol=4 location=000000007c2b9eae reason: FULL_RING
                <idle>-0       [000] b.s3.   457.117566: kfree_skb: skbaddr=000000006b5de7cc protocol=4 location=000000007c2b9eae reason: FULL_RING
      
      This is the output for TAP device.
      
                arping-7053    [006] ..s1.  1000.047753: kfree_skb: skbaddr=000000008618a587 protocol=2054 location=00000000743ad4a7 reason: FULL_RING
                <idle>-0       [022] ..s1.  1000.778514: kfree_skb: skbaddr=000000002c1e706c protocol=0 location=00000000a6748854 reason: NOT_SPECIFIED
                arping-7053    [006] ..s1.  1001.047830: kfree_skb: skbaddr=000000008618a587 protocol=2054 location=00000000743ad4a7 reason: FULL_RING
                arping-7053    [006] ..s1.  1002.047918: kfree_skb: skbaddr=000000008618a587 protocol=2054 location=00000000743ad4a7 reason: FULL_RING
                arping-7053    [006] ..s1.  1003.048017: kfree_skb: skbaddr=000000008618a587 protocol=2054 location=00000000743ad4a7 reason: FULL_RING
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4c22aac3
    • Dongli Zhang's avatar
      net: tun: track dropped skb via kfree_skb_reason() · 4b4f052e
      Dongli Zhang authored
      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: default avatarDongli Zhang <dongli.zhang@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4b4f052e
    • Dongli Zhang's avatar
      net: tun: split run_ebpf_filter() and pskb_trim() into different "if statement" · 45a15d89
      Dongli Zhang authored
      No functional change.
      
      Just to split the if statement into different conditions to use
      kfree_skb_reason() to trace the reason later.
      
      Cc: Joao Martins <joao.m.martins@oracle.com>
      Cc: Joe Jin <joe.jin@oracle.com>
      Signed-off-by: default avatarDongli Zhang <dongli.zhang@oracle.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45a15d89
    • Dongli Zhang's avatar
      net: tap: track dropped skb via kfree_skb_reason() · 736f16de
      Dongli Zhang authored
      The TAP can be used as vhost-net backend. E.g., the tap_handle_frame() is
      the interface to forward the skb from TAP to vhost-net/virtio-net.
      
      However, there are many "goto drop" in the TAP 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_SKB_CSUM
      - SKB_DROP_REASON_SKB_GSO_SEG
      - SKB_DROP_REASON_SKB_UCOPY_FAULT
      - SKB_DROP_REASON_DEV_HDR
      - SKB_DROP_REASON_FULL_RING
      
      Cc: Joao Martins <joao.m.martins@oracle.com>
      Cc: Joe Jin <joe.jin@oracle.com>
      Signed-off-by: default avatarDongli Zhang <dongli.zhang@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      736f16de
    • Dust Li's avatar
      Revert "net/smc: don't req_notify until all CQEs drained" · 925a2421
      Dust Li authored
      This reverts commit a505cce6.
      
      Leon says:
        We already discussed that. SMC should be changed to use
        RDMA CQ pool API
        drivers/infiniband/core/cq.c.
        ib_poll_handler() has much better implementation (tracing,
        IRQ rescheduling, proper error handling) than this SMC variant.
      
      Since we will switch to ib_poll_handler() in the future,
      revert this patch.
      
      Link: https://lore.kernel.org/netdev/20220301105332.GA9417@linux.alibaba.com/Suggested-by: default avatarLeon Romanovsky <leon@kernel.org>
      Suggested-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarDust Li <dust.li@linux.alibaba.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      925a2421
  2. 05 Mar, 2022 35 commits