Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch,
	vivien.didelot@gmail.com, f.fainelli@gmail.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2 net-next 8/8] net: dsa: mv88e6xxx: Offload bridge broadcast flooding flag
Date: Thu, 18 Mar 2021 16:35:05 +0200	[thread overview]
Message-ID: <20210318143505.5lu3ebozbkrayygp@skbuf> (raw)
In-Reply-To: <20210318141550.646383-9-tobias@waldekranz.com>

On Thu, Mar 18, 2021 at 03:15:50PM +0100, Tobias Waldekranz wrote:
> These switches have two modes of classifying broadcast:
> 
> 1. Broadcast is multicast.
> 2. Broadcast is its own unique thing that is always flooded
>    everywhere.
> 
> This driver uses the first option, making sure to load the broadcast
> address into all active databases. Because of this, we can support
> per-port broadcast flooding by (1) making sure to only set the subset
> of ports that have it enabled whenever joining a new bridge or VLAN,
> and (2) by updating all active databases whenever the setting is
> changed on a port.
> 
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---
>  drivers/net/dsa/mv88e6xxx/chip.c | 73 +++++++++++++++++++++++++++++++-
>  1 file changed, 72 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index 7976fb699086..3baa4dadb0dd 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1982,6 +1982,21 @@ static int mv88e6xxx_broadcast_setup(struct mv88e6xxx_chip *chip, u16 vid)
>  	int err;
>  
>  	for (port = 0; port < mv88e6xxx_num_ports(chip); port++) {
> +		struct dsa_port *dp = dsa_to_port(chip->ds, port);
> +		struct net_device *brport;
> +
> +		if (dsa_is_unused_port(chip->ds, port))
> +			continue;
> +
> +		brport = dsa_port_to_bridge_port(dp);
> +
> +		if (dp->bridge_dev &&
> +		    !br_port_flag_is_set(brport, BR_BCAST_FLOOD))

I think I would have liked to see a dsa_port_to_bridge_port helper that
actually returns NULL when dp->bridge_dev is NULL.

This would make your piece of code look as follows:

		brport = dsa_port_to_bridge_port(dp);
		if (brport && !br_port_flag_is_set(brport, BR_BCAST_FLOOD)
			continue;

> +			/* Skip bridged user ports where broadcast
> +			 * flooding is disabled.
> +			 */
> +			continue;
> +
>  		err = mv88e6xxx_port_add_broadcast(chip, port, vid);
>  		if (err)
>  			return err;

  reply	other threads:[~2021-03-18 14:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 14:15 [PATCH v2 net-next 0/8] net: dsa: mv88e6xxx: Offload bridge port flags Tobias Waldekranz
2021-03-18 14:15 ` [PATCH v2 net-next 1/8] net: dsa: Add helper to resolve bridge port from DSA port Tobias Waldekranz
2021-03-18 14:44   ` Vladimir Oltean
2021-03-18 16:08   ` Florian Fainelli
2021-03-18 14:15 ` [PATCH v2 net-next 2/8] net: dsa: mv88e6xxx: Avoid useless attempts to fast-age LAGs Tobias Waldekranz
2021-03-18 14:36   ` Vladimir Oltean
2021-03-18 16:08   ` Florian Fainelli
2021-03-18 14:15 ` [PATCH v2 net-next 3/8] net: dsa: mv88e6xxx: Provide generic VTU iterator Tobias Waldekranz
2021-03-18 14:26   ` Vladimir Oltean
2021-03-18 16:09   ` Florian Fainelli
2021-03-18 14:15 ` [PATCH v2 net-next 4/8] net: dsa: mv88e6xxx: Remove some bureaucracy around querying the VTU Tobias Waldekranz
2021-03-18 14:28   ` Vladimir Oltean
2021-03-18 16:10   ` Florian Fainelli
2021-03-18 14:15 ` [PATCH v2 net-next 5/8] net: dsa: mv88e6xxx: Use standard helper for broadcast address Tobias Waldekranz
2021-03-18 14:28   ` Vladimir Oltean
2021-03-18 16:10   ` Florian Fainelli
2021-03-18 14:15 ` [PATCH v2 net-next 6/8] net: dsa: mv88e6xxx: Flood all traffic classes on standalone ports Tobias Waldekranz
2021-03-18 14:15 ` [PATCH v2 net-next 7/8] net: dsa: mv88e6xxx: Offload bridge learning flag Tobias Waldekranz
2021-03-18 14:30   ` Vladimir Oltean
2021-03-18 16:11   ` Florian Fainelli
2021-03-18 14:15 ` [PATCH v2 net-next 8/8] net: dsa: mv88e6xxx: Offload bridge broadcast flooding flag Tobias Waldekranz
2021-03-18 14:35   ` Vladimir Oltean [this message]
2021-03-18 16:14     ` Florian Fainelli

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=20210318143505.5lu3ebozbkrayygp@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tobias@waldekranz.com \
    --cc=vivien.didelot@gmail.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