From patchwork Mon Sep 9 22:27:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Kshevetskiy X-Patchwork-Id: 1982845 X-Patchwork-Delegate: rfried.dev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=iopsys.eu header.i=@iopsys.eu header.a=rsa-sha256 header.s=selector2 header.b=C0ksSpck; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X2hMV10M0z1y1C for ; Tue, 10 Sep 2024 08:29:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 45D9E88EA8; Tue, 10 Sep 2024 00:27:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=iopsys.eu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=iopsys.eu header.i=@iopsys.eu header.b="C0ksSpck"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B14D688E56; Tue, 10 Sep 2024 00:27:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2072b.outbound.protection.outlook.com [IPv6:2a01:111:f403:260d::72b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AA6D188E65 for ; Tue, 10 Sep 2024 00:27:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=iopsys.eu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mikhail.kshevetskiy@genexis.eu ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i5oADnLRajWCC5qXd7zEl9YVV07190vwX9pahGTLz9O/45ZCJs8zCVRzeiyC1fw+CXbcHOaHwaQhicaL+3Q3nC/Vr5afe+s2P7ZIH7BjOdA268KLGxB16/qXlFj2yyBa5YQWhVipGkD8fFHnzOqusb8bsDMbEthmwkaVaRzB32QTsCmjDngiJskznFLUq4xMErYJFlBZJQpxJIam6BOKps2wvb83eahpy+bV7mAA+WqB9a+1ShNL0oYROYGc8m4xSy8hMwSuSyxv/ZHWjRW1j/A2fkcb0LcjAMW2UyogNOdNrdx8eZh4TGedHecn0qL86P6IQYsLpm10+Cu0UTNLYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Tyz16sydUguFVlbMeIIs7ru3vxXPlzW+bD4+XKxcy8I=; b=KPZT6SXCyx9jg/mTovPzS7aLR3OS50ZxtdNN3cvsxzg1+QvIW30SaSBWIeV7uS4F1eqYCydxwCCASMHYUWKEE8iW30xvOW1IYwZTYQ5AhcMg97gCSMcBJV3mPyTlLsaobqpOYQir1C/W/pmsZ148DS3nXKi7nK61+hCES+ScYayswoAPT+s21rdI/pag3nGxz3NCFtUxuPhECjf8sSrIQa9Rlk2SZjh0lk/XPNaA7DgMeCrWllz2CEq5ITk6fU1hseVABa9x8GHu7nZ8nm/Ue+L2uuQVS4GXNuJkMzOOAT8S+nUg2ywZO1RdQcXCalkv1SDMvHJipGv2RY0zbd2sqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=genexis.eu; dmarc=pass action=none header.from=iopsys.eu; dkim=pass header.d=iopsys.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iopsys.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Tyz16sydUguFVlbMeIIs7ru3vxXPlzW+bD4+XKxcy8I=; b=C0ksSpckJyt2RqVSSoigDaKd3vN8guR9qRQ0ayyxxDokx1tbW28bKsmEV9yW61mEo7BmCUiX6RWaUj1hBo9Q2Tr1NZZYtuFVy2BEg8unggcPFHmLXR6J6SEQHt4W+GZMR1cqw5ycWpumBrGKc9bcMbSr/6zQQmhGrFSmcEy42hMN6hDU5ZC1VHIC+sZnbs7GbXHSa0rPbWgagufUgdupY68LpG8XnD1yQ4NyiU0UxYwq/YMpMv5AqDG9EQ1gpzia0+18gDbcCHJpFBJoTmQoZWKB2y5i648mxNrtcRKyg8fb5tR0sDfrvL7tEqBjTIYgB5PM0fuqFCQNr2K4E8NCtQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=iopsys.eu; Received: from GV2PR08MB8121.eurprd08.prod.outlook.com (2603:10a6:150:7d::22) by DB9PR08MB8722.eurprd08.prod.outlook.com (2603:10a6:10:3d2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.15; Mon, 9 Sep 2024 22:27:42 +0000 Received: from GV2PR08MB8121.eurprd08.prod.outlook.com ([fe80::4cd3:da80:2532:daa0]) by GV2PR08MB8121.eurprd08.prod.outlook.com ([fe80::4cd3:da80:2532:daa0%2]) with mapi id 15.20.7962.014; Mon, 9 Sep 2024 22:27:42 +0000 From: Mikhail Kshevetskiy To: Simon Glass , Tom Rini , Joe Hershberger , Ramon Fried , Mattijs Korpershoek , Heinrich Schuchardt , AKASHI Takahiro , Michal Simek , Francis Laniel , Anand Moon , Marek Vasut , Ilias Apalodimas , Masahisa Kojima , Sean Anderson , Baruch Siach , Yasuharu Shibata , Richard Weinberger , Mikhail Kshevetskiy , u-boot@lists.denx.de Subject: [PATCH v6 09/12] net/tcp: define a fallback value for rcv_wnd size Date: Tue, 10 Sep 2024 01:27:17 +0300 Message-ID: <20240909222720.2563118-10-mikhail.kshevetskiy@iopsys.eu> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240909222720.2563118-1-mikhail.kshevetskiy@iopsys.eu> References: <20240909222720.2563118-1-mikhail.kshevetskiy@iopsys.eu> X-ClientProxiedBy: FR0P281CA0178.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b4::6) To GV2PR08MB8121.eurprd08.prod.outlook.com (2603:10a6:150:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV2PR08MB8121:EE_|DB9PR08MB8722:EE_ X-MS-Office365-Filtering-Correlation-Id: a0b32b8d-5f5b-4ad5-4c4a-08dcd11e9eae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|7416014|52116014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: kqQGj/eShQaDkvb27eP+MeHYXf4cTzFBv7eZClQyL/9bPXq9sVcBnE15XyxsBsbuzvQpchSpY8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bUDPXjpfekaBBYKTvD6RX5LpSYVxk+ji2Hi7FKkzh62ycWqAiVyFStndddej3DCcSYE5YaYeNr9uAkbGdnIKUrfGaMG2BRKlX39OmT1tZ+0+YOFMvHVEG3vOcG3f8DMh03q62Em9QKeqvNwJN8hKAc6UWwwKxL/h93natfRu26n0Hh/VNoHkZKnfUhIe8RsQegVdmW0/LFQ0tmk500S+2Q69G7pjL9hJgqQJ0z6cjuv+3r3ltwCeiWwT6LxajNzFXpAEmVvVp8v/L8pMh6+9miboAa7yaqClzleTM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV2PR08MB8121.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014)(921020); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x9fWgfzog8y+0lasTTVBs3RnVbLtnx3sio8odu8uaVqS7d7o1h2SvhXxfq3BSD/iL4Od9nVaoKeS/yvJsF/ZZfWs8RLUSB8Dl/kAGULkA6EVsiKkOc+wAO0tWQ2xUKS+gEAw/UQMboG+Tx+UzZn1VG9uvvHAq6FPAnp2GCSAi1tUZTIQ3F5QuX93M0IRxwcV9RAGt63swmhvuDP62DX6tVHiq0/czta5YtxstIUXv/VGKwzbxcfUfXDaSa4e/5+I+/ReiY5iM3te329Clrk4IdODTv3Mk5arlAf46B+8y+IY6WqCpKP361xiC/IN5QcqwmNpdwW0oNsutOguvdf9RaLYPmWjv+M5pp7rKGymoF+4Uu5+A1acQyXsIad+oJ/XBkIDExDsxYgW2hrpQPuljEE68XTqBntpVTmUeTCSWOorCMeZOAEoMoqpOKJOlK95jievxV7BlVANXpvwR3aLmWpw2l5C2euM+HKTauHNPxUIYlHXqodw1yBbU8RxEjI0bhnDOtduzsnzmqyknl6itGj1d37nAOxuzOf8ka5E0X0tvh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MS-Exchange-CrossTenant-Network-Message-Id: a0b32b8d-5f5b-4ad5-4c4a-08dcd11e9eae X-MS-Exchange-CrossTenant-AuthSource: GV2PR08MB8121.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2024 22:27:42.2864 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8d891be1-7bce-4216-9a99-bee9de02ba58 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2RYTNY4cW3BjAu4d3LHHGvzjlV6ZldtAYvLVdlLgvAdA80Aip6klG3JUIeqjGSjtWYFguvp/e+kSbxdV5i+ziNbgqWXmTeANXZJuIngVssE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8722 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Some driver implements it's own network packet pool, so PKTBUFSRX is zero. This results in zero-size TCP receive window, so data transfer doesn't work. Avoid it by setting a reasonable fallback value. Signed-off-by: Mikhail Kshevetskiy Reviewed-by: Simon Glass --- net/tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/tcp.c b/net/tcp.c index 0778c153aca..32ee1fe03ce 100644 --- a/net/tcp.c +++ b/net/tcp.c @@ -36,7 +36,11 @@ #define TCP_SEND_RETRY 3 #define TCP_SEND_TIMEOUT 2000UL #define TCP_RX_INACTIVE_TIMEOUT 30000UL -#define TCP_RCV_WND_SIZE (PKTBUFSRX * TCP_MSS) +#if PKTBUFSRX != 0 + #define TCP_RCV_WND_SIZE (PKTBUFSRX * TCP_MSS) +#else + #define TCP_RCV_WND_SIZE (4 * TCP_MSS) +#endif #define TCP_PACKET_OK 0 #define TCP_PACKET_DROP 1