Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Nov 2020 05:38:38 +0100
From:      =?UTF-8?Q?Carsten_B=c3=a4cker?= <carbaecker@gmx.de>
To:        YongHyeon PYUN <pyunyh@gmail.com>
Cc:        Hans Petter Selasky <hps@selasky.org>, Kristof Provost <kp@FreeBSD.org>, freebsd-arm@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: Problem with checksum offloading on RPi3 (PF + Jails involved)
Message-ID:  <e302db94-2d16-ae06-ee76-444ac88c7c57@gmx.de>
In-Reply-To: <20201117030406.GA45158@michelle>
References:  <5130ee46-5832-d4df-d774-c6bd32e10b30@gmx.de> <A3890336-BE8F-438C-8C3E-7B21FB729FCA@FreeBSD.org> <20201029213622.GM31099@funkthat.com> <55713894-A896-4F12-ABB9-93DFEB2F16B9@FreeBSD.org> <20201103045215.GA2524@michelle> <46d08198-530c-cb4b-efa8-4edaf89471c1@selasky.org> <4dfaa9a3-c085-8466-a6e4-19f988b5ed3d@selasky.org> <e43b42e0-80fe-847a-f1bc-025b6914f98a@gmx.de> <20201116011910.GB1941@michelle> <1245cbe5-9d2f-4808-f989-569ae7d57a8a@gmx.de> <20201117030406.GA45158@michelle>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------05F385D1AB609A11B19CC179
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Am 17.11.2020 um 04:04 schrieb YongHyeon PYUN:
> On Mon, Nov 16, 2020 at 12:54:25PM +0100, Carsten B=C3=A4cker wrote:
>
> [...]
>
>> i just did a test with your modification.
>> The good news is that the driver itself still works.
> Your test indicates my approach to improve RX validation works.
> Thanks a lot for testing.
>
>> The bad news is that it doesn't solve the problem. :-(
>>
> Let's dig further.  Initially I thought pf(4) could be confused by
> mismatch of received packet length and IP datagram length.  H/W
> does not strip padding bytes for short frame(< 60 bytes) and adds
> FCS bytes such that the minimum ethernet frame length is 64 bytes.
> When RX checksum offloading is enabled, the size will be 66 bytes.
> My patch tried to correct wrong packet length stored in mbuf.
>
> I think simple nping test would be helpful to narrow down the issue
> here. nping is bundled with nmap(ports/security/nmap).
>
> o Test patched smsc(4) with/without pf(4).
>   - Disable RX checksum offloading and make sure all works as
>     expected.
>   - Run the following command on other system and see whether you
>     can get ICMP port unreachable message from a box with smsc(4).
>     5555 is port number that listens on incoming UDP datagrams.
>      #nping -c 1 --udp -p 5555 IPv4_addr_of_remote_host_with_smsc(4)
>
>      #nping -c 1 --udp -p 5555 --data-length 100 IPv4_addr_of_remote_hos=
t_with_smsc(4)
>
>   - Repeat the same test with RX checksum offloading enabled.
>
> If there is RX checksum mismatch you wouldn't get ICMP port
> unreachable message.  You can even generate wrong checksummed UDP
> datagrams with --badsum option like the following.
> #nping -c 1 --udp -p 5555 --badsum IPv4_addr_of_remote_host_with_smsc(4)
>
>> I used the snapshot from 2020-10-29 as i already had an sdcard with tha=
t
>> image.
>> http://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/13.0/
>>
>> Kernel was build from head + your patch.
>> FreeBSD generic 13.0-CURRENT FreeBSD 13.0-CURRENT #1 r367714M: Mon Nov
>> 16 08:03:24 UTC 2020
>> root@sysbuild:/usr/obj/usr/src_head/arm64.aarch64/sys/GENERIC arm64
>>
>> Log from smsc is attached.
>>
> The log shows my assumption on RX packet layout is correct.
> Thanks.
>
>> As the lack of hardware seems to be a problem... i may be able to
>> provide temporary access, incl. serial using a 2nd pi - but this will
>> take some time as i need to change the network-setup.
>>
> I think it's better to share nping test result first.

Hello,

i attached another set of log-files containing the output of the test
using nping.
The ICMP port unreachable message appeared in each case, but the paket
loss changed to 100%.

In addition i repeated the test with RXCSUM enabled after switching back
to the unpatched kernel.
Not sure if this helps.

Regards,
Carsten









--------------05F385D1AB609A11B19CC179
Content-Type: text/plain; charset=UTF-8;
 name="nping_rxcsum_off.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="nping_rxcsum_off.txt"

cm9vdEBnZW5lcm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TEtMTcgMDU6MTUgQ0VUClNFTlQgKDAuMDA1MHMpIFVE
UCAxOTIuMTY4LjE3OC4yOTo1MyA+IDE5Mi4xNjguMTc4LjM6NTU1NSB0dGw9NjQgaWQ9NDA1
NzIgaXBsZW49MjgKCk1heCBydHQ6IE4vQSB8IE1pbiBydHQ6IE4vQSB8IEF2ZyBydHQ6IE4v
QQpSYXcgcGFja2V0cyBzZW50OiAxICgyOEIpIHwgUmN2ZDogMCAoMEIpIHwgTG9zdDogMSAo
MTAwLjAwJSkKTnBpbmcgZG9uZTogMSBJUCBhZGRyZXNzIHBpbmdlZCBpbiAxLjA0IHNlY29u
ZHMK
--------------05F385D1AB609A11B19CC179
Content-Type: text/plain; charset=UTF-8;
 name="nping_rxcsum_on.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="nping_rxcsum_on.txt"

