From owner-freebsd-hackers@freebsd.org Tue Nov 17 03:04:11 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 54FB747D343; Tue, 17 Nov 2020 03:04:11 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CZrPl0SzKz3Hq4; Tue, 17 Nov 2020 03:04:10 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by mail-pg1-x530.google.com with SMTP id p68so4589134pga.6; Mon, 16 Nov 2020 19:04:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=YM2ARcgAMzohXhaLuHy5v5RBlHGah6MdJotnzYDAuCk=; b=KoSGMQgTE1JSY0bqmrrYmgFZe4O1iWKeDU2RWBywYH3mlJDJ0jDKMLMO2aYYn6HC/w AaKqNmWtR0NA5+LsjJmDxuXrG44OyEk/fnW0WPGirnAIudaKWLlaBIPG1ZMBR5S25QJE uZOFZAR9jfnHm34157NypZxcCs7YsEk/iiLHJyzdZU/oylIGpfLZXzGf1w/Gj0OiU3Nq 041mYODB23XLRLcetXTTHgO14s6ieSalbxCdyVrGmLsQAmrZMVjbGA7Ntb4TcXOrHVcY Jb/dm8ytakvz/8Ju8e3jxCNWPk/HNdPNJm2BAkW+e1RbYbKPmTn1C368Pp7yCqVmiE8X Qe4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=YM2ARcgAMzohXhaLuHy5v5RBlHGah6MdJotnzYDAuCk=; b=JzOxhf6nuf4q5e6lRUBJBM+hMPPcNPxhvNhI/ePzPbkve8ro/2GO2zcZ9TQNzb4zT1 8i+mcTKz0Lz38dU35NK+vYph85ZFVXAClPgoArF6EOvfSdgtlEjDc5dX6yxwWyEpDka3 QpW+5a8SVsSF3AKZaYxYzzBPV0NrhgLCzAqa988bJiudiNuLLDBihlRxT9/dOtsv8nZ6 ReLcUtu6irtfIiZsG/kK+IKsWnCEHDvUZIotU9tmETQ/wjSm2ePBnwKWQ721lYar3fnj DFJGRiiASQcGyUwATWZHwwbV0zX7vNLNHYsDzcy6s4BGh/ddRrBYv0z/F6P89+j/aZC9 11Kg== X-Gm-Message-State: AOAM532ERNxZvpArstiV4VBBVWZgCtChjaoMZfdnsjiLLL8FwcGnsAtF 3GEQbc2JEU+ePolINaDonVA= X-Google-Smtp-Source: ABdhPJwD4zfamuo2dCkKNAZTXaijPtPmtJJKGYhSU3ZEKVWqWpnQ5NhNKkaNB8gsT12UhfilxO4gJA== X-Received: by 2002:a17:90a:890a:: with SMTP id u10mr2353084pjn.88.1605582249440; Mon, 16 Nov 2020 19:04:09 -0800 (PST) Received: from localhost ([210.108.244.139]) by smtp.gmail.com with ESMTPSA id h16sm17115426pgd.62.2020.11.16.19.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2020 19:04:08 -0800 (PST) Date: Tue, 17 Nov 2020 12:04:06 +0900 From: YongHyeon PYUN To: Carsten =?iso-8859-1?Q?B=E4cker?= Cc: Hans Petter Selasky , Kristof Provost , freebsd-arm@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: Problem with checksum offloading on RPi3 (PF + Jails involved) Message-ID: <20201117030406.GA45158@michelle> References: <5130ee46-5832-d4df-d774-c6bd32e10b30@gmx.de> <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> <20201116011910.GB1941@michelle> <1245cbe5-9d2f-4808-f989-569ae7d57a8a@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1245cbe5-9d2f-4808-f989-569ae7d57a8a@gmx.de> X-Rspamd-Queue-Id: 4CZrPl0SzKz3Hq4 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Nov 2020 03:04:11 -0000 On Mon, Nov 16, 2020 at 12:54:25PM +0100, Carsten Bäcker 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_host_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 that > 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.