1. 23 Feb, 2022 13 commits
  2. 22 Feb, 2022 9 commits
  3. 21 Feb, 2022 15 commits
  4. 20 Feb, 2022 3 commits
    • David S. Miller's avatar
      Merge branch 'tcp_drop_reason' · adfb62db
      David S. Miller authored
      Menglong Dong says:
      
      ====================
      net: add skb drop reasons to TCP packet receive
      
      In the commit c504e5c2 ("net: skb: introduce kfree_skb_reason()"),
      we added the support of reporting the reasons of skb drops to kfree_skb
      tracepoint. And in this series patches, reasons for skb drops are added
      to TCP layer (both TCPv4 and TCPv6 are considered).
      Following functions are processed:
      
      tcp_v4_rcv()
      tcp_v6_rcv()
      tcp_v4_inbound_md5_hash()
      tcp_v6_inbound_md5_hash()
      tcp_add_backlog()
      tcp_v4_do_rcv()
      tcp_v6_do_rcv()
      tcp_rcv_established()
      tcp_data_queue()
      tcp_data_queue_ofo()
      
      The functions we handled are mostly for packet ingress, as skb drops
      hardly happens in the egress path of TCP layer. However, it's a little
      complex for TCP state processing, as I find that it's hard to report skb
      drop reasons to where it is freed. For example, when skb is dropped in
      tcp_rcv_state_process(), the reason can be caused by the call of
      tcp_v4_conn_request(), and it's hard to return a drop reason from
      tcp_v4_conn_request(). So such cases are skipped  for this moment.
      
      Following new drop reasons are introduced (what they mean can be see
      in the document for them):
      
      /* SKB_DROP_REASON_TCP_MD5* corresponding to LINUX_MIB_TCPMD5* */
      SKB_DROP_REASON_TCP_MD5NOTFOUND
      SKB_DROP_REASON_TCP_MD5UNEXPECTED
      SKB_DROP_REASON_TCP_MD5FAILURE
      SKB_DROP_REASON_SOCKET_BACKLOG
      SKB_DROP_REASON_TCP_FLAGS
      SKB_DROP_REASON_TCP_ZEROWINDOW
      SKB_DROP_REASON_TCP_OLD_DATA
      SKB_DROP_REASON_TCP_OVERWINDOW
      /* corresponding to LINUX_MIB_TCPOFOMERGE */
      SKB_DROP_REASON_TCP_OFOMERGE
      
      Here is a example to get TCP packet drop reasons from ftrace:
      
      $ echo 1 > /sys/kernel/debug/tracing/events/skb/kfree_skb/enable
      $ cat /sys/kernel/debug/tracing/trace
      $ <idle>-0       [036] ..s1.   647.428165: kfree_skb: skbaddr=000000004d037db6 protocol=2048 location=0000000074cd1243 reason: NO_SOCKET
      $ <idle>-0       [020] ..s2.   639.676674: kfree_skb: skbaddr=00000000bcbfa42d protocol=2048 location=00000000bfe89d35 reason: PROTO_MEM
      
      From the reason 'PROTO_MEM' we can know that the skb is dropped because
      the memory configured in net.ipv4.tcp_mem is up to the limition.
      
      Changes since v2:
      - remove the 'inline' of tcp_drop() in the 1th patch, as Jakub
        suggested
      
      Changes since v1:
      - enrich the document for this series patches in the cover letter,
        as Eric suggested
      - fix compile warning report by Jakub in the 6th patch
      - let NO_SOCKET trump the XFRM failure in the 2th and 3th patches
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      adfb62db
    • Menglong Dong's avatar
      net: tcp: use tcp_drop_reason() for tcp_data_queue_ofo() · d25e481b
      Menglong Dong authored
      Replace tcp_drop() used in tcp_data_queue_ofo with tcp_drop_reason().
      Following drop reasons are introduced:
      
      SKB_DROP_REASON_TCP_OFOMERGE
      Reviewed-by: default avatarMengen Sun <mengensun@tencent.com>
      Reviewed-by: default avatarHao Peng <flyingpeng@tencent.com>
      Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d25e481b
    • Menglong Dong's avatar
      net: tcp: use tcp_drop_reason() for tcp_data_queue() · a7ec3810
      Menglong Dong authored
      Replace tcp_drop() used in tcp_data_queue() with tcp_drop_reason().
      Following drop reasons are introduced:
      
      SKB_DROP_REASON_TCP_ZEROWINDOW
      SKB_DROP_REASON_TCP_OLD_DATA
      SKB_DROP_REASON_TCP_OVERWINDOW
      
      SKB_DROP_REASON_TCP_OLD_DATA is used for the case that end_seq of skb
      less than the left edges of receive window. (Maybe there is a better
      name?)
      Reviewed-by: default avatarMengen Sun <mengensun@tencent.com>
      Reviewed-by: default avatarHao Peng <flyingpeng@tencent.com>
      Signed-off-by: default avatarMenglong Dong <imagedong@tencent.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7ec3810