From owner-freebsd-hackers@freebsd.org Sat Oct 31 15:06:54 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D272944DFE1; Sat, 31 Oct 2020 15:06:54 +0000 (UTC) (envelope-from carbaecker@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CNjFT6cWyz4Xbb; Sat, 31 Oct 2020 15:06:53 +0000 (UTC) (envelope-from carbaecker@gmx.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1604156802; bh=482RM7wq/s9Y12NSPdqiuyX4SCJSN7MpqI2sHzzX1c0=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=jDSDhehnsM1Kr1hL+/zPoOnjVaiITi/qT/1mYNGBFQ5vODkRHqpxObVwJiUXhkQnr uBrx6lt55r3oOvsY0ld/qYK+9ViEGpJl7mVq8WmleGY4VBkv6j9liqRFg9PLJVVR8o CDu6Z3FoFEKVCJ/OEzTCuE9TavZ1UHYKLyfmVnXE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.30] ([94.31.96.148]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MzyuS-1kCNVM0PA6-00x5AZ; Sat, 31 Oct 2020 16:06:42 +0100 Subject: Re: Problem with checksum offloading on RPi3 (PF + Jails involved) To: Kristof Provost , John-Mark Gurney Cc: freebsd-hackers@freebsd.org, freebsd-arm@freebsd.org References: <748edc3d-4ef7-c4de-291f-7c0b460a6052@gmx.de> <5130ee46-5832-d4df-d774-c6bd32e10b30@gmx.de> <20201029213622.GM31099@funkthat.com> <55713894-A896-4F12-ABB9-93DFEB2F16B9@FreeBSD.org> From: =?UTF-8?Q?Carsten_B=c3=a4cker?= Message-ID: Date: Sat, 31 Oct 2020 16:06:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <55713894-A896-4F12-ABB9-93DFEB2F16B9@FreeBSD.org> Content-Type: multipart/mixed; boundary="------------582D89986A452AA4BF8553AD" Content-Language: de-DE X-Provags-ID: V03:K1:P+b+KS5KmYqRojrnE8eLHhKAKtLXl5XfdPbEAuRr1v3dp0ncIGe SBf2vOGMwD2L5aJ4aNDXAO6mXASSrhF4oWig9BojpBBKzuSzffmR0SL/Ml5w8FMQ+eO3ZlB uYn/EE4wOx2YuHvJ02ypKSB3mF9wFOCp3gFoeFL5MPN3+TgDMH9TCoseiGGmsS5PO5rRKEe atxpOZSEKVG5i1LqAX+5Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:D7CBfDliZk4=:ra8Wqrul96RKOHKDwXX6KF 6aaBZJEvPlAc2tV8HOSNtzmpYp9AIY8QiI4zkUsA5MRcEhPG5tsT4zEGdPduImQt4noYIf51j 5XVWhHJOotKf6iGcOrnddy9N0PkusnU3FmEcy/ZFJdhkyAg+y3CxxRlDUji1kha+T8V6klBXF 6/REnsHMpRIJg/1c/rk1SEM2kiY2jtlSMt+ISdy/7f/fHQPBdUIS16nQ8YdBrqx0c7DGfXtMn SMVjHF2cE4+7j/+mocbimmko9ahCwywNkABAwBFVtBeS33JMPzlAISFVu+b3PnQxoQfYJZnph O9ClXopGug3fBEKf4c1jtkOUKDiurWEbDkytn6xVM5sVKqsBStN334dN3xOPpqgBR9YTk4C60 T7nMZyT3sS7Mnr6gM8TqrN1FXaPqZTLAG7LMTtrU2XQCsbONEqG9OMz+0rLfB+KnASCKxJdCt Sfc0Bm0rS7/03BgYqOicq8pPNDSv10Fq9+Fr3A8+/TROOs1JJDiI6fdj8M1Wdy7G4isf1kSAq DU+dhXvF6cQVnFqRXKMt9uAUlTpVTAQyDfGAdeK+RRKHaRTtAOkjpoJZqzvTfjWmPCsac9Cdq jlOaFr/MHxpDEQ83UHoTeD9ZPONOGDpogbltSBk4EgrrsCkt7iO7KRzGSJInASbfdqvyM2r0o NriWSsQMp2y6zD+tc21ZiIlXJZoSpC5CMz+KJTVTUJZWNpS/btkMOdlXhrT+wczW7lkTxAF+o ax5pwkdAlyFmo13fZEWKl+U42/sqIxzdkxwuUNlbM0T5rJ4k41s2nWfJ+poZlNhKqHg5OMVwr umiOvqx2hbxqnNF2bLIHo8Q28szlq3PBsWcIoprzksQf5EOC7C9MFouvsjYCDz2gQiKR5Iuda xR5zBHbOTGo1SemtUz1A== X-Rspamd-Queue-Id: 4CNjFT6cWyz4Xbb X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=jDSDhehn; dmarc=none; spf=pass (mx1.freebsd.org: domain of carbaecker@gmx.de designates 212.227.15.15 as permitted sender) smtp.mailfrom=carbaecker@gmx.de X-Spamd-Result: default: False [-2.73 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmx.de]; R_SPF_ALLOW(-0.20)[+ip4:212.227.15.0/25]; HAS_ATTACHMENT(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; NEURAL_HAM_SHORT(-0.09)[-0.086]; RECEIVED_SPAMHAUS_PBL(0.00)[94.31.96.148:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmx.de]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.03)[-1.025]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; RCVD_IN_DNSWL_LOW(-0.10)[212.227.15.15:from]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.02)[-1.017]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[gmx.de]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.15.15:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers,freebsd-arm] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Oct 2020 15:06:54 -0000 This is a multi-part message in MIME format. --------------582D89986A452AA4BF8553AD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Am 29.10.2020 um 22:39 schrieb Kristof Provost: > > On 29 Oct 2020, at 22:36, John-Mark Gurney wrote: > > Kristof Provost wrote this message on Thu, Oct 29, 2020 at 21:30 > +0100: > > On 29 Oct 2020, at 16:30, Carsten B=C3=A4cker wrote: > > Sure, i am willing to help. > > Device is a Raspberry Pi 3B (not +), using the > onboard-ethernet. > I attached a bunch of information. > > Configuration is stripped down to the minimum required to > reproduce > the > problem. > > Okay, so that???s an SMC2 LAN9514_ETH device. > That???s the dev/usb/net/if_smsc.c driver. > > However, before we dig into that driver we should make sure > that we???re > really looking at a checksum problem. > It???s entirely normal for TX checksums to be incorrect when > logged on > the sending host itself (if the hardware does checksum > offloading the > checksum in the packet sent to the MAC is incorrect, and left > to the > hardware to fix). > > So, can you confirm that the `"[bad udp cksum 0xe58a -> > 0x482d!]` you > reported was on an inbound packet? And let???s be safe: try to > capture > packets on a different machine. That???ll give us the true > packet, after > the hardware has done checksum calculations. > > One interesting point is that the smsc driver claims to not do TX > offload, > and a brief check shows that it doesn't allow a user to set the > TXCSUM. > > It does seem to do RX offload, and the comments in the driver suggest > some .. ahem, creative hardware behaviour: > > |/* The checksum appears to be simplistically calculated * over the > udp/tcp header and data up to the end of the * eth frame. Which means > if the eth frame is padded * the csum calculation is incorrectly > performed over * the padding bytes as well. Therefore to be safe we * > ignore the H/W csum on frames less than or equal to * 64 bytes. * * > Ignore H/W csum for non-IPv4 packets. */ | > > It=E2=80=99s not impossible that there=E2=80=99s some more issues like t= hat in the > hardware, or even that there are different chip revisions out there. > > That also matches up with |ifconfig ue0 -rxcsum| fixing things. > > Best regards, > Kristof > Hello again, just gave it another try, using "ping heise.de" (twice) from within the jail. This is the output of tcpdump: # tcpdump -i pflog0 -vv tcpdump: listening on pflog0, link-type PFLOG (OpenBSD pflog file), capture size 262144 bytes 14:06:04.293996 IP (tos 0x0, ttl 64, id 19576, offset 0, flags [none], proto UDP (17), length 54) =C2=A0=C2=A0=C2=A0 PC-192-168-178-3.fritz.box.52421 > fritz.box.domain: [= bad udp cksum 0xe589 -> 0x0a2c!] 64654+ A? heise.de. (26) Netstat: # netstat -s -p udp | grep checksum =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 4 with bad checksum =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0 with no checksum Packet-capture from the router is attached. Best regards, Carsten --------------582D89986A452AA4BF8553AD Content-Type: application/octet-stream; name="rxcsum.pcap" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="rxcsum.pcap" NM2yoQIABAAAAAAAAAAAAAAIAABpAAAAinydXzNVBwBeAAAAXgAAAAAAAAAAAAAAiAMsAOAo beXM8obHpkdLw+AobeXM72A0uCfrVX5wAACqqgMAAAAIAEUAADZ8AAAAQBEZYcCosgPAqLIB 0iUANQAiIdHfiQEAAAEAAAAAAAAFaGVpc2UCZGUAAAEAAYp8nV/7XAcAbgAAAG4AAAAAAAAA AAAAAIgDMAGGx6ZHS8PgKG3lzPK4J+tVfnDAXOAobeXM7wAAqqoDAAAACABFAABGOBAAAEAR XUHAqLIBwKiyAwA10iUAMmdi34mBgAABAAEAAAAABWhlaXNlAmRlAAABAAHADAABAAEAASgF AATBY5BQ --------------582D89986A452AA4BF8553AD--