From: David Laight <David.Laight@ACULAB.COM>
To: "'Vivien Didelot'" <vivien.didelot@savoirfairelinux.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kernel@savoirfairelinux.com" <kernel@savoirfairelinux.com>,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>
Subject: RE: [PATCH net-next v3 3/5] net: dsa: mv88e6060: setup random mac address
Date: Mon, 16 Oct 2017 09:05:28 +0000 [thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD0097993@AcuExch.aculab.com> (raw)
In-Reply-To: <20171013181809.14627-4-vivien.didelot@savoirfairelinux.com>
From: Vivien Didelot
> Sent: 13 October 2017 19:18
> As for mv88e6xxx, setup the switch from within the mv88e6060 driver with
> a random MAC address, and remove the .set_addr implementation.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> drivers/net/dsa/mv88e6060.c | 43 ++++++++++++++++++++++++++-----------------
> 1 file changed, 26 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> index d64be2b83d3c..6173be889d95 100644
> --- a/drivers/net/dsa/mv88e6060.c
> +++ b/drivers/net/dsa/mv88e6060.c
> @@ -9,6 +9,7 @@
> */
>
> #include <linux/delay.h>
> +#include <linux/etherdevice.h>
> #include <linux/jiffies.h>
> #include <linux/list.h>
> #include <linux/module.h>
> @@ -188,6 +189,27 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
> return 0;
> }
>
> +static int mv88e6060_setup_addr(struct dsa_switch *ds)
> +{
> + u8 addr[ETH_ALEN];
> + u16 val;
> +
> + eth_random_addr(addr);
> +
> + val = addr[0] << 8 | addr[1];
> +
> + /* The multicast bit is always transmitted as a zero, so the switch uses
> + * bit 8 for "DiffAddr", where 0 means all ports transmit the same SA.
> + */
> + val &= 0xfeff;
The comment is probably ok, but the mask isn't needed.
eth_randmon_addr() won't return and address with the multicast bit set.
David
next prev parent reply other threads:[~2017-10-16 9:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 18:18 [PATCH net-next v3 0/5] net: dsa: remove .set_addr Vivien Didelot
2017-10-13 18:18 ` [PATCH net-next v3 1/5] net: dsa: mv88e6xxx: setup random mac address Vivien Didelot
2017-10-13 18:18 ` [PATCH net-next v3 2/5] net: dsa: mv88e6060: fix switch MAC address Vivien Didelot
2017-10-13 18:18 ` [PATCH net-next v3 3/5] net: dsa: mv88e6060: setup random mac address Vivien Didelot
2017-10-16 9:05 ` David Laight [this message]
2017-10-13 18:18 ` [PATCH net-next v3 4/5] net: dsa: dsa_loop: remove .set_addr Vivien Didelot
2017-10-13 18:18 ` [PATCH net-next v3 5/5] net: dsa: " Vivien Didelot
2017-10-15 1:30 ` [PATCH net-next v3 0/5] " David Miller
2017-10-16 15:23 ` Rodney Cummings
2017-10-16 16:09 ` Andrew Lunn
2017-10-16 16:28 ` Rodney Cummings
2017-10-16 16:47 ` Andrew Lunn
2017-10-16 16:52 ` Rodney Cummings
2017-10-16 16:57 ` Andrew Lunn
2017-10-16 18:14 ` Rodney Cummings
2017-10-16 16:30 ` David Laight
2017-10-16 16:44 ` Andrew Lunn
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=063D6719AE5E284EB5DD2968C1650D6DD0097993@AcuExch.aculab.com \
--to=david.laight@aculab.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.