forked from Openwrt/openwrt
9e86e0b33b
Changelogs: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.67 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.68 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.69 Upstreamed patches: target/linux/generic/backport-6.1/740-v6.9-01-netfilter-flowtable-validate-pppoe-header.patch [1] target/linux/generic/backport-6.1/740-v6.9-02-netfilter-flowtable-incorrect-pppoe-tuple.patch [2] target/linux/generic/backport-6.1/790-48-STABLE-net-dsa-mt7530-trap-link-local-frames-regardless-of-.patch [3] target/linux/generic/backport-6.1/790-50-v6.10-net-dsa-mt7530-fix-mirroring-frames-received-on-loca.patch [4] target/linux/generic/backport-6.1/790-16-v6.4-net-dsa-mt7530-set-all-CPU-ports-in-MT7531_CPU_PMAP.patch [5] target/linux/generic/backport-6.1/790-46-v6.9-net-dsa-mt7530-fix-improper-frames-on-all-25MHz-and-.patch [6] target/linux/generic/backport-6.1/790-47-v6.10-net-dsa-mt7530-fix-enabling-EEE-on-MT7531-switch-on-.patch [7] target/linux/mediatek/patches-6.1/220-v6.3-clk-mediatek-clk-gate-Propagate-struct-device-with-m.patch [8] target/linux/mediatek/patches-6.1/222-v6.3-clk-mediatek-clk-mtk-Propagate-struct-device-for-com.patch [9] target/linux/mediatek/patches-6.1/223-v6.3-clk-mediatek-clk-mux-Propagate-struct-device-for-mtk.patch [10] target/linux/mediatek/patches-6.1/226-v6.3-clk-mediatek-clk-mtk-Extend-mtk_clk_simple_probe.patch [11] Symbol changes: MITIGATION_SPECTRE_BHI (new) [12] SPECTRE_BHI_{ON,OFF} (deprecated) [12] References: [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=8bf7c76a2a207ca2b4cfda0a279192adf27678d7 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=f1c3c61701a0b12f4906152c1626a5de580ea3d2 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=19643bf8c9b5bb5eea5163bf2f6a3eee6fb5b99b [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=e86c9db58eba290e858e2bb80efcde9e3973a5ef [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=013c787d231188a6408e2991150d3c9bf9a2aa0b [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=41a004ffba9b1fd8a5a7128ebd0dfa3ed39c3316 [7] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=7d51db455ca03e5270cc585a75a674abd063fa6c [8] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=082b831488a41257b7ac7ffa1d80a0b60d98394d [9] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=6f5f72a684a2823f21efbfd20c7e4b528c44a781 [10] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=a4fe8813a7868ba5867e42e60de7a2b8baac30ff [11] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=c1d87d56af063c87961511ee25f6b07a5676d27d [12] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=d844df110084ef8bd950a52194865f3f63b561ca Signed-off-by: Shiji Yang <yangshiji66@qq.com>
202 lines
7.5 KiB
Diff
202 lines
7.5 KiB
Diff
From 1dbc1bdc2869e6d2929235c70d64e393aa5a5fa2 Mon Sep 17 00:00:00 2001
|
||
From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
|
||
Date: Mon, 22 Apr 2024 10:15:12 +0300
|
||
Subject: [PATCH 05/15] net: dsa: mt7530: refactor MT7530_MFC and MT7531_CFC,
|
||
add MT7531_QRY_FFP
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
The MT7530_MFC register is on MT7530, MT7531, and the switch on the MT7988
|
||
SoC. Rename it to MT753X_MFC. Bit 7 to 0 differs between MT7530 and
|
||
MT7531/MT7988. Add MT7530 prefix to these definitions, and define the
|
||
IGMP/MLD Query Frame Flooding Ports mask for MT7531.
|
||
|
||
Rename the cases of MIRROR_MASK to MIRROR_PORT_MASK.
|
||
|
||
Move mt753x_mirror_port_get() and mt753x_port_mirror_set() to mt7530.h as
|
||
macros.
|
||
|
||
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||
---
|
||
drivers/net/dsa/mt7530.c | 38 ++++++++--------------
|
||
drivers/net/dsa/mt7530.h | 69 +++++++++++++++++++++++++---------------
|
||
2 files changed, 57 insertions(+), 50 deletions(-)
|
||
|
||
--- a/drivers/net/dsa/mt7530.c
|
||
+++ b/drivers/net/dsa/mt7530.c
|
||
@@ -1154,7 +1154,7 @@ mt753x_cpu_port_enable(struct dsa_switch
|
||
PORT_SPEC_TAG);
|
||
|
||
/* Enable flooding on the CPU port */
|
||
- mt7530_set(priv, MT7530_MFC, BC_FFP(BIT(port)) | UNM_FFP(BIT(port)) |
|
||
+ mt7530_set(priv, MT753X_MFC, BC_FFP(BIT(port)) | UNM_FFP(BIT(port)) |
|
||
UNU_FFP(BIT(port)));
|
||
|
||
/* Add the CPU port to the CPU port bitmap for MT7531. Trapped frames
|
||
@@ -1318,15 +1318,15 @@ mt7530_port_bridge_flags(struct dsa_swit
|
||
flags.val & BR_LEARNING ? 0 : SA_DIS);
|
||
|
||
if (flags.mask & BR_FLOOD)
|
||
- mt7530_rmw(priv, MT7530_MFC, UNU_FFP(BIT(port)),
|
||
+ mt7530_rmw(priv, MT753X_MFC, UNU_FFP(BIT(port)),
|
||
flags.val & BR_FLOOD ? UNU_FFP(BIT(port)) : 0);
|
||
|
||
if (flags.mask & BR_MCAST_FLOOD)
|
||
- mt7530_rmw(priv, MT7530_MFC, UNM_FFP(BIT(port)),
|
||
+ mt7530_rmw(priv, MT753X_MFC, UNM_FFP(BIT(port)),
|
||
flags.val & BR_MCAST_FLOOD ? UNM_FFP(BIT(port)) : 0);
|
||
|
||
if (flags.mask & BR_BCAST_FLOOD)
|
||
- mt7530_rmw(priv, MT7530_MFC, BC_FFP(BIT(port)),
|
||
+ mt7530_rmw(priv, MT753X_MFC, BC_FFP(BIT(port)),
|
||
flags.val & BR_BCAST_FLOOD ? BC_FFP(BIT(port)) : 0);
|
||
|
||
return 0;
|
||
@@ -1862,20 +1862,6 @@ mt7530_port_vlan_del(struct dsa_switch *
|
||
return 0;
|
||
}
|
||
|
||
-static int mt753x_mirror_port_get(unsigned int id, u32 val)
|
||
-{
|
||
- return (id == ID_MT7531 || id == ID_MT7988) ?
|
||
- MT7531_MIRROR_PORT_GET(val) :
|
||
- MIRROR_PORT(val);
|
||
-}
|
||
-
|
||
-static int mt753x_mirror_port_set(unsigned int id, u32 val)
|
||
-{
|
||
- return (id == ID_MT7531 || id == ID_MT7988) ?
|
||
- MT7531_MIRROR_PORT_SET(val) :
|
||
- MIRROR_PORT(val);
|
||
-}
|
||
-
|
||
static int mt753x_port_mirror_add(struct dsa_switch *ds, int port,
|
||
struct dsa_mall_mirror_tc_entry *mirror,
|
||
bool ingress, struct netlink_ext_ack *extack)
|
||
@@ -1891,14 +1877,14 @@ static int mt753x_port_mirror_add(struct
|
||
val = mt7530_read(priv, MT753X_MIRROR_REG(priv->id));
|
||
|
||
/* MT7530 only supports one monitor port */
|
||
- monitor_port = mt753x_mirror_port_get(priv->id, val);
|
||
+ monitor_port = MT753X_MIRROR_PORT_GET(priv->id, val);
|
||
if (val & MT753X_MIRROR_EN(priv->id) &&
|
||
monitor_port != mirror->to_local_port)
|
||
return -EEXIST;
|
||
|
||
val |= MT753X_MIRROR_EN(priv->id);
|
||
- val &= ~MT753X_MIRROR_MASK(priv->id);
|
||
- val |= mt753x_mirror_port_set(priv->id, mirror->to_local_port);
|
||
+ val &= ~MT753X_MIRROR_PORT_MASK(priv->id);
|
||
+ val |= MT753X_MIRROR_PORT_SET(priv->id, mirror->to_local_port);
|
||
mt7530_write(priv, MT753X_MIRROR_REG(priv->id), val);
|
||
|
||
val = mt7530_read(priv, MT7530_PCR_P(port));
|
||
@@ -2538,7 +2524,7 @@ mt7531_setup_common(struct dsa_switch *d
|
||
mt7530_mib_reset(ds);
|
||
|
||
/* Disable flooding on all ports */
|
||
- mt7530_clear(priv, MT7530_MFC, BC_FFP_MASK | UNM_FFP_MASK |
|
||
+ mt7530_clear(priv, MT753X_MFC, BC_FFP_MASK | UNM_FFP_MASK |
|
||
UNU_FFP_MASK);
|
||
|
||
for (i = 0; i < MT7530_NUM_PORTS; i++) {
|
||
@@ -3100,10 +3086,12 @@ mt753x_conduit_state_change(struct dsa_s
|
||
else
|
||
priv->active_cpu_ports &= ~mask;
|
||
|
||
- if (priv->active_cpu_ports)
|
||
- val = CPU_EN | CPU_PORT(__ffs(priv->active_cpu_ports));
|
||
+ if (priv->active_cpu_ports) {
|
||
+ val = MT7530_CPU_EN |
|
||
+ MT7530_CPU_PORT(__ffs(priv->active_cpu_ports));
|
||
+ }
|
||
|
||
- mt7530_rmw(priv, MT7530_MFC, CPU_EN | CPU_PORT_MASK, val);
|
||
+ mt7530_rmw(priv, MT753X_MFC, MT7530_CPU_EN | MT7530_CPU_PORT_MASK, val);
|
||
}
|
||
|
||
static int mt7988_setup(struct dsa_switch *ds)
|
||
--- a/drivers/net/dsa/mt7530.h
|
||
+++ b/drivers/net/dsa/mt7530.h
|
||
@@ -36,36 +36,55 @@ enum mt753x_id {
|
||
#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)
|
||
-#define BC_FFP_MASK BC_FFP(~0)
|
||
-#define UNM_FFP(x) (((x) & 0xff) << 16)
|
||
-#define UNM_FFP_MASK UNM_FFP(~0)
|
||
-#define UNU_FFP(x) (((x) & 0xff) << 8)
|
||
-#define UNU_FFP_MASK UNU_FFP(~0)
|
||
-#define CPU_EN BIT(7)
|
||
-#define CPU_PORT_MASK GENMASK(6, 4)
|
||
-#define CPU_PORT(x) FIELD_PREP(CPU_PORT_MASK, x)
|
||
-#define MIRROR_EN BIT(3)
|
||
-#define MIRROR_PORT(x) ((x) & 0x7)
|
||
-#define MIRROR_MASK 0x7
|
||
+/* Register for MAC forward control */
|
||
+#define MT753X_MFC 0x10
|
||
+#define BC_FFP_MASK GENMASK(31, 24)
|
||
+#define BC_FFP(x) FIELD_PREP(BC_FFP_MASK, x)
|
||
+#define UNM_FFP_MASK GENMASK(23, 16)
|
||
+#define UNM_FFP(x) FIELD_PREP(UNM_FFP_MASK, x)
|
||
+#define UNU_FFP_MASK GENMASK(15, 8)
|
||
+#define UNU_FFP(x) FIELD_PREP(UNU_FFP_MASK, x)
|
||
+#define MT7530_CPU_EN BIT(7)
|
||
+#define MT7530_CPU_PORT_MASK GENMASK(6, 4)
|
||
+#define MT7530_CPU_PORT(x) FIELD_PREP(MT7530_CPU_PORT_MASK, x)
|
||
+#define MT7530_MIRROR_EN BIT(3)
|
||
+#define MT7530_MIRROR_PORT_MASK GENMASK(2, 0)
|
||
+#define MT7530_MIRROR_PORT_GET(x) FIELD_GET(MT7530_MIRROR_PORT_MASK, x)
|
||
+#define MT7530_MIRROR_PORT_SET(x) FIELD_PREP(MT7530_MIRROR_PORT_MASK, x)
|
||
+#define MT7531_QRY_FFP_MASK GENMASK(7, 0)
|
||
+#define MT7531_QRY_FFP(x) FIELD_PREP(MT7531_QRY_FFP_MASK, x)
|
||
|
||
-/* Registers for CPU forward control */
|
||
+/* Register for CPU forward control */
|
||
#define MT7531_CFC 0x4
|
||
#define MT7531_MIRROR_EN BIT(19)
|
||
-#define MT7531_MIRROR_MASK (MIRROR_MASK << 16)
|
||
-#define MT7531_MIRROR_PORT_GET(x) (((x) >> 16) & MIRROR_MASK)
|
||
-#define MT7531_MIRROR_PORT_SET(x) (((x) & MIRROR_MASK) << 16)
|
||
+#define MT7531_MIRROR_PORT_MASK GENMASK(18, 16)
|
||
+#define MT7531_MIRROR_PORT_GET(x) FIELD_GET(MT7531_MIRROR_PORT_MASK, x)
|
||
+#define MT7531_MIRROR_PORT_SET(x) FIELD_PREP(MT7531_MIRROR_PORT_MASK, x)
|
||
#define MT7531_CPU_PMAP_MASK GENMASK(7, 0)
|
||
#define MT7531_CPU_PMAP(x) FIELD_PREP(MT7531_CPU_PMAP_MASK, x)
|
||
|
||
-#define MT753X_MIRROR_REG(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
|
||
- MT7531_CFC : MT7530_MFC)
|
||
-#define MT753X_MIRROR_EN(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
|
||
- MT7531_MIRROR_EN : MIRROR_EN)
|
||
-#define MT753X_MIRROR_MASK(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
|
||
- MT7531_MIRROR_MASK : MIRROR_MASK)
|
||
+#define MT753X_MIRROR_REG(id) ((id == ID_MT7531 || \
|
||
+ id == ID_MT7988) ? \
|
||
+ MT7531_CFC : MT753X_MFC)
|
||
+
|
||
+#define MT753X_MIRROR_EN(id) ((id == ID_MT7531 || \
|
||
+ id == ID_MT7988) ? \
|
||
+ MT7531_MIRROR_EN : MT7530_MIRROR_EN)
|
||
+
|
||
+#define MT753X_MIRROR_PORT_MASK(id) ((id == ID_MT7531 || \
|
||
+ id == ID_MT7988) ? \
|
||
+ MT7531_MIRROR_PORT_MASK : \
|
||
+ MT7530_MIRROR_PORT_MASK)
|
||
+
|
||
+#define MT753X_MIRROR_PORT_GET(id, val) ((id == ID_MT7531 || \
|
||
+ id == ID_MT7988) ? \
|
||
+ MT7531_MIRROR_PORT_GET(val) : \
|
||
+ MT7530_MIRROR_PORT_GET(val))
|
||
+
|
||
+#define MT753X_MIRROR_PORT_SET(id, val) ((id == ID_MT7531 || \
|
||
+ id == ID_MT7988) ? \
|
||
+ MT7531_MIRROR_PORT_SET(val) : \
|
||
+ MT7530_MIRROR_PORT_SET(val))
|
||
|
||
/* Register for BPDU and PAE frame control */
|
||
#define MT753X_BPC 0x24
|