From patchwork Fri Dec 30 07:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 37604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2772570wrt; Thu, 29 Dec 2022 23:34:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXuBOUuQVy4WOOA/9TuxInG83ku9l8YzOTTu+ukAN2xeu4FpQoYJ4XJryBLjekRUo66KjFO8 X-Received: by 2002:a17:906:13d6:b0:7c1:99a7:e10b with SMTP id g22-20020a17090613d600b007c199a7e10bmr25698732ejc.49.1672385683465; Thu, 29 Dec 2022 23:34:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672385683; cv=none; d=google.com; s=arc-20160816; b=JQzytjYDrJshlDLqnnVXaFiW2NXwNk62F7LtrCh3qSOvwQf7lGR4TGGa3fgJbdfItE jpjnD19MZh8xbulxtyedQdq3eX9lsGRqGOO+VrkRRmElligOK9ah/vCYr3Eu0CHb0rej sWarD2xb7yhJQcvhV2psdWSD9VJyzE2BIYlujwp8JJjtoFSj4IpYjLmAVDQeXGICnMCV noCYMZbrhUFp3Yj4J63YR2H2AcgnS1yfPRLEpe4x4zwAfdskFogQ+1cp0lG4dOnG9js+ tW1hyA64kb6bcX7UxLI8tv7rbMeuvU6u9CrkZCnItbHGgcJayuvE0BBHkgreaS/Iw360 //qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QkQJAkmCP+Nuor28oAQ7xUGQ6VarGmNl8TUneHFaCpI=; b=jjZYrejHaOKcecN/ZZ32RJBbCdS2vPEkQGjJCtPzpT2wQiUV1F0lv2AoU6qZr8b5vr 49wymTAlDkXPiMRmYlStoOz1urFuIpNaBEVd2pAxAtACUOW8a/mmfU0UQ1f86CtHjsH/ 4WgjUL6b0h2NsKAYCOPBB7K8Gy1xty9gbI7wxazW5QEklije4PMtg28SDkOG3ouSvM9c WfXFEk5YTceLD0wub+0ySHGTIQ7QHGpZWV7Wwfnq7AOM6aYdCT5kSngllmouRLuZt40A 9NuJXk0oLD3O87MdZTYFr1omMByyndMXK4azZrQLiq9iY3hqq1nsJkPbjmZyZ3DDXtOK I3jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=W5dlGu8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu8-20020a170906eec800b007a1d4f0e7fcsi1684084ejb.655.2022.12.29.23.34.16; Thu, 29 Dec 2022 23:34:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=W5dlGu8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234712AbiL3HcT (ORCPT + 99 others); Fri, 30 Dec 2022 02:32:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234646AbiL3HcG (ORCPT ); Fri, 30 Dec 2022 02:32:06 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52FBA65B0; Thu, 29 Dec 2022 23:32:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=QkQJAkmCP+Nuor28oAQ7xUGQ6VarGmNl8TUneHFaCpI=; b=W5dlGu8PC6yganKCBF8FGA+SjX XiqTrLOvVu3t6wuzB0NGf+302TDzqUOqklTX5ypScG+5JJsg8Kk32zJMHJmmeYv9YjPyAhHyoAjWR ZQbZoxVhA491TbQKcMPTyeVONkrXBHatKh816IW9KRE72QPw5gptHygsDTTs3Wgtb2VU=; Received: from p200300daa720fc00fd7bb9014adaf597.dip0.t-ipconnect.de ([2003:da:a720:fc00:fd7b:b901:4ada:f597] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1pB9rp-00CcyM-L4; Fri, 30 Dec 2022 08:31:49 +0100 From: Felix Fietkau To: netdev@vger.kernel.org, John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net v3 5/5] net: ethernet: mtk_eth_soc: ppe: fix L2 offloading with DSA untagging offload enabled Date: Fri, 30 Dec 2022 08:31:45 +0100 Message-Id: <20221230073145.53386-5-nbd@nbd.name> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221230073145.53386-1-nbd@nbd.name> References: <20221230073145.53386-1-nbd@nbd.name> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753623490091354359?= X-GMAIL-MSGID: =?utf-8?q?1753623490091354359?= Check for skb metadata in order to detect the case where the DSA header is not present. Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging") Signed-off-by: Felix Fietkau --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 +++--- drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index ab6c571a39ae..cec2fcab3dfa 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -2039,9 +2039,6 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, skb_checksum_none_assert(skb); skb->protocol = eth_type_trans(skb, netdev); - if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) - mtk_ppe_check_skb(eth->ppe[0], skb, hash); - /* When using VLAN untagging in combination with DSA, the * hardware treats the MTK special tag as a VLAN and untags it. */ @@ -2054,6 +2051,9 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, skb_dst_set_noref(skb, ð->dsa_meta[port]->dst); } + if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) + mtk_ppe_check_skb(eth->ppe[0], skb, hash); + skb_record_rx_queue(skb, 0); napi_gro_receive(napi, skb); diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c index 269208a841c7..e366a83cf516 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "mtk_eth_soc.h" #include "mtk_ppe.h" @@ -700,7 +701,9 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash) skb->dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK) goto out; - tag += 4; + if (!skb_metadata_dst(skb)) + tag += 4; + if (get_unaligned_be16(tag) != ETH_P_8021Q) break;