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 70045C27C4F for ; Thu, 13 Jun 2024 10:46:24 +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=e+9UQV1d9d8KOTY7gdJbPM2YDvK2G13gbviN0cq/CYE=; b=2uQJTnqBMIDjqEMf0tY6p6vx1h grDb5O1zEXNHyWR98842e/EHIpczg17Ovr+N04c5Mo7xg4nJrlLGblFqzdD4A+AHTOp2VXkb4mNft ej9e6emSnmLsN5D9ZNX2Nvosk40uLoMRQX2qyM0WOq590GZ8WyfR1cVDpTS+GBK7jpyYyUA/kul/M AB3CU69Ar/JSeyUcGAUunW1Iu807fzFqK1EsE3usMr4z0x4krnHUW9WjBB7VC+MkGLtmyWq329VUd UH7jQFh6VQzLXrgq5iCTKLhKEtBD/s+RpZvQwOzjjbz0z6YQeulxO66sTrTAHcJBC9qkz7wH92Pxi QkZGDhwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHhy6-0000000GDC5-3o9m; Thu, 13 Jun 2024 10:46:10 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHhy3-0000000GDAG-1GJX for linux-arm-kernel@lists.infradead.org; Thu, 13 Jun 2024 10:46:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=e+9UQV1d9d8KOTY7gdJbPM2YDvK2G13gbviN0cq/CYE=; b=sf2XdutxFvey3XPuvpJP3f7V/R MuxpK/NV/vYwyBlVubMTfpEhHCQTvq6YzTiiSv5Npcoee9hEP9PS7VAgFqUea41iExFV0mgPXdMl2 RinKRQuur9Ni3tOmEvVcf8tR/IPfRH6iNwW2NUPdaFVhbd9LrdtbUjih54tQLeepMyOnVhv/yKCgY wsWBG/y/zpbg2qNtoHPN3EPHa+tkCXa2V2mcFWAbXi/l6pNG07fFOiTMGvMTFILO+9hoVvLCx67P8 2Y2DjIQowBEaEonVYc4GN1jiA+S+FKY0QsDE+jMe+p78KPeDXuzzET5xFMjqxbWjE9WoygvRCfisJ e3VY74rQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:37832) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sHhxh-00068q-33; Thu, 13 Jun 2024 11:45:46 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sHhxh-0001AC-7C; Thu, 13 Jun 2024 11:45:45 +0100 Date: Thu, 13 Jun 2024 11:45:45 +0100 From: "Russell King (Oracle)" To: Furong Xu <0x1207@gmail.com> Cc: "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , 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 v1] net: stmmac: Enable TSO on VLANs Message-ID: References: <20240613023808.448495-1-0x1207@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240613023808.448495-1-0x1207@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_034607_360492_B8471BCA X-CRM114-Status: GOOD ( 10.89 ) 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 Thu, Jun 13, 2024 at 10:38:08AM +0800, Furong Xu wrote: > @@ -4239,16 +4239,32 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) > struct stmmac_txq_stats *txq_stats; > int tmp_pay_len = 0, first_tx; > struct stmmac_tx_queue *tx_q; > - bool has_vlan, set_ic; > + bool set_ic; > u8 proto_hdr_len, hdr; > u32 pay_len, mss; > dma_addr_t des; > int i; > + struct vlan_ethhdr *veth; > > tx_q = &priv->dma_conf.tx_queue[queue]; > txq_stats = &priv->xstats.txq_stats[queue]; > first_tx = tx_q->cur_tx; > > + if (skb_vlan_tag_present(skb)) { > + /* Always insert VLAN tag to SKB payload for TSO frames. > + * > + * Never insert VLAN tag by HW, since segments splited by > + * TSO engine will be un-tagged by mistake. > + */ > + skb_push(skb, VLAN_HLEN); > + memmove(skb->data, skb->data + VLAN_HLEN, ETH_ALEN * 2); > + > + veth = skb_vlan_eth_hdr(skb); > + veth->h_vlan_proto = skb->vlan_proto; > + veth->h_vlan_TCI = htons(skb_vlan_tag_get(skb)); > + __vlan_hwaccel_clear_tag(skb); > + } I think drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c:: otx2_sq_append_skb() does something similar, but uses a helper instead: if (skb_shinfo(skb)->gso_size && !is_hw_tso_supported(pfvf, skb)) { /* Insert vlan tag before giving pkt to tso */ if (skb_vlan_tag_present(skb)) skb = __vlan_hwaccel_push_inside(skb); otx2_sq_append_tso(pfvf, sq, skb, qidx); return true; } Maybe __vlan_hwaccel_push_inside() should be used here? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!