Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp56117lqs; Thu, 13 Jun 2024 03:50:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRGcwtDRupE6g6pzKg27gJBymBQ23NieoELCxmE4kxIijhLOdv0PWSckQyCVRGsmwQd4HU4jgRAAbtBa7zWx306Wk0LT//U9jylE5keQ== X-Google-Smtp-Source: AGHT+IEOMEMCEOpI7ICucN8rKXFGqm/3S54Jq9weQ44K93jBFwnrCgB7RtUSttsuEgqXnF+8sP1Y X-Received: by 2002:a05:6a20:244f:b0:1a7:bb6d:6589 with SMTP id adf61e73a8af0-1b8a9bd2ab1mr5405302637.29.1718275850582; Thu, 13 Jun 2024 03:50:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718275850; cv=pass; d=google.com; s=arc-20160816; b=pb9++Pf5xI6ApPjASumEVqa7ajrCx4CZO0EfIBhhL/tcLDlQpzsH4K/CElE5tKOjna 6+hVyUUaI82ojxp4IrVcliVYxqCN/6Y5TpxftPiCoOy1zsE39GRWWf/PLjPrh8vM93ME HMKVY3/FT2juAmOl+6amJKH2Nd2ZmzRkh2Qkz+4RIv6/AXDSG1lCjCJaS5cev0PwT8Tl 3/cfI0c9AjcLXw5zIF+5d24/V3+PQOFVtp/GC7isVRFGRtf+rowTrqLZ9X1GAMW32P4w H6KJueESu0kZLmvLJyNslXjvSYFKBsiLxgvSmxkSY6m4d6EM+lQ6TpuEBxS0h5r9PVf2 t7QA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=e+9UQV1d9d8KOTY7gdJbPM2YDvK2G13gbviN0cq/CYE=; fh=w8TZToiV3eNcPENVcyxt8TbzCKAjgd13YiFiasWQoYo=; b=wKUg4Ihbj5LLpr6fzEgXoFnHoY0EoX4lh9Ut0VzyTsMQpBXxcnBJ1K/Sb/4uBa2xAD Mlf6Hr4NMuCqZV0n2qnMU3xWQPvBf1Kv52ZaQTM8SrgHxucxQBJpbX/HuX0RH1Bgsm6G gVjrTSvTmdFow/GDLp4qB4D/j5LRvS9k64khiyvqUtOk4ZMs1hw6f7qWwZgFeCtT890W NgXD4HtpJeoZZXUVL884jiolAc0nIazs2DWDMb5bPHr+oHWm5k+nkeqDvUm5m7eUTSZu eA+TAs5rPBg0XdXRJk41GzxqPO3hD3QLswC0y37shAAZcIDVygpFhcG6bZmnV6A68CHo 7jhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=sf2Xdutx; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-213049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f855f1ee71si10831635ad.615.2024.06.13.03.50.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 03:50:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=sf2Xdutx; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-213049-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E2B26B24555 for ; Thu, 13 Jun 2024 10:46:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9515142911; Thu, 13 Jun 2024 10:46:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="sf2Xdutx" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1090713DB99; Thu, 13 Jun 2024 10:46:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718275565; cv=none; b=HSg1k6lbfmUIgBT/qJHK3CzadcdE62BOV21Lcq5YXPdXYGbk61wc405GnvS2kcGxr2eA3LjCDbc+CVU/ZDuakgCeNF2WfzsP4Efgof5AcZBR/n/jGnE+DqJICFKsIdVfSvQ+IRTHVfBBvdmgWOAWRkjz7zUzwzMQgBKym2ZW/Nw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718275565; c=relaxed/simple; bh=h3HhNWpSBhM6/iN5PFWNZTn7S3jV9LLHYO1udt3vOvM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S5wFOY141PcY99phtsiOoCMrPc7TPaN2hAAbbVfWxhESuBO9r97lq8kXsv4E6hfsuhgoT5MJh54ViHMrU33DyYxZVCboAj0POxDtc4uRSpwh8Eea4/l1ZHGtRFmQZJapdGP0oaEKHxNpg9BbtnkN+Yr+JkLZQNBoVWYLtdD2U50= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=sf2Xdutx; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240613023808.448495-1-0x1207@gmail.com> Sender: Russell King (Oracle) 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!