All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jiayuan Chen" <jiayuan.chen@linux.dev>
To: "Eric Dumazet" <edumazet@google.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kuniyu@amazon.com, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, dsahern@kernel.org,
	ncardwell@google.com, mrpre@163.com
Subject: Re: [PATCH net-next v2] tcp: Support skb PAWS drop reason when TIME-WAIT
Date: Tue, 25 Mar 2025 12:20:18 +0000	[thread overview]
Message-ID: <5cdc1bdd9caee92a6ae932638a862fd5c67630e8@linux.dev> (raw)
In-Reply-To: <CANn89iKxTHZ1JoQ9g9ekWq9=29LjRmhbxsnwkQ2RgPT-yCYMig@mail.gmail.com>

March 25, 2025 at 19:29, "Eric Dumazet" <edumazet@google.com> wrote:

> >  ---
> > 
> >  include/net/tcp.h | 3 ++-
> > 
> >  net/ipv4/tcp_ipv4.c | 2 +-
> > 
> >  net/ipv4/tcp_minisocks.c | 7 +++++--
> > 
> >  net/ipv6/tcp_ipv6.c | 2 +-
> > 
> >  4 files changed, 9 insertions(+), 5 deletions(-)
> > 
> >  diff --git a/include/net/tcp.h b/include/net/tcp.h
> > 
> >  index f8efe56bbccb..e1574e804530 100644
> > 
> >  --- a/include/net/tcp.h
> > 
> >  +++ b/include/net/tcp.h
> > 
> >  @@ -427,7 +427,8 @@ enum tcp_tw_status {
> > 
> >  enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
> > 
> >  struct sk_buff *skb,
> > 
> >  const struct tcphdr *th,
> > 
> >  - u32 *tw_isn);
> > 
> >  + u32 *tw_isn,
> > 
> >  + enum skb_drop_reason *drop_reason);
> > 
> >  struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
> > 
> >  struct request_sock *req, bool fastopen,
> > 
> >  bool *lost_race, enum skb_drop_reason *drop_reason);
> > 
> >  diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> > 
> >  index 1cd0938d47e0..a9dde473a23f 100644
> > 
> >  --- a/net/ipv4/tcp_ipv4.c
> > 
> >  +++ b/net/ipv4/tcp_ipv4.c
> > 
> >  @@ -2417,7 +2417,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
> > 
> >  goto csum_error;
> > 
> >  }
> > 
> >  - tw_status = tcp_timewait_state_process(inet_twsk(sk), skb, th, &isn);
> > 
> >  + tw_status = tcp_timewait_state_process(inet_twsk(sk), skb, th, &isn, &drop_reason);
> > 
> >  switch (tw_status) {
> > 
> >  case TCP_TW_SYN: {
> > 
> >  struct sock *sk2 = inet_lookup_listener(net,
> > 
> >  diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
> > 
> >  index fb9349be36b8..d16dfd41397e 100644
> > 
> >  --- a/net/ipv4/tcp_minisocks.c
> > 
> >  +++ b/net/ipv4/tcp_minisocks.c
> > 
> >  @@ -97,7 +97,8 @@ static void twsk_rcv_nxt_update(struct tcp_timewait_sock *tcptw, u32 seq,
> > 
> >  */
> > 
> >  enum tcp_tw_status
> > 
> >  tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
> > 
> >  - const struct tcphdr *th, u32 *tw_isn)
> > 
> >  + const struct tcphdr *th, u32 *tw_isn,
> > 
> >  + enum skb_drop_reason *drop_reason)
> > 
> >  {
> > 
> >  struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
> > 
> >  u32 rcv_nxt = READ_ONCE(tcptw->tw_rcv_nxt);
> > 
> >  @@ -245,8 +246,10 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
> > 
> >  return TCP_TW_SYN;
> > 
> >  }
> > 
> >  - if (paws_reject)
> > 
> >  + if (paws_reject) {
> > 
> >  + *drop_reason = SKB_DROP_REASON_TCP_RFC7323_PAWS;
> > 
> >  __NET_INC_STATS(twsk_net(tw), LINUX_MIB_PAWSESTABREJECTED);
> > 
> 
> I think we should add a new SNMP value and drop reason for TW sockets.
> 
> SNMP_MIB_ITEM("PAWSTimewait", LINUX_MIB_PAWSTIMEWAIT),
> 
> and SKB_DROP_REASON_TCP_RFC7323_TW_PAWS ?
>

That makes sense, we've done similar things before, such as adding
PAWS_OLD_ACK previously.

Thanks for the suggestion!
-- 
pw-bot: cr

  reply	other threads:[~2025-03-25 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 11:03 [PATCH net-next v2] tcp: Support skb PAWS drop reason when TIME-WAIT Jiayuan Chen
2025-03-25 11:29 ` Eric Dumazet
2025-03-25 12:20   ` Jiayuan Chen [this message]
2025-03-25 15:43     ` Jakub Kicinski
2025-03-25 16:18       ` Jiayuan Chen

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=5cdc1bdd9caee92a6ae932638a862fd5c67630e8@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrpre@163.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.