From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3EF8C27C79 for ; Mon, 17 Jun 2024 16:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UcwiY6DZCHzfVXzbkzGQJQm8C625zf6w/5jpmekHNmg=; b=pbKp5+DdmYxqUYoFuQAD2mTYeV mvXyWZwQg/ywkfC3opT9i8lxQYp5FJ3PlGyWyEBMVzoQTBgvqt0tX9HG68unzU0KQLRq8S5AJ1Xh4 kE2PL9BBlDeVG4ML1/x6s3t9b3Hd4QNDwLILLmLloYOy8aFrmPIVRWwqLajt1cyvPaTpMxRma1bWT cj2c28WLQSHDMFaQQ1RP3fF5AvtIiLjtjWtd1SwdIjGcphbpbWouAiZ5qt89OBiLaYKOMbn6T5Naw wwav6yNsUX0CKG9RFPprQ9uLHYJC9mW+wkmOrk2FpBk248LjW3ViZ7IK0NMgJsfoKhPRE1kmnv2/d 04pM68Jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJFaB-0000000BpXa-1STX; Mon, 17 Jun 2024 16:51:51 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJFa8-0000000BpWs-3qca for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2024 16:51:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E564861365; Mon, 17 Jun 2024 16:51:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35318C2BD10; Mon, 17 Jun 2024 16:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718643107; bh=JQ9/ew7gNBZkCvIaaYqgstiKB/4Vesu8cj+i8F8ugsU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=js6dk8wqM2vGwMzBeUoVi9zTNzBclB3440OFZMVql27MEzKvs9qPHQ+iFbYjg4RPl e6LfgSYfhvTz/ZAASx9i/y+n5osVCeyw3wyX+2V1Bybmxn/iiL2uTEy5IWrMUCin4o NFHkjg/Dq2HSuud6miltzRHaXxmuMoQGnzsv6/wj2ODGlySkqlZuR8+GL9qw8oofio xc0xNZpCkErpd/26ZwF9hyqUBISr53j5kzktT6RQYO8O6D86cHHXwqCupZMCVRwbgH FzsB4/rTrfpP48RKMUaUsOOTHBeB6bUehepbWadDtqo2CErEnNq5ARbmlXF/+auxme eFHf/oNq/37Cg== Date: Mon, 17 Jun 2024 17:51:42 +0100 From: Simon Horman To: Furong Xu <0x1207@gmail.com> Cc: "Russell King (Oracle)" , Eric Dumazet , Vadim Fedorenko , "David S. Miller" , Alexandre Torgue , Jose Abreu , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto , Corinna Vinschen , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com Subject: Re: [PATCH net-next v4] net: stmmac: Enable TSO on VLANs Message-ID: <20240617165142.GX8447@kernel.org> References: <20240615095611.517323-1-0x1207@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240615095611.517323-1-0x1207@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_095149_137951_B6A26199 X-CRM114-Status: GOOD ( 13.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Jun 15, 2024 at 05:56:11PM +0800, Furong Xu wrote: > The TSO engine works well when the frames are not VLAN Tagged. > But it will produce broken segments when frames are VLAN Tagged. > > The first segment is all good, while the second segment to the > last segment are broken, they lack of required VLAN tag. > > An example here: > ======== > // 1st segment of a VLAN Tagged TSO frame, nothing wrong. > MacSrc > MacDst, ethertype 802.1Q (0x8100), length 1518: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [.], seq 1:1449 > > // 2nd to last segments of a VLAN Tagged TSO frame, VLAN tag is missing. > MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 1449:2897 > MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 2897:4345 > MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 4345:5793 > MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [P.], seq 5793:7241 > > // normal VLAN Tagged non-TSO frame, nothing wrong. > MacSrc > MacDst, ethertype 802.1Q (0x8100), length 1022: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [P.], seq 7241:8193 > MacSrc > MacDst, ethertype 802.1Q (0x8100), length 70: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [F.], seq 8193 > ======== > > When transmitting VLAN Tagged TSO frames, never insert VLAN tag by HW, > always insert VLAN tag to SKB payload, then TSO works well on VLANs for > all MAC cores. > > Tested on DWMAC CORE 5.10a, DWMAC CORE 5.20a and DWXGMAC CORE 3.20a > > Signed-off-by: Furong Xu <0x1207@gmail.com> > --- > Changes in v4: > - Re-arrange variables to keep reverse x-mas tree order. > > Changes in v3: > - Drop packet and increase stats counter when vlan tag insert fails. > > Changes in v2: > - Use __vlan_hwaccel_push_inside() to insert vlan tag to the payload. Thanks this both seems correct to me and I believe it addresses the review of earlier revisions. Reviewed-by: Simon Horman