All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] net: dsa: remove .set_addr
@ 2017-10-13  1:41 Vivien Didelot
  2017-10-13  1:41 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: setup random mac address Vivien Didelot
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Vivien Didelot @ 2017-10-13  1:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

An Ethernet switch may support having a MAC address, which can be used
as the switch's source address in transmitted full-duplex Pause frames.

If a DSA switch supports the related .set_addr operation, the DSA core
sets the master's MAC address on the switch.

This won't make sense anymore in a multi-CPU ports system, because there
won't be a unique master device assigned to a switch tree.

Moreover this operation is confusing because it makes the user think
that it could be used to program the switch with the MAC address of the
CPU/management port such that MAC address learning can be disabled on
said port, but in fact, that's not how it is currently used.

To fix this, assign a random MAC address at setup time in the mv88e6060
and mv88e6xxx drivers before removing .set_addr completely from DSA.

Changes in v2:
  - remove .set_addr implementation from drivers and use a random MAC.

Vivien Didelot (4):
  net: dsa: mv88e6xxx: setup random mac address
  net: dsa: mv88e6060: setup random mac address
  net: dsa: dsa_loop: remove .set_addr
  net: dsa: remove .set_addr

 drivers/net/dsa/dsa_loop.c       |  8 --------
 drivers/net/dsa/mv88e6060.c      | 30 +++++++++++++++++++-----------
 drivers/net/dsa/mv88e6xxx/chip.c | 33 +++++++++++++++++----------------
 include/net/dsa.h                |  1 -
 net/dsa/dsa2.c                   |  6 ------
 net/dsa/legacy.c                 |  6 ------
 6 files changed, 36 insertions(+), 48 deletions(-)

-- 
2.14.2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: setup random mac address
  2017-10-13  1:41 [PATCH net-next v2 0/4] net: dsa: remove .set_addr Vivien Didelot
@ 2017-10-13  1:41 ` Vivien Didelot
  2017-10-13  1:41 ` [PATCH net-next v2 2/4] net: dsa: mv88e6060: " Vivien Didelot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Vivien Didelot @ 2017-10-13  1:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

An Ethernet switch may support having a MAC address, which can be used
as the switch's source address in transmitted full-duplex Pause frames.

If a DSA switch supports the related .set_addr operation, the DSA core
sets the master's MAC address on the switch. This won't make sense
anymore in a multi-CPU ports system, because there won't be a unique
master device assigned to a switch tree.

Instead, setup the switch from within the Marvell driver with a random
MAC address, and remove the .set_addr implementation.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index d74c7335c512..76cf383dcf90 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -932,6 +932,19 @@ static int mv88e6xxx_irl_setup(struct mv88e6xxx_chip *chip)
 	return 0;
 }
 
+static int mv88e6xxx_mac_setup(struct mv88e6xxx_chip *chip)
+{
+	if (chip->info->ops->set_switch_mac) {
+		u8 addr[ETH_ALEN];
+
+		eth_random_addr(addr);
+
+		return chip->info->ops->set_switch_mac(chip, addr);
+	}
+
+	return 0;
+}
+
 static int mv88e6xxx_pvt_map(struct mv88e6xxx_chip *chip, int dev, int port)
 {
 	u16 pvlan = 0;
@@ -2013,6 +2026,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
 	if (err)
 		goto unlock;
 
+	err = mv88e6xxx_mac_setup(chip);
+	if (err)
+		goto unlock;
+
 	err = mv88e6xxx_phy_setup(chip);
 	if (err)
 		goto unlock;
@@ -2043,21 +2060,6 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
 	return err;
 }
 
