From: Vladimir Oltean <olteanv@gmail.com>
To: Matthias Schiffer <mschiffer@universe-factory.net>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
"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 2/3] net: dsa: qca8k: factor out bridge join/leave logic
Date: Fri, 21 Jun 2024 19:48:08 +0300 [thread overview]
Message-ID: <20240621164808.saiic5utb2fcazsq@skbuf> (raw)
In-Reply-To: <7fbdc27fab4df365db91defca8037b87bdf49438.1718899575.git.mschiffer@universe-factory.net>
On Thu, Jun 20, 2024 at 07:25:49PM +0200, Matthias Schiffer wrote:
> diff --git a/drivers/net/dsa/qca/qca8k-common.c b/drivers/net/dsa/qca/qca8k-common.c
> index b33df84070d3..09108fa99dbe 100644
> --- a/drivers/net/dsa/qca/qca8k-common.c
> +++ b/drivers/net/dsa/qca/qca8k-common.c
> @@ -614,6 +614,49 @@ void qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
> qca8k_port_configure_learning(ds, port, learning);
> }
>
> +static int qca8k_update_port_member(struct qca8k_priv *priv, int port,
> + const struct net_device *bridge_dev,
> + bool join)
> +{
> + struct dsa_port *dp = dsa_to_port(priv->ds, port), *other_dp;
> + u32 port_mask = BIT(dp->cpu_dp->index);
> + int i, ret;
> +
> + for (i = 0; i < QCA8K_NUM_PORTS; i++) {
> + if (i == port)
> + continue;
> + if (dsa_is_cpu_port(priv->ds, i))
> + continue;
> +
> + other_dp = dsa_to_port(priv->ds, i);
I would have liked to see less of the "dsa_to_port() in a loop"
antipattern.
https://lore.kernel.org/netdev/20211018152136.2595220-7-vladimir.oltean@nxp.com/T/
I'll send a patch which refactors the new function to use
dsa_switch_for_each_user_port().
next prev parent reply other threads:[~2024-06-21 16: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
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 [this message]
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=20240621164808.saiic5utb2fcazsq@skbuf \
--to=olteanv@gmail.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=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