lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b9481bf5-c36e-45da-a718-0c7a254ff3d9@intel.com>
Date: Fri, 21 Jun 2024 12:54:34 +0200
From: Wojciech Drewek <wojciech.drewek@...el.com>
To: Matthias Schiffer <mschiffer@...verse-factory.net>, Andrew Lunn
	<andrew@...n.ch>, Florian Fainelli <f.fainelli@...il.com>, Vladimir Oltean
	<olteanv@...il.com>
CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, Christian Marangi <ansuelsmth@...il.com>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 3/3] net: dsa: qca8k: add support for bridge port
 isolation



On 20.06.2024 19:25, Matthias Schiffer wrote:
> Remove a pair of ports from the port matrix when both ports have the
> isolated flag set.
> 
> Signed-off-by: Matthias Schiffer <mschiffer@...verse-factory.net>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@...el.com>

>  drivers/net/dsa/qca/qca8k-common.c | 22 ++++++++++++++++++++--
>  drivers/net/dsa/qca/qca8k.h        |  1 +
>  2 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/qca/qca8k-common.c b/drivers/net/dsa/qca/qca8k-common.c
> index 09108fa99dbe..560c74c4ac3d 100644
> --- a/drivers/net/dsa/qca/qca8k-common.c
> +++ b/drivers/net/dsa/qca/qca8k-common.c
> @@ -618,6 +618,7 @@ static int qca8k_update_port_member(struct qca8k_priv *priv, int port,
>  				    const struct net_device *bridge_dev,
>  				    bool join)
>  {
> +	bool isolated = !!(priv->port_isolated_map & BIT(port)), other_isolated;
>  	struct dsa_port *dp = dsa_to_port(priv->ds, port), *other_dp;
>  	u32 port_mask = BIT(dp->cpu_dp->index);
>  	int i, ret;
> @@ -632,10 +633,12 @@ static int qca8k_update_port_member(struct qca8k_priv *priv, int port,
>  		if (!dsa_port_offloads_bridge_dev(other_dp, bridge_dev))
>  			continue;
>  
> +		other_isolated = !!(priv->port_isolated_map & BIT(i));
> +
>  		/* Add/remove this port to/from the portvlan mask of the other
>  		 * ports in the bridge
>  		 */
> -		if (join) {
> +		if (join && !(isolated && other_isolated)) {
>  			port_mask |= BIT(i);
>  			ret = regmap_set_bits(priv->regmap,
>  					      QCA8K_PORT_LOOKUP_CTRL(i),
> @@ -661,7 +664,7 @@ int qca8k_port_pre_bridge_flags(struct dsa_switch *ds, int port,
>  				struct switchdev_brport_flags flags,
>  				struct netlink_ext_ack *extack)
>  {
> -	if (flags.mask & ~BR_LEARNING)
> +	if (flags.mask & ~(BR_LEARNING | BR_ISOLATED))
>  		return -EINVAL;
>  
>  	return 0;
> @@ -671,6 +674,7 @@ int qca8k_port_bridge_flags(struct dsa_switch *ds, int port,
>  			    struct switchdev_brport_flags flags,
>  			    struct netlink_ext_ack *extack)
>  {
> +	struct qca8k_priv *priv = ds->priv;
>  	int ret;
>  
>  	if (flags.mask & BR_LEARNING) {
> @@ -680,6 +684,20 @@ int qca8k_port_bridge_flags(struct dsa_switch *ds, int port,
>  			return ret;
>  	}
>  
> +	if (flags.mask & BR_ISOLATED) {
> +		struct dsa_port *dp = dsa_to_port(ds, port);
> +		struct net_device *bridge_dev = dsa_port_bridge_dev_get(dp);
> +
> +		if (flags.val & BR_ISOLATED)
> +			priv->port_isolated_map |= BIT(port);
> +		else
> +			priv->port_isolated_map &= ~BIT(port);
> +
> +		ret = qca8k_update_port_member(priv, port, bridge_dev, true);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h
> index 2184d8d2d5a9..3664a2e2f1f6 100644
> --- a/drivers/net/dsa/qca/qca8k.h
> +++ b/drivers/net/dsa/qca/qca8k.h
> @@ -451,6 +451,7 @@ struct qca8k_priv {
>  	 * Bit 1: port enabled. Bit 0: port disabled.
>  	 */
>  	u8 port_enabled_map;
> +	u8 port_isolated_map;
>  	struct qca8k_ports_config ports_config;
>  	struct regmap *regmap;
>  	struct mii_bus *bus;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