cm9vdEBnZW5lcmljOn4gIyBwZmN0bCAtc1IgOyBlY2hvIDsgaWZjb25maWcgdWUwCkRpc2Fi
bGVkCgp1ZTA6IGZsYWdzPTg4NDM8VVAsQlJPQURDQVNULFJVTk5JTkcsU0lNUExFWCxNVUxU
SUNBU1Q+IG1ldHJpYyAwIG10dSAxNTAwCiAgICAgICAgb3B0aW9ucz04MDAwOTxSWENTVU0s
VkxBTl9NVFUsTElOS1NUQVRFPgogICAgICAgIGV0aGVyIGI4OjI3OmViOjU1OjdlOjcwCiAg
ICAgICAgaW5ldCAxOTIuMTY4LjE3OC4zIG5ldG1hc2sgMHhmZmZmZmYwMCBicm9hZGNhc3Qg
MTkyLjE2OC4xNzguMjU1CiAgICAgICAgbWVkaWE6IEV0aGVybmV0IGF1dG9zZWxlY3QgKDEw
MGJhc2VUWCA8ZnVsbC1kdXBsZXg+KQogICAgICAgIHN0YXR1czogYWN0aXZlCiAgICAgICAg
bmQ2IG9wdGlvbnM9Mjk8UEVSRk9STU5VRCxJRkRJU0FCTEVELEFVVE9fTElOS0xPQ0FMPgoK
LS0tCnJvb3RAdGVzdC1hbW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OSBQb3J0IDU1NTUgdW5yZWFj
aGFibGUgKHR5cGU9My9jb2RlPTMpIF0gSVAgW3R0bD02NCBpZD01NTU0MCBpcGxlbj0xNTYg
XQoKTWF4IHJ0dDogMC43OTltcyB8IE1pbiBydHQ6IDAuNzk5bXMgfCBBdmcgcnR0OiAwLjc5
OW1zClJhdyBwYWNrZXRzIHNlbnQ6IDEgKDEyOEIpIHwgUmN2ZDogMSAoMTU2QikgfCBMb3N0
OiAwICgwLjAwJSkKTnBpbmcgZG9uZTogMSBJUCBhZGRyZXNzIHBpbmdlZCBpbiAxLjA2IHNl
Y29uZHMKCi0tLQpyb290QHRlc3QtYW1kNjQ6fiAjIG5waW5nIC1jIDEgLS11ZHAgLXAgNTU1
NSAtLWJhZHN1bSAxOTIuMTY4LjE3OC4zCgpTdGFydGluZyBOcGluZyAwLjcuODAgKCBodHRw
czovL25tYXAub3JnL25waW5nICkgYXQgMjAyMC0xMS0xNyAwNToxOCBDRVQKU0VOVCAoMC4w
MDUwcykgVURQIDE5Mi4xNjguMTc4LjI5OjUzID4gMTkyLjE2OC4xNzguMzo1NTU1IHR0bD02
NCBpZD05Mzg0IGlwbGVuPTI4CgpNYXggcnR0OiBOL0EgfCBNaW4gcnR0OiBOL0EgfCBBdmcg
cnR0OiBOL0EKUmF3IHBhY2tldHMgc2VudDogMSAoMjhCKSB8IFJjdmQ6IDAgKDBCKSB8IExv
c3Q6IDEgKDEwMC4wMCUpCk5waW5nIGRvbmU6IDEgSVAgYWRkcmVzcyBwaW5nZWQgaW4gMS4w
NyBzZWNvbmRzCg==
--------------05F385D1AB609A11B19CC179
Content-Type: text/plain; charset=UTF-8;
 name="nping_rxcsum_on_head.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="nping_rxcsum_on_head.txt"

cm9vdEBnZW5lcmljOn4gIyB1bmFtZSAtYQpGcmVlQlNEIGdlbmVyaWMgMTMuMC1DVVJSRU5U
IEZyZWVCU0QgMTMuMC1DVVJSRU5UICMw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lc3MgcGluZ2VkIGluIDEuMDUg
c2Vjb25kcwoKLS0tCnJvb3RAdGVzdC1hbWQ2NDp+ICMgbnBpbmcgLWMgMSAtLXVkcCAtcCA1
NTU1IC0tYmFkc3VtIDE5Mi4xNjguMTc4LjMKClN0YXJ0aW5nIE5waW5nIDAuNy44MCAoIGh0
dHBzOi8vbm1hcC5vcmcvbnBpbmcgKSBhdCAyMDIwLTExLTE3IDA1OjI0IENFVApTRU5UICgw
LjAwNTBzKSBVRFAgMTkyLjE2OC4xNzguMjk6NTMgPiAxOTIuMTY4LjE3OC4zOjU1NTUgdHRs
PTY0IGlkPTMyMDQ2IGlwbGVuPTI4CgpNYXggcnR0OiBOL0EgfCBNaW4gcnR0OiBOL0EgfCBB
dmcgcnR0OiBOL0EKUmF3IHBhY2tldHMgc2VudDogMSAoMjhCKSB8IFJjdmQ6IDAgKDBCKSB8
IExvc3Q6IDEgKDEwMC4wMCUpCk5waW5nIGRvbmU6IDEgSVAgYWRkcmVzcyBwaW5nZWQgaW4g
MS4wNyBzZWNvbmRzCg==
--------------05F385D1AB609A11B19CC179--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e302db94-2d16-ae06-ee76-444ac88c7c57>