From nobody Fri Oct 21 18:16:21 2022 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MvCMy1qnnz4gPJn for ; Fri, 21 Oct 2022 18:16:30 +0000 (UTC) (envelope-from michael.tuexen@lurchi.franken.de) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MvCMw3rKgz3G9Q for ; Fri, 21 Oct 2022 18:16:28 +0000 (UTC) (envelope-from michael.tuexen@lurchi.franken.de) Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1140:c3d:d1d1:9573:4f4c:5fac]) (Authenticated sender: lurchi) by mail-n.franken.de (Postfix) with ESMTPSA id 090097062B1AE; Fri, 21 Oct 2022 20:16:21 +0200 (CEST) Content-Type: text/plain; charset=us-ascii List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: Too aggressive TCP ACKs From: Michael Tuexen In-Reply-To: <62A0DD30-B3ED-48BE-9C01-146487599092@gmail.com> Date: Fri, 21 Oct 2022 20:16:21 +0200 Cc: freebsd-net@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0FED34A9-D093-442A-83B7-08C06D11F8B5@lurchi.franken.de> References: <75D35F36-7759-4168-ADBA-C2414F5B53BC@gmail.com> <712641B3-5196-40CC-9B64-04637F16F649@lurchi.franken.de> <62A0DD30-B3ED-48BE-9C01-146487599092@gmail.com> To: Zhenlei Huang X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4MvCMw3rKgz3G9Q X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of michael.tuexen@lurchi.franken.de has no SPF policy when checking 193.175.24.27) smtp.mailfrom=michael.tuexen@lurchi.franken.de X-Spamd-Result: default: False [-1.70 / 15.00]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; MV_CASE(0.50)[]; RCVD_IN_DNSWL_LOW(-0.10)[193.175.24.27:from]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:680, ipnet:193.174.0.0/15, country:DE]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TAGGED_RCPT(0.00)[]; TO_DN_SOME(0.00)[]; DMARC_NA(0.00)[franken.de]; RCVD_VIA_SMTP_AUTH(0.00)[] X-ThisMailContainsUnwantedMimeParts: N > On 21. Oct 2022, at 17:00, Zhenlei Huang wrote: >=20 >=20 >> On Oct 21, 2022, at 10:34 PM, Michael Tuexen = wrote: >>=20 >>> On 21. Oct 2022, at 16:19, Zhenlei Huang = wrote: >>>=20 >>> Hi, >>>=20 >>> While I was repeating = https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258755, I observed a >>> strange behavior. The TCP ACKs from FreeBSD host are too aggressive. >>>=20 >>> My setup is simple: >>> A B >>> [ MacOS ] <=3D=3D=3D=3D> [ FreeBSD VM ] >>> 192.168.120.1 192.168.12.134 (disable tso and lro) >>> While A <--- B, i.e. A as server and B as client, the packets rate = looks good. >>>=20 >>> One session on B: >>>=20 >>> root@:~ # iperf3 -c 192.168.120.1 -b 10m >>> Connecting to host 192.168.120.1, port 5201 >>> [ 5] local 192.168.120.134 port 54459 connected to 192.168.120.1 = port 5201 >>> [ ID] Interval Transfer Bitrate Retr Cwnd >>> [ 5] 0.00-1.00 sec 1.25 MBytes 10.5 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 1.00-2.00 sec 1.25 MBytes 10.5 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 2.00-3.00 sec 1.12 MBytes 9.44 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 3.00-4.00 sec 1.25 MBytes 10.5 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 4.00-5.00 sec 1.12 MBytes 9.44 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 5.00-6.00 sec 1.25 MBytes 10.5 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 6.00-7.00 sec 1.12 MBytes 9.44 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 7.00-8.00 sec 1.25 MBytes 10.5 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 8.00-9.00 sec 1.12 MBytes 9.44 Mbits/sec 0 257 = KBytes =20 >>> [ 5] 9.00-10.00 sec 1.25 MBytes 10.5 Mbits/sec 0 257 = KBytes =20 >>> - - - - - - - - - - - - - - - - - - - - - - - - - >>> [ ID] Interval Transfer Bitrate Retr >>> [ 5] 0.00-10.00 sec 12.0 MBytes 10.1 Mbits/sec 0 = sender >>> [ 5] 0.00-10.00 sec 12.0 MBytes 10.1 Mbits/sec = receiver >>>=20 >>> iperf Done. >>>=20 >>> Another session on B: >>>=20 >>> root@:~ # netstat -w 1 -I vmx0 >>> input vmx0 output >>> packets errs idrops bytes packets errs bytes colls >>> 0 0 0 0 0 0 0 0 >>> 0 0 0 0 0 0 0 0 >>> 342 0 0 22600 526 0 775724 0 >>> 150 0 0 9900 851 0 1281454 0 >>> 109 0 0 7194 901 0 1357850 0 >>> 126 0 0 8316 828 0 1246632 0 >>> 122 0 0 8052 910 0 1370780 0 >>> 109 0 0 7194 819 0 1233702 0 >>> 120 0 0 7920 910 0 1370780 0 >>> 110 0 0 7260 819 0 1233702 0 >>> 123 0 0 8118 910 0 1370780 0 >>> 109 0 0 7194 819 0 1233702 0 >>> 73 0 0 5088 465 0 686342 0 >>> 0 0 0 0 0 0 0 0 >>> 0 0 0 0 0 0 0 0 >>>=20 >>>=20 >>>=20 >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>>=20 >>>=20 >>> While A ---> B, i.e. A as client and B as server, the ACKs sent from = B looks strange. >>>=20 >>> Session on A: >>>=20 >>> % iperf3 -c 192.168.120.134 -b 10m >>> Connecting to host 192.168.120.134, port 5201 >>> [ 5] local 192.168.120.1 port 52370 connected to 192.168.120.134 = port 5201 >>> [ ID] Interval Transfer Bitrate >>> [ 5] 0.00-1.00 sec 1.25 MBytes 10.5 Mbits/sec = =20 >>> [ 5] 1.00-2.00 sec 1.25 MBytes 10.5 Mbits/sec = =20 >>> [ 5] 2.00-3.00 sec 1.12 MBytes 9.44 Mbits/sec = =20 >>> [ 5] 3.00-4.00 sec 1.25 MBytes 10.5 Mbits/sec = =20 >>> [ 5] 4.00-5.00 sec 1.12 MBytes 9.44 Mbits/sec = =20 >>> [ 5] 5.00-6.00 sec 1.25 MBytes 10.5 Mbits/sec = =20 >>> [ 5] 6.00-7.00 sec 1.12 MBytes 9.44 Mbits/sec = =20 >>> [ 5] 7.00-8.00 sec 1.25 MBytes 10.5 Mbits/sec = =20 >>> [ 5] 8.00-9.00 sec 1.12 MBytes 9.44 Mbits/sec = =20 >>> [ 5] 9.00-10.00 sec 1.25 MBytes 10.5 Mbits/sec = =20 >>> - - - - - - - - - - - - - - - - - - - - - - - - - >>> [ ID] Interval Transfer Bitrate >>> [ 5] 0.00-10.00 sec 12.0 MBytes 10.1 Mbits/sec = sender >>> [ 5] 0.00-10.00 sec 12.0 MBytes 10.1 Mbits/sec = receiver >>>=20 >>> iperf Done. >>>=20 >>> Session on B: >>>=20 >>> root@:~ # netstat -w 1 -I vmx0 >>> input vmx0 output >>> packets errs idrops bytes packets errs bytes colls >>> 0 0 0 0 0 0 0 0 >>> 0 0 0 0 0 0 0 0 >>> 649 0 0 960562 330 0 21800 0 >>> 819 0 0 1233702 415 0 27390 0 >>> 910 0 0 1370780 459 0 30294 0 >>> 819 0 0 1233702 415 0 27390 0 >>> 910 0 0 1370780 459 0 30294 0 >>> 910 0 0 1370780 460 0 30360 0 >>> 819 0 0 1233702 414 0 27324 0 >>> 910 0 0 1370780 460 0 30360 0 >>> 819 0 0 1233702 414 0 27324 0 >>> 910 0 0 1370780 460 0 30360 0 >>> 285 0 0 412287 147 0 9981 0 >>> 0 0 0 0 0 0 0 0 >>> 0 0 0 0 0 0 0 0 >>> 0 0 0 0 0 0 0 0 >>>=20 >>>=20 >>> The ACK packets replied from B (the FreeBSD VM) are too aggressive. = They are >>> about one half of TCP packets received from A. >>>=20 >>> I've tested with different bitrates, from 10m to 300m, all behave = the same. >>> Tested with baremetal FreeBSD 13.1 Box as B (with intel em driver), = the=20 >>> bitrates is 1g, also behaves the same. >>>=20 >>> Also tried different FreeBSD versions, 11.4, 12.3, stable/13 and = current/14 all=20 >>> behave the same. >>>=20 >>>=20 >>> My question is, is that the expected behavior of current default TCP = stack? >> That is what I would expect. TCP (on FreeBSD) is acking every other = packet. This >> is also what is specified. MacOS, at least newer versions, send less = ACKs. > Thanks for fast response! >=20 > My have old memories about SACK which helps TCP performance. This = behavior > seems odd from my mind. But those memories date back to 2008, that is = 14 years ago. I don't think anything has changed since then from a specification point = of view >=20 > The current implementation of TCP stack in FreeBSD head is too = complexed for me. > Can you please point me the RFCs specifying this? So I can start over = with a quick glue. Send an ACK for every other frame if everything is OK, send it = immediately if there are some gaps: https://datatracker.ietf.org/doc/html/rfc9293#section-3.8.6.3 This applies also to the case where you use SACK. Best regards Michael >=20 > Thanks! >>=20 >> Best regards >> Michael >>>=20 >>>=20 >>>=20 >>> Best regards, >>> Zhenlei >=20