From patchwork Fri Feb 7 16:26:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13965471 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 2C6C0C02194 for ; Fri, 7 Feb 2025 16:40:11 +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=dVJKNQp74SUlbEoM5EL+FSOVeD+CGl+0dGi6Z2vHU0s=; b=yMcfuc4JAbsoz1HupJwLoFEnHK zxRJ6F6ZYUM01utsHKPz7uoZsYp3T5GAWqCMNxe8YLRFZtFEyknS1gDu9PE1Lw5h+tYkwAM68YdTv w2raWf2QkYiKqetGdxEsrTg/wm2qW7gpFt9LYuM5tlP73StAK7A/S+dxLRVqEL/QNRxeRBiPycw5A dAlI8QqFwEazAn4ELGF03uAqVWFi1Jm8bZL+BMX1BVs7aVIywQE56ESy4a7opmg+fDp+4dz9TuWEB hhS/p2nSpNLImesIjqAem7FJoSdUWYmyklvsvMmcp4vEPVKcuBUmcLwkIM2Vs8aNvJP4tzWfr3gRY AiHvxXmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tgROZ-0000000AKIx-0TFZ; Fri, 07 Feb 2025 16:39:59 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tgRC3-0000000AHN2-2ZgO; Fri, 07 Feb 2025 16:27:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 02383A4336D; Fri, 7 Feb 2025 16:25:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08BCBC4CED1; Fri, 7 Feb 2025 16:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738945622; bh=C1aFaWCNYf7kg2GH5A7lQw7Iuw2I/SkqM+nxoGYrGqc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=V3/Hz9FqDg2dATW/crnAHcauMmneFQxg4ibgv9UHH4PkvI46bl87+U9FbGuh4pb4g Ct5cpZg5xvIYz2rTJRhUDIvVupV/i+aXunZltFP2pYIpmFGMmMpT5oX/xpyYGF2rlt ST7pxW4kYOncim6ShoYPIHwY22Mhk4nOV1UoK9XCUKS5VrlqC5+rYbhZK3zfN7zq76 FkBjcLlXujTd2Bz6eR7yR4ezXbpJbijePp1Rd8DvGpxekJkeCVF3BHJCo9Q6nj8XL2 aNsSDYkcwGlqrvcLwfUq1zxp8aSXGoRVE1Ozow2kw+6UvWkYDW111PWIiY3mSRP2NO TyGxS2xiuGhVg== From: Lorenzo Bianconi Date: Fri, 07 Feb 2025 17:26:21 +0100 Subject: [PATCH net-next v2 06/15] net: dsa: mt7530: Enable Rx sptag for EN7581 SoC MIME-Version: 1.0 Message-Id: <20250207-airoha-en7581-flowtable-offload-v2-6-3a2239692a67@kernel.org> References: <20250207-airoha-en7581-flowtable-offload-v2-0-3a2239692a67@kernel.org> In-Reply-To: <20250207-airoha-en7581-flowtable-offload-v2-0-3a2239692a67@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-20250207_082703_793168_2F4AF38F X-CRM114-Status: GOOD ( 11.23 ) 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 Packet Processor Engine (PPE) module used for hw acceleration on EN7581 mac block, in order to properly parse packets, requires DSA untagged packets on TX side and read DSA tag from DMA descriptor on RX side. For this reason, enable RX Special Tag (SPTAG) for EN7581 SoC. This is a preliminary patch to enable netfilter flowtable hw offloading on EN7581 SoC. Signed-off-by: Lorenzo Bianconi --- drivers/net/dsa/mt7530.c | 5 +++++ drivers/net/dsa/mt7530.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 1c83af805209cae40c56138fa8f72261e396f58c..eec8ba9d68088f1dbb2a774a32d3d60af1a9784c 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2586,6 +2586,11 @@ mt7531_setup_common(struct dsa_switch *ds) /* Allow mirroring frames received on the local port (monitor port). */ mt7530_set(priv, MT753X_AGC, LOCAL_EN); + /* Enable Special Tag for rx frames */ + if (priv->id == ID_EN7581) + mt7530_write(priv, MT753X_CPORT_SPTAG_CFG, + CPORT_SW2FE_STAG_EN | CPORT_FE2SW_STAG_EN); + /* Flush the FDB table */ ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); if (ret < 0) diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index 448200689f492dcb73ef056d7284090c1c662e67..349d72a35771f35d478244ab29be1801b3466a5f 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -627,6 +627,10 @@ enum mt7531_xtal_fsel { #define MT7531_GPIO12_RG_RXD3_MASK GENMASK(19, 16) #define MT7531_EXT_P_MDIO_12 (2 << 16) +#define MT753X_CPORT_SPTAG_CFG 0x7c10 +#define CPORT_SW2FE_STAG_EN BIT(1) +#define CPORT_FE2SW_STAG_EN BIT(0) + /* Registers for LED GPIO control (MT7530 only) * All registers follow this pattern: * [ 2: 0] port 0