]> git.ipfire.org Git - thirdparty/openwrt.git/blob
22b544c4333873da26cc92c7a4e659d77a7d41ce
[thirdparty/openwrt.git] /
1 From e85d3e6fea05c8ae21a40809a3c6b7adc97411c7 Mon Sep 17 00:00:00 2001
2 Message-ID: <e85d3e6fea05c8ae21a40809a3c6b7adc97411c7.1728674648.git.mschiffer@universe-factory.net>
3 From: Matthias Schiffer <mschiffer@universe-factory.net>
4 Date: Thu, 20 Jun 2024 19:25:48 +0200
5 Subject: [PATCH] net: dsa: qca8k: do not write port mask twice in bridge
6 join/leave
7
8 qca8k_port_bridge_join() set QCA8K_PORT_LOOKUP_CTRL() for i == port twice,
9 once in the loop handling all other port's masks, and finally at the end
10 with the accumulated port_mask.
11
12 The first time it would incorrectly set the port's own bit in the mask,
13 only to correct the mistake a moment later. qca8k_port_bridge_leave() had
14 the same issue, but here the regmap_clear_bits() was a no-op rather than
15 setting an unintended value.
16
17 Remove the duplicate assignment by skipping the whole loop iteration for
18 i == port. The unintended bit setting doesn't seem to have any negative
19 effects (even when not reverted right away), so the change is submitted
20 as a simple cleanup rather than a fix.
21
22 Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
23 Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
24 Signed-off-by: David S. Miller <davem@davemloft.net>
25 ---
26 drivers/net/dsa/qca/qca8k-common.c | 7 +++++--
27 1 file changed, 5 insertions(+), 2 deletions(-)
28
29 --- a/drivers/net/dsa/qca/qca8k-common.c
30 +++ b/drivers/net/dsa/qca/qca8k-common.c
31 @@ -654,6 +654,8 @@ int qca8k_port_bridge_join(struct dsa_sw
32 port_mask = BIT(cpu_port);
33
34 for (i = 0; i < QCA8K_NUM_PORTS; i++) {
35 + if (i == port)
36 + continue;
37 if (dsa_is_cpu_port(ds, i))
38 continue;
39 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
40 @@ -666,8 +668,7 @@ int qca8k_port_bridge_join(struct dsa_sw
41 BIT(port));
42 if (ret)
43 return ret;
44 - if (i != port)
45 - port_mask |= BIT(i);
46 + port_mask |= BIT(i);
47 }
48
49 /* Add all other ports to this ports portvlan mask */
50 @@ -686,6 +687,8 @@ void qca8k_port_bridge_leave(struct dsa_
51 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
52
53 for (i = 0; i < QCA8K_NUM_PORTS; i++) {
54 + if (i == port)
55 + continue;
56 if (dsa_is_cpu_port(ds, i))
57 continue;
58 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))