From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.197 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796374571; b=OGuwCqxg4+KdJx4nl1szA+Hu7fDDeDLAgC+pLJztlgC7t1brTinTH9ASkwvA0LQWg9W1 +EpfxzltusV5HcA9joJ4vvcBsuLXHRCEBKamJIt41xlo6YFRBbXd1rvTJVnP3Jgmbljhf tsMWtw0LiLkCNlizDvHe3zNchofC5cv0NENurxDg5JkbJTZJBVWtq8eph2BMvClYUbb/3 TqdCcLBNZC43pNXNW9r/DTLfXr5eJZONBY6bmwYQfsrBOKLVzqySkkUBCaGU363wb+3RM HStwo+JMW09ncnlsQvzHHe2k3BO5z7E3k0GAUcmOT44iztCvxGVv6dgWgNXejAON0fQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796374571; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=c7HpQ97s6Ud53BVLlar/u8/dVKLTe9zzSGu/ps5E6ag=; b=0CO+nn903pbEkTp7PkOs25ORqHAajxWqGl3e8cZjkK+D9nDMoL9tPrFofS7hlK7xnjRq ttAI+FsqcXpIaaqUQkUkU5zyyrU3KejDfWS8g0iTO8TZxdFXxb/lVC3td6K+a9YhQQFGF Kz1vneEpM+AZ3bTd6FhvoREcXjMFkf4rj142oD4CeSeapTnsgS8Wn6oj197rWKhQhZfA+ Wk1C0cGLvGQ1spc7mW0+8AwZBBSwJZmblLN1lWDmI18b2XjlTCgdVcuOcDmeBOOUg6QLQ dgtv9X137AS5MLyLzyLltwJQdHS+rib+wCp4z8Z4r4DwK5pRabHS10FOPx1riHuDaiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=DsQDEmPa; arc=none smtp.remote-ip=209.85.214.197 Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A75E606A691 for ; Fri, 4 Dec 2026 08:56:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7A75E606A691 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=DsQDEmPa Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2f09a37f41dso7811775ad.3 for ; Fri, 04 Dec 2026 00:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796374571; x=1796979371; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=c7HpQ97s6Ud53BVLlar/u8/dVKLTe9zzSGu/ps5E6ag=; b=DsQDEmPauwpkmC9v8N4bgktGe+qXm+9khQLE1pcMAQSI9rP2M9aGYTe2lPY/CP7CZw B8LvP3lYx4zcf7VkerhXPpD3TBHmnni1fR31Jwuf8f9D6bLU0y7Jn2gdsvuqJPljFxxq 5c5MSIE2Y4a6Z/MBX9mPEdRwjsksY+g8F4HtZY1s4gil0ikuZioKzlbjRk8nKnPNIfhj dOBJEY0tEwVT+u2ymfok/0eDJxBnnW3N/SOwhpD86RUEZIvOLl4sp5shNpnXRLAQE0p+ +KBav0HEfaofWjt2wFy/Peg+Jv1Viy0kFDsK+BtQ2OekoYidUnSt8DYUIJFSZgRFI9ml v2Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796374571; x=1796979371; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=c7HpQ97s6Ud53BVLlar/u8/dVKLTe9zzSGu/ps5E6ag=; b=GaD0tlq8DCJnw0X9vmEHdAwmepPKTRKHi2BTNDz9/CeVvbK9sok7UECvDYffAOLnuO 9W968sRrywX1edaxQmnHyYfPYbfvF5H3bRaZOiWt2FMuvqk1qbB2G2WgGtU8pxPRPyGI EXccPRCvCvPihjKwpbx0x73p9/lHaWxPuXxU0HihLCtWvF97Fg4XggrkQ57oWZHCxVPK nphSwcTOMcw9yxQa8y/gPPU71WnrBGkzBwI4QudI+29wgbo9OBCVEiR1A8M7TCjeuUuU bM7WSIcDXDPo9WR7SWWpDBnHfbctQRTV7W9NfKa4jLMfXW0pt7pUkOZ/tSRqJqstQPq5 SXXQ== X-Forwarded-Encrypted: i=1; AL+hErEVquosdGnoRUOGwSC1TUlnFAf7scvE0zhP6i03vEAZvBpZKz8AK+ZX7020qXLpnbEaxluW2Zo=@vger.kernel.org X-Gm-Message-State: APuU4Z9/dczgC2mkO/QueeguCpzu3Rd2ZXVZtw96AdCENT2FeljR39T6 EzuZdk+SbSN3HvF/ApOFRXtv7fiZcO+bCZheMNRBYPahGrPaRA+nprsRpi5SC+IvLLf9Q35K8jk vS4HACg== X-Received: from plor7.prod.google.com ([2002:a17:902:8bc7:b0:2f0:9326:9b06]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:d510:b0:2ef:efae:e8e7 with SMTP id d9443c01a7336-2f1b9bef823mr13176505ad.0.1796374570383; Fri, 04 Dec 2026 00:56:10 -0800 (PST) Date: Fri, 4 Dec 2026 17:54:34 +0900 In-Reply-To: <20261204085551.1518105-1-kuniyu@google.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261204085551.1518105-1-kuniyu@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261204085551.1518105-5-kuniyu@google.com> Subject: [PATCH v1 net-next 04/10] tcp: Call tcp_plb_update_state_upon_rto() after rehash in tcp_write_timeout(). From: Kuniyuki Iwashima To: Eric Dumazet , Neal Cardwell , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Willem de Bruijn Cc: Simon Horman , Yuchung Cheng , Kuniyuki Iwashima , Kuniyuki Iwashima , netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" dctcp_cwnd_event() calls tcp_plb_update_state_upon_rto() upon CA_EVENT_LOSS in tcp_enter_loss() to reset plb_consec_cong_rounds and pause PLB after an RTO triggers a path rehash. However, tcp_enter_loss() does not always correspond to an RTO rehash: 1. tcp_enter_loss() is called from 3 paths but the first two do not rehash the flow: - tcp_fastopen_synack_timer() - tcp_retransmit_timer() when !tp->snd_wnd - tcp_retransmit_timer() when tcp_write_timeout() returns 0 2. Even on the last path, tcp_enter_loss() skips CA_EVENT_LOSS if after(tp->high_seq, tp->snd_una) is true and the socket is in TCP_CA_CWR (e.g. after receiving ECN CE in DCTCP), TCP_CA_Recovery, or TCP_CA_Loss with icsk_retransmits > 0. In the second case, even when tcp_write_timeout() rehashes the flow, tcp_plb_update_state_upon_rto() is missed. Then, a subsequent tcp_plb_check_rehash() in dctcp_update_alpha() or dctcp_cwnd_event_tx_start() can immediately rehash the flow again, potentially back to the previous bad path. Let's move tcp_plb_update_state_upon_rto() just after __sk_rethink_txhash_reset_dst() in tcp_write_timeout(). Signed-off-by: Kuniyuki Iwashima --- net/ipv4/tcp_dctcp.c | 1 - net/ipv4/tcp_plb.c | 1 - net/ipv4/tcp_timer.c | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c index bc3724d1da90..bbfff24ed5f0 100644 --- a/net/ipv4/tcp_dctcp.c +++ b/net/ipv4/tcp_dctcp.c @@ -198,7 +198,6 @@ __bpf_kfunc static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev) dctcp_ece_ack_update(sk, ev, &ca->prior_rcv_nxt, &ca->ce_state); break; case CA_EVENT_LOSS: - tcp_plb_update_state_upon_rto(sk); dctcp_react_to_loss(sk); break; default: diff --git a/net/ipv4/tcp_plb.c b/net/ipv4/tcp_plb.c index 26ca53d6fb9d..c21fcb7945c0 100644 --- a/net/ipv4/tcp_plb.c +++ b/net/ipv4/tcp_plb.c @@ -113,4 +113,3 @@ void tcp_plb_update_state_upon_rto(struct sock *sk) */ tp->plb_consec_cong_rounds = 0; } -EXPORT_SYMBOL_GPL(tcp_plb_update_state_upon_rto); diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 814fadb30749..a3210cda2515 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -297,6 +297,7 @@ static int tcp_write_timeout(struct sock *sk) } if (__sk_rethink_txhash_reset_dst(sk)) { + tcp_plb_update_state_upon_rto(sk); WRITE_ONCE(tp->timeout_rehash, tp->timeout_rehash + 1); __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEOUTREHASH); } -- 2.56.1.915.g69d5ec7298-goog