-static int mv88e6xxx_set_addr(struct dsa_switch *ds, u8 *addr)
-{
-	struct mv88e6xxx_chip *chip = ds->priv;
-	int err;
-
-	if (!chip->info->ops->set_switch_mac)
-		return -EOPNOTSUPP;
-
-	mutex_lock(&chip->reg_lock);
-	err = chip->info->ops->set_switch_mac(chip, addr);
-	mutex_unlock(&chip->reg_lock);
-
-	return err;
-}
-
 static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)
 {
 	struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv;
@@ -3785,7 +3787,6 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
 	.probe			= mv88e6xxx_drv_probe,
 	.get_tag_protocol	= mv88e6xxx_get_tag_protocol,
 	.setup			= mv88e6xxx_setup,
-	.set_addr		= mv88e6xxx_set_addr,
 	.adjust_link		= mv88e6xxx_adjust_link,
 	.get_strings		= mv88e6xxx_get_strings,
 	.get_ethtool_stats	= mv88e6xxx_get_ethtool_stats,
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
  2017-10-13  1:41 [PATCH net-next v2 0/4] net: dsa: remove .set_addr Vivien Didelot
  2017-10-13  1:41 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: setup random mac address Vivien Didelot
@ 2017-10-13  1:41 ` Vivien Didelot
  2017-10-13 15:30   ` David Laight
  2017-10-13  1:41 ` [PATCH net-next v2 3/4] net: dsa: dsa_loop: remove .set_addr Vivien Didelot
  2017-10-13  1:41 ` [PATCH net-next v2 4/4] net: dsa: " Vivien Didelot
  3 siblings, 1 reply; 11+ messages in thread
From: Vivien Didelot @ 2017-10-13  1:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

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 | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 621cdc46ad81..2f9d5e6a0f97 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,20 @@ 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];
+
+	eth_random_addr(addr);
+
+	/* Use the same MAC Address as FD Pause frames for all ports */
+	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) | addr[1]);
+	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
+	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
+
+	return 0;
+}
+
 static int mv88e6060_setup(struct dsa_switch *ds)
 {
 	int ret;
@@ -203,6 +218,10 @@ static int mv88e6060_setup(struct dsa_switch *ds)
 	if (ret < 0)
 		return ret;
 
+	ret = mv88e6060_setup_addr(ds);
+	if (ret < 0)
+		return ret;
+
 	for (i = 0; i < MV88E6060_PORTS; i++) {
 		ret = mv88e6060_setup_port(ds, i);
 		if (ret < 0)
@@ -212,16 +231,6 @@ static int mv88e6060_setup(struct dsa_switch *ds)
 	return 0;
 }
 
-static int mv88e6060_set_addr(struct dsa_switch *ds, u8 *addr)
-{
-	/* Use the same MAC Address as FD Pause frames for all ports */
-	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) | addr[1]);
-	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_23, (addr[2] << 8) | addr[3]);
-	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_45, (addr[4] << 8) | addr[5]);
-
-	return 0;
-}
-
 static int mv88e6060_port_to_phy_addr(int port)
 {
 	if (port >= 0 && port < MV88E6060_PORTS)
@@ -256,7 +265,6 @@ static const struct dsa_switch_ops mv88e6060_switch_ops = {
 	.get_tag_protocol = mv88e6060_get_tag_protocol,
 	.probe		= mv88e6060_drv_probe,
 	.setup		= mv88e6060_setup,
-	.set_addr	= mv88e6060_set_addr,
 	.phy_read	= mv88e6060_phy_read,
 	.phy_write	= mv88e6060_phy_write,
 };
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net-next v2 3/4] net: dsa: dsa_loop: remove .set_addr
  2017-10-13  1:41 [PATCH net-next v2 0/4] net: dsa: remove .set_addr Vivien Didelot
  2017-10-13  1:41 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: setup random mac address Vivien Didelot
  2017-10-13  1:41 ` [PATCH net-next v2 2/4] net: dsa: mv88e6060: " Vivien Didelot
@ 2017-10-13  1:41 ` Vivien Didelot
  2017-10-13  1:41 ` [PATCH net-next v2 4/4] net: dsa: " Vivien Didelot
  3 siblings, 0 replies; 11+ messages in thread
From: Vivien Didelot @ 2017-10-13  1:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

The .set_addr function does nothing, remove the dsa_loop implementation
before getting rid of it completely in DSA.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 drivers/net/dsa/dsa_loop.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index d55051abf4ed..3a3f4f7ba364 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -110,13 +110,6 @@ static void dsa_loop_get_ethtool_stats(struct dsa_switch *ds, int port,
 		data[i] = ps->ports[port].mib[i].val;
 }
 
-static int dsa_loop_set_addr(struct dsa_switch *ds, u8 *addr)
-{
-	dev_dbg(ds->dev, "%s\n", __func__);
-
-	return 0;
-}
-
 static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum)
 {
 	struct dsa_loop_priv *ps = ds->priv;
@@ -263,7 +256,6 @@ static const struct dsa_switch_ops dsa_loop_driver = {
 	.get_strings		= dsa_loop_get_strings,
 	.get_ethtool_stats	= dsa_loop_get_ethtool_stats,
 	.get_sset_count		= dsa_loop_get_sset_count,
-	.set_addr		= dsa_loop_set_addr,
 	.phy_read		= dsa_loop_phy_read,
 	.phy_write		= dsa_loop_phy_write,
 	.port_bridge_join	= dsa_loop_port_bridge_join,
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH net-next v2 4/4] net: dsa: remove .set_addr
  2017-10-13  1:41 [PATCH net-next v2 0/4] net: dsa: remove .set_addr Vivien Didelot
                   ` (2 preceding siblings ...)
  2017-10-13  1:41 ` [PATCH net-next v2 3/4] net: dsa: dsa_loop: remove .set_addr Vivien Didelot
@ 2017-10-13  1:41 ` Vivien Didelot
  3 siblings, 0 replies; 11+ messages in thread
