Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5206581imw; Wed, 20 Jul 2022 00:43:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJ3JVTEbVpf0S+gngNSvc/ApQak0G/WBCN62+EgAzWwbsEyyWFeAOaMIW/0WO1EK+/7PKY X-Received: by 2002:a17:907:d05:b0:6f4:3729:8e36 with SMTP id gn5-20020a1709070d0500b006f437298e36mr34898809ejc.475.1658303035546; Wed, 20 Jul 2022 00:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658303035; cv=none; d=google.com; s=arc-20160816; b=zPhnTMOO9xjU1YN3GMd0tdLNiJbro6G6tbzHEFHxLEeaHqdwo0ndzj7H56JdGvC+gp va0KQsCB4gdrfYzSmAPg/xRcUcdX2esbSOldsk7UzmrXjjPemlOqgGPbERoDqRdzj4B7 6eaVcckZZdlLHsc1XxNcte/8yaxVCrYs+9aSeHI4ZpepP94ax2AvxfobyBG8PtcHiIvz ARA73wJB1yxBUB68yeFthUBay//2py3wxlhfdFBEN4/a+eql7KtkI+cfkQaH6r5bHXln qrpq51VI3zxbDKTxKBHGaRoMmYOq0TWsToU1MOr7Ci8Xu4vYzZiisTxjM2WRSpqccvrW vwwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8VLYEh8tNmkR+3P2pMoFgJHuwjDlhhtxi2b4fJDmOaQ=; b=PdMO2LlWH+Zx00dXKnlFkcfcqUnCwNSWKqxZGbJ/69At8JsoDSdRlmXo7YKxKIwAmf 2Q42EovMZJNdNib7SE2xliVbdbdyc/heNctr8e5Go9ULGr4eWBluaebLgL7TYyzf49tu RB3R2ZO6KTHrgE862+e4lKYGDxWZTozafihUBuiok+ZKWZHYpNTkpQkT6eFU1Fquj18V YnxPPQY2QesL4Jm/cbbsx5VGybfiex8fNZMHZPd8TlHp6iSTpMfGuaAS4jnYwJNlbyDA tPmmPd0163qNhBJ7pytRADDKH68d5r5dzFfq8h4OBb6fLohKrP9f26ixlJYqXuB/t6ZO PGbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=JWZGKICM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mz12-20020a1709071b8c00b007269615d162si18684257ejc.236.2022.07.20.00.43.30; Wed, 20 Jul 2022 00:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=JWZGKICM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239248AbiGTHZQ (ORCPT + 99 others); Wed, 20 Jul 2022 03:25:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236661AbiGTHZM (ORCPT ); Wed, 20 Jul 2022 03:25:12 -0400 Received: from mail-m973.mail.163.com (mail-m973.mail.163.com [123.126.97.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A067225DB; Wed, 20 Jul 2022 00:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=8VLYE h8tNmkR+3P2pMoFgJHuwjDlhhtxi2b4fJDmOaQ=; b=JWZGKICMAP1ueac15+wJ1 GS4WRixvUYk3klf18cawZhFjh6tOttXytsxIERTNwsExgU3k8PgrFW88qnHmYNPk bj4608PPcMRBiSlup8lWQGrX6kVfP+RsPlOO4N44KlifHcYY94UPSLmtfG5wpgo4 wHQL+5b3ci9hT7/3drPtLg= Received: from localhost.localdomain (unknown [112.95.163.118]) by smtp3 (Coremail) with SMTP id G9xpCgB3FZeXrddiwvXTQA--.50S2; Wed, 20 Jul 2022 15:24:18 +0800 (CST) From: LemmyHuang To: edumazet@google.com, davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, LemmyHuang Subject: [PATCH net-next v2] tcp: fix condition for increasing pingpong count Date: Wed, 20 Jul 2022 15:24:04 +0800 Message-Id: <20220720072404.16708-1-hlm3280@163.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: G9xpCgB3FZeXrddiwvXTQA--.50S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7GFWxZFy8Ary7tF1UAF4rGrg_yoWkZFbEkr 4kGrWxJr43JFn29340kw4rXFyUKrZFgF1Fkr13uF93tw1rtF1DurZ5CryfZrn29r4UWryY vwn8KF1jgr12qjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_Tmh5UUUUU== X-Originating-IP: [112.95.163.118] X-CM-SenderInfo: pkopjjiyq6il2tof0z/xtbBogJE+VaEFbRRyAAAs3 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_HZ defaults to 1000Hz and the network transmission time is less than 1ms, lsndtime and lrcvtime are likely to be equal, which will lead to hundreds of interactions before entering pingpong mode. Fixes: 4a41f453bedf ("tcp: change pingpong threshold to 3") Suggested-by: Jakub Kicinski Signed-off-by: LemmyHuang --- v2: * Use !after() wrapping the values. (Jakub Kicinski) v1: https://lore.kernel.org/netdev/20220719130136.11907-1-hlm3280@163.com/ --- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 858a15cc2..c1c95dc40 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -172,7 +172,7 @@ static void tcp_event_data_sent(struct tcp_sock *tp, * and it is a reply for ato after last received packet, * increase pingpong count. */ - if (before(tp->lsndtime, icsk->icsk_ack.lrcvtime) && + if (!after(tp->lsndtime, icsk->icsk_ack.lrcvtime) && (u32)(now - icsk->icsk_ack.lrcvtime) < icsk->icsk_ack.ato) inet_csk_inc_pingpong_cnt(sk); -- 2.27.0