Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp487362lqp; Sat, 13 Apr 2024 06:03:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1gO/Es92fusNLKHmKBpbWfXzWQ5bllRxp8zIwsymA+86J4iC06fJmXiS2FYgb5SgQI23uBZ4y+Fq6hW+uumbH9fFQCVHSfIZ+bVRWPA== X-Google-Smtp-Source: AGHT+IHID2rRE44wy/eqct6FEjxDEl64aRZx2kf6oWJEFNwnJeGDym6abbJNFk0xoLF063EfIs43 X-Received: by 2002:a05:6122:2a4d:b0:4c9:b8a8:78d4 with SMTP id fx13-20020a0561222a4d00b004c9b8a878d4mr5105531vkb.3.1713013382840; Sat, 13 Apr 2024 06:03:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713013382; cv=pass; d=google.com; s=arc-20160816; b=wyYCUnKppT1Iqr0SQMr13JZFmQu83X8lVzy2wfelnsd+4DmyH0ep+vIpraLl1fs7cw RpGa749cGHQXWPsG/4Kol8WQ+88LZ09fN6KvE8ZcOJsDsdZKFMVCAVGGOxA3CEh7ii+N 15f1G44U7aez9/FcTY5M4cnGXiI8occjMrMQVZvIyAKy9htnR+el3ntUeRfqzZGHeiGt 5CWq6N0mcmgTIVUlry155gDCGEq7fEqAUkdXSQq6LvquPyS8g0S5pUjm0234lY6zaOTn APrbZVcQkqaJkUhV6WD72sd8YR8Zja9k4YvwjE+pGeOcKlYHciJrqyx19z+n3THxAPEz uHRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=W+xniOl+54/+Cl7M8cdS+raCP6YBA3d8Gkm1bww7Akk=; fh=qFHvatm1RaNYc317LxXKg+KJ2ufLmoLyZz12mwvPuTQ=; b=kdmPNc07DC2aVwTcCZYbogSjpjADM4B2+c5/f0ZxhW1+1Tjhl2zighg0tP+GtwCSgm nU6qaES29WTrjQGSsLFv0//S64cMuEYgWGPBzapKHVdCuO9Usbhe3d4lzXhNJNfQGLnC Bny+xhUaAyG3tzrWohxCqZoknKVugYFHY8mDmg2jQhJtOi0aZOPuom10bLsaS88/i6m2 OhwtO4kFQESKLCjdoV6ylDSXesVSflUTrYHSECvYABlFpJN1fIi/49Y0s7EZyMHdZnQG b6QcHtCxlGXy8+gKsw6PQSL8tcytNBe6k8KNTS/50d+NvGtyCu0LE57tOsOBTnBzC6x+ BfJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mwcX/NCf"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l37-20020a056122202500b004d417c81babsi1002864vkd.309.2024.04.13.06.03.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 06:03:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mwcX/NCf"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 78C171C20C28 for ; Sat, 13 Apr 2024 13:03:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA7D7446DC; Sat, 13 Apr 2024 13:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mwcX/NCf" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 02BAC3D579; Sat, 13 Apr 2024 13:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713013362; cv=none; b=dZtkM4QbkvcprPS1pHWyidDe3kG6mkkywiKzCPnlgPYymakmrfxb+hU26gjJwlGK4e9iilEoiLUDF03jBS8Ug0ks+Z9Jvl22OEEFYXQIpgjYZ0h6HRlC8VkBJtdDNqF0XOJBuokoRlBvIYZiXTmbrXoAKhIjOAauy6ou3dBv77Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713013362; c=relaxed/simple; bh=pVQjuPI57KbahrnQhg6dIo3ahNunEx71IV9EAyTo2nM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Nm13z5laI21oo3Z7DYKrLwWZsAbm2Tvp5ZsaHOWIo6Y6OGgtpWX9wulnKOwt+dXzaibJ69e6il281Sb1ANeYXc4WO642supsXVHC/WXZFa/rD9T4GdLrdp26yG9LBW0zj+DnMTxp/zDCVMSaktc7BduElETyao/dXfUCanPadCo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mwcX/NCf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 93C67C2BD10; Sat, 13 Apr 2024 13:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713013361; bh=pVQjuPI57KbahrnQhg6dIo3ahNunEx71IV9EAyTo2nM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=mwcX/NCf8qv2N83LoXBH8GorBBMYA4JC6D+71nb26IMJ+hioFHNMzDbKTNwfPHIeL yZZJahmyYQqO4fB7voQM5XndMNeZZb3Y935NFJlvgNlhnQFXNddw+tXDJ9SJNQR0oM tS5k3l2WO9D1iUlwd/ZqV283bwb8SwZbaFuIj4wWQNP3yzGQ89DUEceCWAyWmdI0HK MBgalFRd55YDhyyClishmxV0IoGthYOFbVVrwIEvfIHO0S0ktQGpJ81F4ZOT13vm7f u8S9FCcuCppVbBIKAtCy+Ouavdqdiyd1/mirBiE0nL/WY+8/TgufPB6v6dXE6NkgmZ P2fJlZIC62KYw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B694C04FFE; Sat, 13 Apr 2024 13:02:41 +0000 (UTC) From: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL_via_B4_Relay?= Date: Sat, 13 Apr 2024 16:01:39 +0300 Subject: [PATCH net 1/2] net: dsa: mt7530: fix mirroring frames received on local port 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="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240413-b4-for-net-mt7530-fix-mirroring-to-local-port-and-mt7988-v1-1-476deff8cc06@arinc9.com> References: <20240413-b4-for-net-mt7530-fix-mirroring-to-local-port-and-mt7988-v1-0-476deff8cc06@arinc9.com> In-Reply-To: <20240413-b4-for-net-mt7530-fix-mirroring-to-local-port-and-mt7988-v1-0-476deff8cc06@arinc9.com> To: Daniel Golle , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: Holger Stadali , Bartel Eerdekens , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1713013352; l=2274; i=arinc.unal@arinc9.com; s=arinc9-patatt; h=from:subject:message-id; bh=16zG1ybHG9AjnsjIF0xkfp7UyTV+eA87bDmkriEzcpo=; b=KcNANl0mubqFS1YqweAnMdHpJB5HByJ1podyxKwJi3gKD5uCCVVgSrXMANiux9wInU0qIHBZo 43BL6ZB0k3fAOxpJa8Qf5ES8aB/zvZrk5wlu/eyWfx2L9tbfs1d4OCn X-Developer-Key: i=arinc.unal@arinc9.com; a=ed25519; pk=VmvgMWwm73yVIrlyJYvGtnXkQJy9CvbaeEqPQO9Z4kA= X-Endpoint-Received: by B4 Relay for arinc.unal@arinc9.com/arinc9-patatt with auth_id=115 X-Original-From: =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= Reply-To: arinc.unal@arinc9.com From: Arınç ÜNAL This switch intellectual property provides a bit on the ARL global control register which controls allowing mirroring frames which are received on the local port (monitor port). This bit is unset after reset. This ability must be enabled to fully support the port mirroring feature on this switch intellectual property. Therefore, this patch fixes the traffic not being reflected on a port, which would be configured like below: tc qdisc add dev swp0 clsact tc filter add dev swp0 ingress matchall skip_sw \ action mirred egress mirror dev swp0 As a side note, this configuration provides the hairpinning feature for a single port. Fixes: 37feab6076aa ("net: dsa: mt7530: add support for port mirroring") Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 6 ++++++ drivers/net/dsa/mt7530.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index c0d0bce0b594..b84e1845fa02 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2480,6 +2480,9 @@ mt7530_setup(struct dsa_switch *ds) PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); } + /* Allow mirroring frames received on the local port (monitor port). */ + mt7530_set(priv, MT753X_AGC, LOCAL_EN); + /* Setup VLAN ID 0 for VLAN-unaware bridges */ ret = mt7530_setup_vlan0(priv); if (ret) @@ -2591,6 +2594,9 @@ mt7531_setup_common(struct dsa_switch *ds) PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); } + /* Allow mirroring frames received on the local port (monitor port). */ + mt7530_set(priv, MT753X_AGC, LOCAL_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 585db03c0548..a08053390b28 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -32,6 +32,10 @@ enum mt753x_id { #define SYSC_REG_RSTCTRL 0x34 #define RESET_MCM BIT(2) +/* Register for ARL global control */ +#define MT753X_AGC 0xc +#define LOCAL_EN BIT(7) + /* Registers to mac forward control for unknown frames */ #define MT7530_MFC 0x10 #define BC_FFP(x) (((x) & 0xff) << 24) -- 2.40.1