1 From 18e8feae4a807994e4906d659116d249bfecd4c5 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sun, 30 Jul 2023 09:41:11 +0200
4 Subject: [PATCH 2/4] net: dsa: qca8k: limit user ports access to the first CPU
7 In preparation for multi-CPU support, set CPU port LOOKUP MEMBER outside
8 the port loop and setup the LOOKUP MEMBER mask for user ports only to
11 This is to handle flooding condition where every CPU port is set as
12 target and prevent packet duplication for unknown frames from user ports.
14 Secondary CPU port LOOKUP MEMBER mask will be setup later when
15 port_change_master will be implemented.
17 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
18 Reviewed-by: Simon Horman <simon.horman@corigine.com>
19 Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
20 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
21 Link: https://lore.kernel.org/r/20230730074113.21889-3-ansuelsmth@gmail.com
22 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
24 drivers/net/dsa/qca/qca8k-8xxx.c | 14 ++++++--------
25 1 file changed, 6 insertions(+), 8 deletions(-)
27 --- a/drivers/net/dsa/qca/qca8k-8xxx.c
28 +++ b/drivers/net/dsa/qca/qca8k-8xxx.c
29 @@ -1885,18 +1885,16 @@ qca8k_setup(struct dsa_switch *ds)
33 + /* CPU port gets connected to all user ports of the switch */
34 + ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port),
35 + QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds));
39 /* Setup connection between CPU port & user ports
40 * Configure specific switch configuration for ports
42 for (i = 0; i < QCA8K_NUM_PORTS; i++) {
43 - /* CPU port gets connected to all user ports of the switch */
44 - if (dsa_is_cpu_port(ds, i)) {
45 - ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
46 - QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds));
51 /* Individual user ports get connected to CPU port only */
52 if (dsa_is_user_port(ds, i)) {
53 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),