netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: menglong8.dong@gmail.com
To: edumazet@google.com
Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net,
	yoshfuji@linux-ipv6.org, dsahern@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, benbjiang@tencent.com, flyingpeng@tencent.com,
	imagedong@tencent.com, kafai@fb.com, talalahmad@google.com,
	keescook@chromium.org, mengensun@tencent.com,
	dongli.zhang@oracle.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: [PATCH net-next v2 0/2] net: tcp: add skb drop reasons to connect request
Date: Thu, 28 Apr 2022 15:33:38 +0800	[thread overview]
Message-ID: <20220428073340.224391-1-imagedong@tencent.com> (raw)

From: Menglong Dong <imagedong@tencent.com>

Seems now the reasons of skb drop in TCP layer are almost supported,
except the path of connect requesting. So let's just finish it.

The TCP connect requesting is processed by
'inet_csk(sk)->icsk_af_ops->conn_request()'. Yeah, it's a function
pointer, so it's not easy to add function param to it. Luckily, it's
return value can be reused. For now, 0 means a call of 'consume_skb()'
and -1 means 'kfree_skb()', with a RESET be send. Therefore, we can
return the drop reasons directly, as the positive is not used yet. With
drop reasons returned, kfree_skb_reason() will be called instead of
consume_skb() in tcp_rcv_state_process().

And in the 2th patch, skb drop reasons are added to route_req() in
struct tcp_request_sock_ops by adding a function param to it.

Following new skb drop reasons are added:

  SKB_DROP_REASON_LISTENOVERFLOWS
  SKB_DROP_REASON_TCP_REQQFULLDROP
  SKB_DROP_REASON_SECURITY

Changes since v1:
- don't free skb in conn_request, as Eric suggested, and use it's
  return value to pass drop reasons in the 1th patch.

Menglong Dong (2):
  net: tcp: add skb drop reasons to tcp connect request
  net: tcp: add skb drop reasons to route_req()

 include/linux/skbuff.h     |  5 +++++
 include/net/tcp.h          |  3 ++-
 include/trace/events/skb.h |  3 +++
 net/ipv4/tcp_input.c       | 22 +++++++++++++++-------
 net/ipv4/tcp_ipv4.c        | 16 ++++++++++++----
 net/ipv6/tcp_ipv6.c        | 18 +++++++++++++-----
 net/mptcp/subflow.c        | 10 ++++++----
 7 files changed, 56 insertions(+), 21 deletions(-)

-- 
2.36.0


             reply	other threads:[~2022-04-28  7:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28  7:33 menglong8.dong [this message]
2022-04-28  7:33 ` [PATCH net-next v2 1/2] net: tcp: add skb drop reasons to tcp connect request menglong8.dong
2022-04-28  7:33 ` [PATCH net-next v2 2/2] net: tcp: add skb drop reasons to route_req() menglong8.dong
2022-04-28 13:22   ` Toke Høiland-Jørgensen
2022-04-29  1:27     ` Menglong Dong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220428073340.224391-1-imagedong@tencent.com \
    --to=menglong8.dong@gmail.com \
    --cc=benbjiang@tencent.com \
    --cc=davem@davemloft.net \
    --cc=dongli.zhang@oracle.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=flyingpeng@tencent.com \
    --cc=imagedong@tencent.com \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mengensun@tencent.com \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=talalahmad@google.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).