From: Wojciech Drewek <wojciech.drewek@intel.com>
To: Matthias Schiffer <mschiffer@universe-factory.net>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Christian Marangi <ansuelsmth@gmail.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 1/3] net: dsa: qca8k: do not write port mask twice in bridge join/leave
Date: Fri, 21 Jun 2024 12:48:37 +0200 [thread overview]
Message-ID: <0ec0c543-8b5e-427f-856d-69a9623bb84b@intel.com> (raw)
In-Reply-To: <9e5682c68a4930dae2e277b9cecc8b8ec97ba2af.1718899575.git.mschiffer@universe-factory.net>
On 20.06.2024 19:25, Matthias Schiffer wrote:
> qca8k_port_bridge_join() set QCA8K_PORT_LOOKUP_CTRL() for i == port twice,
> once in the loop handling all other port's masks, and finally at the end
> with the accumulated port_mask.
>
> The first time it would incorrectly set the port's own bit in the mask,
> only to correct the mistake a moment later. qca8k_port_bridge_leave() had
> the same issue, but here the regmap_clear_bits() was a no-op rather than
> setting an unintended value.
>
> Remove the duplicate assignment by skipping the whole loop iteration for
> i == port. The unintended bit setting doesn't seem to have any negative
> effects (even when not reverted right away), so the change is submitted
> as a simple cleanup rather than a fix.
>
> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> ---
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> drivers/net/dsa/qca/qca8k-common.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/dsa/qca/qca8k-common.c b/drivers/net/dsa/qca/qca8k-common.c
> index 7f80035c5441..b33df84070d3 100644
> --- a/drivers/net/dsa/qca/qca8k-common.c
> +++ b/drivers/net/dsa/qca/qca8k-common.c
> @@ -653,6 +653,8 @@ int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
> port_mask = BIT(cpu_port);
>
> for (i = 0; i < QCA8K_NUM_PORTS; i++) {
> + if (i == port)
> + continue;
> if (dsa_is_cpu_port(ds, i))
> continue;
> if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
> @@ -665,8 +667,7 @@ int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
> BIT(port));
> if (ret)
> return ret;
> - if (i != port)
> - port_mask |= BIT(i);
> + port_mask |= BIT(i);
> }
>
> /* Add all other ports to this ports portvlan mask */
> @@ -685,6 +686,8 @@ void qca8k_port_bridge_leave(struct dsa_switch *ds, int port,
> cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
>
> for (i = 0; i < QCA8K_NUM_PORTS; i++) {
> + if (i == port)
> + continue;
> if (dsa_is_cpu_port(ds, i))
> continue;
> if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
next prev parent reply other threads:[~2024-06-21 10:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 17:25 [PATCH net-next 0/3] net: dsa: qca8k: cleanup and port isolation Matthias Schiffer
2024-06-20 17:25 ` [PATCH net-next 1/3] net: dsa: qca8k: do not write port mask twice in bridge join/leave Matthias Schiffer
2024-06-21 10:48 ` Wojciech Drewek [this message]
2024-06-20 17:25 ` [PATCH net-next 2/3] net: dsa: qca8k: factor out bridge join/leave logic Matthias Schiffer
2024-06-21 10:51 ` Wojciech Drewek
2024-06-21 16:48 ` Vladimir Oltean
2024-06-20 17:25 ` [PATCH net-next 3/3] net: dsa: qca8k: add support for bridge port isolation Matthias Schiffer
2024-06-21 10:54 ` Wojciech Drewek
2024-06-21 16:46 ` Vladimir Oltean
2024-06-21 11:30 ` [PATCH net-next 0/3] net: dsa: qca8k: cleanup and " patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0ec0c543-8b5e-427f-856d-69a9623bb84b@intel.com \
--to=wojciech.drewek@intel.com \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mschiffer@universe-factory.net \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox