From: Antoine Tenart <hidden> Date: 2017-08-25 14:15:34
Hi all,
The MAC address retrieval logic was broken and when using the PPv2
driver on PPv2.2 engines I ended up using the same mac address on all
ports. This series of patches fixes this, and also tackle a possible bug
when defining the mac address in the device tree.
Patch 1/4 can be applied to relevant stable trees (4.12+).
The series applies on net/master (9b4e946ce14e).
Thanks!
Antoine
Since v1:
- Rebased onto net (was on net-next).
Antoine Tenart (4):
net: mvpp2: fix the mac address used when using PPv2.2
net: mvpp2: move the mac retrieval/copy logic into its own function
net: mvpp2: fix use of the random mac address for PPv2.2
net: mvpp2: fallback using h/w and random mac if the dt one isn't
valid
drivers/net/ethernet/marvell/mvpp2.c | 48 ++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 18 deletions(-)
--
2.13.5
From: Antoine Tenart <hidden> Date: 2017-08-25 14:15:14
The mac address is only retrieved from h/w when using PPv2.1. Otherwise
the variable holding it is still checked and used if it contains a valid
value. As the variable isn't initialized to an invalid mac address
value, we end up with random mac addresses which can be the same for all
the ports handled by this PPv2 driver.
Fixes this by initializing the h/w mac address variable to {0}, which is
an invalid mac address value. This way the random assignation fallback
is called and all ports end up with their own addresses.
Signed-off-by: Antoine Tenart <redacted>
Fixes: 2697582144dd ("net: mvpp2: handle misc PPv2.1/PPv2.2 differences")
---
drivers/net/ethernet/marvell/mvpp2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Antoine Tenart <hidden> Date: 2017-08-25 14:15:15
The MAC retrieval has a quite complicated logic (which is broken). Moves
it to its own function to prepare for patches fixing its logic, so that
reviews are easier.
Signed-off-by: Antoine Tenart <redacted>
---
drivers/net/ethernet/marvell/mvpp2.c | 45 +++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 18 deletions(-)
From: Antoine Tenart <hidden> Date: 2017-08-25 14:15:59
When using a mac address described in the device tree, a check is made
to see if it is valid. When it's not, no fallback is defined. This
patches tries to get the mac address from h/w (or use a random one if
the h/w one isn't valid) when the dt mac address isn't valid.
Signed-off-by: Antoine Tenart <redacted>
---
drivers/net/ethernet/marvell/mvpp2.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
From: Antoine Tenart <hidden> Date: 2017-08-25 14:16:36
The MAC retrieval logic is using a variable to store an h/w stored mac
address and checks this mac against invalid ones before using it. But
the mac address is only read from h/w when using PPv2.1. So when using
PPv2.2 it defaults to its init state.
This patches fixes the logic to only check if the h/w mac is valid when
actually retrieving a mac from h/w.
Signed-off-by: Antoine Tenart <redacted>
---
drivers/net/ethernet/marvell/mvpp2.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-08-25 14:19:47
On Fri, Aug 25, 2017 at 04:14:17PM +0200, Antoine Tenart wrote:
The mac address is only retrieved from h/w when using PPv2.1. Otherwise
the variable holding it is still checked and used if it contains a valid
value. As the variable isn't initialized to an invalid mac address
value, we end up with random mac addresses which can be the same for all
the ports handled by this PPv2 driver.
Fixes this by initializing the h/w mac address variable to {0}, which is
an invalid mac address value. This way the random assignation fallback
is called and all ports end up with their own addresses.
Signed-off-by: Antoine Tenart <redacted>
Fixes: 2697582144dd ("net: mvpp2: handle misc PPv2.1/PPv2.2 differences")
Hi Antoine
Is this patch alone sufficient to fix the problem?
Ideally, you want a minimal patch for stable, i.e. -net, and a fuller
fix can go into net-next.
Andrew
From: Antoine Tenart <hidden> Date: 2017-08-25 14:29:41
Hi Andrew,
On Fri, Aug 25, 2017 at 04:19:39PM +0200, Andrew Lunn wrote:
On Fri, Aug 25, 2017 at 04:14:17PM +0200, Antoine Tenart wrote:
quoted
The mac address is only retrieved from h/w when using PPv2.1. Otherwise
the variable holding it is still checked and used if it contains a valid
value. As the variable isn't initialized to an invalid mac address
value, we end up with random mac addresses which can be the same for all
the ports handled by this PPv2 driver.
Fixes this by initializing the h/w mac address variable to {0}, which is
an invalid mac address value. This way the random assignation fallback
is called and all ports end up with their own addresses.
Signed-off-by: Antoine Tenart <redacted>
Fixes: 2697582144dd ("net: mvpp2: handle misc PPv2.1/PPv2.2 differences")
Is this patch alone sufficient to fix the problem?
Yes it is.
Ideally, you want a minimal patch for stable, i.e. -net, and a fuller
fix can go into net-next.
That was my intention (providing a minimal patch for stable), and I
asked about this approach in the v1. Dave told me to resend the series
to net. Maybe my questions weren't clear enough.
So probably the best way to handle this would have been to send 1/4 to
net and 2-4/4 to net-next (but then there's a dependency between the two
series).
Let's wait for Dave's answer, I'll respin if needed so that it's easy
for him to apply it.
Thanks!
Antoine
--
Antoine Ténart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
From: Antoine Tenart <hidden> Date: 2017-08-25 15:54:47
On Fri, Aug 25, 2017 at 05:42:47PM +0200, Andrew Lunn wrote:
quoted
So probably the best way to handle this would have been to send 1/4 to
net and 2-4/4 to net-next
Correct.
quoted
(but then there's a dependency between the two series).
Dave merges net into net-next every so often. So you just need to wait
a bit before submitting the net-next parts.
I see. So Dave can take patch 1/4 and I'll respin the others once it's
merged into net-next.
Thanks!
Antoine
--
Antoine Ténart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
From: David Miller <davem@davemloft.net> Date: 2017-08-28 18:26:07
From: Antoine Tenart <redacted>
Date: Fri, 25 Aug 2017 16:14:17 +0200
The mac address is only retrieved from h/w when using PPv2.1. Otherwise
the variable holding it is still checked and used if it contains a valid
value. As the variable isn't initialized to an invalid mac address
value, we end up with random mac addresses which can be the same for all
the ports handled by this PPv2 driver.
Fixes this by initializing the h/w mac address variable to {0}, which is
an invalid mac address value. This way the random assignation fallback
is called and all ports end up with their own addresses.
Signed-off-by: Antoine Tenart <redacted>
Fixes: 2697582144dd ("net: mvpp2: handle misc PPv2.1/PPv2.2 differences")