netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: Andrew Lunn <andrew@lunn.ch>, David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>, Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next 6/6] net: dsa: mv88e6xxx: Flood broadcast frames in hardware
Date: Wed, 27 Sep 2017 14:24:45 -0400	[thread overview]
Message-ID: <8737786lua.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <1506464764-12699-7-git-send-email-andrew@lunn.ch>

Hi Andrew,

Andrew Lunn <andrew@lunn.ch> writes:

> +static int mv88e6xxx_port_add_broadcast(struct mv88e6xxx_chip *chip, int port,
> +					u16 vid)
> +{
> +	const char broadcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
> +
> +	return mv88e6xxx_port_db_load_purge(
> +		chip, port, broadcast, vid,
> +		MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC);

Please don't do this. This is not a valid coding style and has already
shown to be a bad example for other DSA drivers copying mv88e6xxx.

Simply declare u8 state = MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC above...

> +}
> +
> +static int mv88e6xxx_broadcast_setup(struct mv88e6xxx_chip *chip, u16 vid)
> +{
> +	int port;
> +	int err;
> +
> +	for (port = 0; port < mv88e6xxx_num_ports(chip); ++port) {
> +		err = mv88e6xxx_port_add_broadcast(chip, port, vid);
> +		if (err)
> +			return err;
> +	}
> +
> +	return 0;
> +}
> +
>  static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port,
>  				    u16 vid, u8 member)
>  {
> @@ -1247,7 +1271,11 @@ static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port,
>  
>  	vlan.member[port] = member;
>  
> -	return mv88e6xxx_vtu_loadpurge(chip, &vlan);
> +	err = mv88e6xxx_vtu_loadpurge(chip, &vlan);
> +	if (err)
> +		return err;
> +
> +	return mv88e6xxx_broadcast_setup(chip, vid);
>  }
>  
>  static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
> @@ -2025,6 +2053,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
>  	if (err)
>  		goto unlock;
>  
> +	err = mv88e6xxx_broadcast_setup(chip, 0);
> +	if (err)
> +		goto unlock;
> +
>  	err = mv88e6xxx_pot_setup(chip);
>  	if (err)
>  		goto unlock;


Adding the broadcast address to an Ethernet switch's FDB is pretty
generic and mv88e6xxx mustn't be the only driver doing this.

They do not have to care about the broadcast address, this is just a
standard MDB entry for them. This must be moved up to the DSA layer.

Adding the broadcast address in dsa_port_vlan_add and dsa_port_enable
like this should be enough: http://ix.io/AmS


Thanks,

        Vivien

  reply	other threads:[~2017-09-27 18:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26 22:25 [PATCH net-next 0/6] mv88e6xxx broadcast flooding in hardware Andrew Lunn
2017-09-26 22:25 ` [PATCH net-next 1/6] net: dsa: Fix SWITCHDEV_ATTR_ID_PORT_PARENT_ID Andrew Lunn
2017-09-27 10:15   ` Sergei Shtylyov
2017-09-27 15:31   ` Vivien Didelot
2017-09-26 22:25 ` [PATCH net-next 2/6] net: dsa: {e}dsa: set offload_fwd_mark on received packets Andrew Lunn
2017-09-27 19:46   ` Florian Fainelli
2017-09-27 20:11     ` Andrew Lunn
2017-09-26 22:26 ` [PATCH net-next 3/6] net: dsa: mv88e6xxx: Fixed port netdev check for VLANs Andrew Lunn
2017-09-26 22:26 ` [PATCH net-next 4/6] net: dsa: mv88e6xxx: Print offending port when vlan check fails Andrew Lunn
2017-09-27 15:49   ` Vivien Didelot
2017-09-26 22:26 ` [PATCH net-next 5/6] net: dsa: mv88e6xxx: Move mv88e6xxx_port_db_load_purge() Andrew Lunn
2017-09-27 15:51   ` Vivien Didelot
2017-09-26 22:26 ` [PATCH net-next 6/6] net: dsa: mv88e6xxx: Flood broadcast frames in hardware Andrew Lunn
2017-09-27 18:24   ` Vivien Didelot [this message]
2017-09-27 18:36     ` Andrew Lunn
2017-09-27 18:59       ` Vivien Didelot
2017-09-27 18:37     ` Florian Fainelli
2017-09-27 18:46       ` Andrew Lunn
2017-09-27 19:19         ` Vivien Didelot
2017-09-27 19:33           ` Florian Fainelli
2017-09-27 20:18             ` Andrew Lunn
2017-09-26 22:26 ` [PATCH 6/6] net: dsa: mv88e6xxx: Forward broadcast frames to cpu and dsa ports Andrew Lunn
2017-09-26 22:43   ` Andrew Lunn
2017-09-27  3:20   ` David Miller
2017-09-27 18:28 ` [PATCH net-next 0/6] mv88e6xxx broadcast flooding in hardware Vivien Didelot

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=8737786lua.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me \
    --to=vivien.didelot@savoirfairelinux.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).