From: Vivien Didelot @ 2017-10-13  1:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

Now that there is no user for the .set_addr function, remove it from
DSA. If a switch supports this feature (like mv88e6xxx), the
implementation can be done in the driver setup.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 include/net/dsa.h | 1 -
 net/dsa/dsa2.c    | 6 ------
 net/dsa/legacy.c  | 6 ------
 3 files changed, 13 deletions(-)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index ce1d622734d7..2746741f74cf 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -291,7 +291,6 @@ struct dsa_switch_ops {
 	enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *ds);
 
 	int	(*setup)(struct dsa_switch *ds);
-	int	(*set_addr)(struct dsa_switch *ds, u8 *addr);
 	u32	(*get_phy_flags)(struct dsa_switch *ds, int port);
 
 	/*
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 54ed054777bd..6ac9e11d385c 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -336,12 +336,6 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
 	if (err)
 		return err;
 
-	if (ds->ops->set_addr) {
-		err = ds->ops->set_addr(ds, dst->cpu_dp->netdev->dev_addr);
-		if (err < 0)
-			return err;
-	}
-
 	if (!ds->slave_mii_bus && ds->ops->phy_read) {
 		ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
 		if (!ds->slave_mii_bus)
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index 19ff6e0a21dc..b0fefbffe082 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -172,12 +172,6 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
 	if (ret)
 		return ret;
 
-	if (ops->set_addr) {
-		ret = ops->set_addr(ds, master->dev_addr);
-		if (ret < 0)
-			return ret;
-	}
-
 	if (!ds->slave_mii_bus && ops->phy_read) {
 		ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
 		if (!ds->slave_mii_bus)
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
  2017-10-13  1:41 ` [PATCH net-next v2 2/4] net: dsa: mv88e6060: " Vivien Didelot
@ 2017-10-13 15:30   ` David Laight
  2017-10-13 16:02     ` Woojung.Huh
  0 siblings, 1 reply; 11+ messages in thread
From: David Laight @ 2017-10-13 15:30 UTC (permalink / raw)
  To: 'Vivien Didelot', netdev
  Cc: linux-kernel, kernel, David S. Miller, Florian Fainelli, Andrew Lunn

From: Vivien Didelot
> Sent: 13 October 2017 02:41
> 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 | 30 +++++++++++++++++++-----------
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> index 621cdc46ad81..2f9d5e6a0f97 100644
> --- a/drivers/net/dsa/mv88e6060.c
> +++ b/drivers/net/dsa/mv88e6060.c
...
> +	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) | addr[1]);

Is that supposed to be 9 ?

	David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
  2017-10-13 15:30   ` David Laight
@ 2017-10-13 16:02     ` Woojung.Huh
  2017-10-13 16:44       ` Vivien Didelot
  0 siblings, 1 reply; 11+ messages in thread
From: Woojung.Huh @ 2017-10-13 16:02 UTC (permalink / raw)
  To: David.Laight, vivien.didelot, netdev
  Cc: linux-kernel, kernel, davem, f.fainelli, andrew

> From: Vivien Didelot
> > Sent: 13 October 2017 02:41
> > 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 | 30 +++++++++++++++++++-----------
> >  1 file changed, 19 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> > index 621cdc46ad81..2f9d5e6a0f97 100644
> > --- a/drivers/net/dsa/mv88e6060.c
> > +++ b/drivers/net/dsa/mv88e6060.c
> ...
> > +	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) |
> addr[1]);
> 
> Is that supposed to be 9 ?

Looks like it.
Check http://www.marvell.com/switching/assets/marvell_linkstreet_88E6060_datasheet.pdf

Woojung

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
  2017-10-13 16:02     ` Woojung.Huh
@ 2017-10-13 16:44       ` Vivien Didelot
  2017-10-13 17:59         ` Woojung.Huh
  0 siblings, 1 reply; 11+ messages in thread
From: Vivien Didelot @ 2017-10-13 16:44 UTC (permalink / raw)
  To: Woojung.Huh, David.Laight, netdev
  Cc: linux-kernel, kernel, davem, f.fainelli, andrew

Hi David, Woojung,

Woojung.Huh@microchip.com writes:

>> From: Vivien Didelot
>> > Sent: 13 October 2017 02:41
>> > 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 | 30 +++++++++++++++++++-----------
>> >  1 file changed, 19 insertions(+), 11 deletions(-)
>> >
>> > diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
>> > index 621cdc46ad81..2f9d5e6a0f97 100644
>> > --- a/drivers/net/dsa/mv88e6060.c
>> > +++ b/drivers/net/dsa/mv88e6060.c
>> ...
>> > +	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) |
>> addr[1]);
>> 
>> Is that supposed to be 9 ?
>
> Looks like it.
> Check http://www.marvell.com/switching/assets/marvell_linkstreet_88E6060_datasheet.pdf

Hum, David is correct, there is a bug in the driver which needs to be
addressed first. MAC address bit 40 is addr[0] & 0x1, thus we must
shift byte 0 by 8 and mask it against 0xfe.

I'll respin this serie including a fix for both net and net-next.


Thanks,

        Vivien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
  2017-10-13 16:44       ` Vivien Didelot
@ 2017-10-13 17:59         ` Woojung.Huh
  2017-10-16  9:02             ` David Laight
  0 siblings, 1 reply; 11+ messages in thread
From: Woojung.Huh @ 2017-10-13 17:59 UTC (permalink / raw)
  To: vivien.didelot, David.Laight, netdev
  Cc: linux-kernel, kernel, davem, f.fainelli, andrew

Hi Vivien,

> >> > +	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) |
> >> addr[1]);
> >>
> >> Is that supposed to be 9 ?
> >
> > Looks like it.
> > Check
> http://www.marvell.com/switching/assets/marvell_linkstreet_88E6060_data
> sheet.pdf
> 
> Hum, David is correct, there is a bug in the driver which needs to be
> addressed first. MAC address bit 40 is addr[0] & 0x1, thus we must
> shift byte 0 by 8 and mask it against 0xfe.
> 
> I'll respin this serie including a fix for both net and net-next.

Yes, you are right. Missed description about bit 40.

Thanks.
Woojung

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
  2017-10-13 17:59         ` Woojung.Huh
@ 2017-10-16  9:02             ` David Laight
  0 siblings, 0 replies; 11+ messages in thread
From: David Laight @ 2017-10-16  9:02 UTC (permalink / raw)
  To: 'Woojung.Huh@microchip.com', vivien.didelot, netdev
  Cc: linux-kernel, kernel, davem, f.fainelli, andrew

From: Woojung.Huh@microchip.com
> Sent: 13 October 2017 18:59
> > >> > +	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) |
> > >> addr[1]);
> > >>
> > >> Is that supposed to be 9 ?
> > >
> > > Looks like it.
> > > Check
> > http://www.marvell.com/switching/assets/marvell_linkstreet_88E6060_data
> > sheet.pdf
> >
> > Hum, David is correct, there is a bug in the driver which needs to be
> > addressed first. MAC address bit 40 is addr[0] & 0x1, thus we must
> > shift byte 0 by 8 and mask it against 0xfe.
> >
> > I'll respin this serie including a fix for both net and net-next.
> 
> Yes, you are right. Missed description about bit 40.

Since they are all random numbers it doesn't matter.

Actually isn't this just masking off the non-unicast bit?
So it won't be set in the data - and so doesn't need masking.

	David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
@ 2017-10-16  9:02             ` David Laight
  0 siblings, 0 replies; 11+ messages in thread
From: David Laight @ 2017-10-16  9:02 UTC (permalink / raw)
  To: 'Woojung.Huh@microchip.com', vivien.didelot, netdev
  Cc: linux-kernel, kernel, davem, f.fainelli, andrew

From: Woojung.Huh@microchip.com
> Sent: 13 October 2017 18:59
> > >> > +	REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) |
> > >> addr[1]);
> > >>
> > >> Is that supposed to be 9 ?
> > >
> > > Looks like it.
> > > Check
> > http://www.marvell.com/switching/assets/marvell_linkstreet_88E6060_data
> > sheet.pdf
> >
> > Hum, David is correct, there is a bug in the driver which needs to be
> > addressed first. MAC address bit 40 is addr[0] & 0x1, thus we must
> > shift byte 0 by 8 and mask it against 0xfe.
> >
> > I'll respin this serie including a fix for both net and net-next.
> 
> Yes, you are right. Missed description about bit 40.

Since they are all random numbers it doesn't matter.

Actually isn't this just masking off the non-unicast bit?
So it won't be set in the data - and so doesn't need masking.

	David

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-10-16  9:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13  1:41 [PATCH net-next v2 0/4] net: dsa: remove .set_addr Vivien Didelot
2017-10-13  1:41 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: setup random mac address Vivien Didelot
2017-10-13  1:41 ` [PATCH net-next v2 2/4] net: dsa: mv88e6060: " Vivien Didelot
2017-10-13 15:30   ` David Laight
2017-10-13 16:02     ` Woojung.Huh
2017-10-13 16:44       ` Vivien Didelot
2017-10-13 17:59         ` Woojung.Huh
2017-10-16  9:02           ` David Laight
2017-10-16  9:02             ` David Laight
2017-10-13  1:41 ` [PATCH net-next v2 3/4] net: dsa: dsa_loop: remove .set_addr Vivien Didelot
2017-10-13  1:41 ` [PATCH net-next v2 4/4] net: dsa: " Vivien Didelot

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.