From patchwork Sun Feb 9 12:08:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13966847 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 198E2C02199 for ; Sun, 9 Feb 2025 12:17:35 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1ZMCvDd/Ezj4aFDcX2uSgRxKCo45Kz+LLQsJyZlloOE=; b=pXZhUE75kh5I+0WeM8YTKbSH3b /c9I0NYErsuBX1ODbHtLJM3FRvL0b6f2EnOHLNU3757e0p2p1cflEuQOgiCsdZa3eZDTaFenzqTJh d01lsO5Szu3cgykIBO+4j0Z6CdTGiSSKkcjfcpzdgDjusAh3+9obSsNVgbcI9ql7e2msbzDqLtMz4 XVcZD+Ug/NaMYM5zeHhNWG7BTDSUCq1BAzpc6WMgQ21zDh+CSk4f5X8eFZY0cKEkPY0ju6N1ZJ6sS hus3wGzZRTP3S12q9uQbVmDINObvhwg0NjtOKExQb+q+Tacun4KprU4DZmqQBgK5q7ehFWWTeIZA+ Fig63H5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1th6Fi-0000000EpIP-11nT; Sun, 09 Feb 2025 12:17:34 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1th67o-0000000EnWu-0xMy; Sun, 09 Feb 2025 12:09:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D551FA40078; Sun, 9 Feb 2025 12:07:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAE13C4CEE2; Sun, 9 Feb 2025 12:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739102963; bh=ZR5/2ulMQlwhUwl/HtlTLXlzn5sAotIiGMhXEhkdb3s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EvIJuZpFDbbo2NzlKQOQelhhqr0JW9jWV/w+sv+ILq+cQZxz6XoTsDMuZjXZv1yus jBQmxdtYZJ6v6YK7JcD0Qj8nhqTZ/FahNl/oO9DI+6iwTp0ZLOr1Dj9SaduYvRvh43 ApXiFy7R3PKw83M8v+N0s3YvjufZcg+ojSMrYnvHcGoQFMv1zEsIzFk6Gn4TgKY+us 8TADuJR6ytE7T76tTnEmq+O53zO+Nc2/A6YivQ2nsO2mbCwv4BNO4as9ZHsStUVzQ3 iSZFZxCrp/dNc6TgCyKFEsB3KWS51GRWFREfmyulr7oXtF4edNkKKKP08eb9MV7LMp 0C1UkDbVcGEYw== From: Lorenzo Bianconi Date: Sun, 09 Feb 2025 13:08:54 +0100 Subject: [PATCH net-next v3 01/16] net: airoha: Fix TSO support for header cloned skbs MIME-Version: 1.0 Message-Id: <20250209-airoha-en7581-flowtable-offload-v3-1-dba60e755563@kernel.org> References: <20250209-airoha-en7581-flowtable-offload-v3-0-dba60e755563@kernel.org> In-Reply-To: <20250209-airoha-en7581-flowtable-offload-v3-0-dba60e755563@kernel.org> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Bianconi , "Chester A. Unal" , Daniel Golle , DENG Qingfang , Andrew Lunn , Vladimir Oltean Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, upstream@airoha.com X-Mailer: b4 0.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250209_040924_400214_3A656825 X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org For GSO packets, skb_cow_head() will reallocate the skb for TSO header cloned skbs in airoha_dev_xmit(). For this reason, sinfo pointer can be no more valid. Fix the issue relying on skb_shinfo() macro directly in airoha_dev_xmit(). This is not a user visible issue since we can't currently enable TSO for DSA user ports since we are missing to initialize net_device vlan_features field. Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC") Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/mediatek/airoha_eth.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c index 09f448f291240257c5748725848ede231c502fbd..aa5f220ddbcf9ca5bee1173114294cb3aec701c9 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c @@ -2556,11 +2556,10 @@ static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, struct net_device *dev) { - struct skb_shared_info *sinfo = skb_shinfo(skb); struct airoha_gdm_port *port = netdev_priv(dev); + u32 nr_frags = 1 + skb_shinfo(skb)->nr_frags; u32 msg0, msg1, len = skb_headlen(skb); struct airoha_qdma *qdma = port->qdma; - u32 nr_frags = 1 + sinfo->nr_frags; struct netdev_queue *txq; struct airoha_queue *q; void *data = skb->data; @@ -2583,8 +2582,9 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, if (skb_cow_head(skb, 0)) goto error; - if (sinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { - __be16 csum = cpu_to_be16(sinfo->gso_size); + if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | + SKB_GSO_TCPV6)) { + __be16 csum = cpu_to_be16(skb_shinfo(skb)->gso_size); tcp_hdr(skb)->check = (__force __sum16)csum; msg0 |= FIELD_PREP(QDMA_ETH_TXMSG_TSO_MASK, 1); @@ -2613,7 +2613,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb, for (i = 0; i < nr_frags; i++) { struct airoha_qdma_desc *desc = &q->desc[index]; struct airoha_queue_entry *e = &q->entry[index]; - skb_frag_t *frag = &sinfo->frags[i]; + skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; dma_addr_t addr; u32 val;