netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: change PHY error message again
@ 2020-08-23 21:35 Vladimir Oltean
  2020-08-23 22:26 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Oltean @ 2020-08-23 21:35 UTC (permalink / raw)
  To: netdev, davem; +Cc: andrew, f.fainelli, vivien.didelot

slave_dev->name is only populated at this stage if it was specified
through a label in the device tree. However that is not mandatory.
When it isn't, the error message looks like this:

[    5.037057] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
[    5.044672] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
[    5.052275] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
[    5.059877] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d

which is especially confusing since the error gets printed on behalf of
the DSA master (fsl_enetc in this case).

Printing an error message that contains a valid reference to the DSA
port's name is difficult at this point in the initialization stage, so
at least we should print some info that is more reliable, even if less
user-friendly. That may be the driver name and the hardware port index.

After this change, the error is printed as:

[    4.957403] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 0
[    4.964231] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 1
[    4.971055] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 2
[    4.977871] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 3

Fixes: 65951a9eb65e ("net: dsa: Improve subordinate PHY error message")
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
---
 net/dsa/slave.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 53310bbdeb0d..59e2d3c1a717 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1832,8 +1832,8 @@ int dsa_slave_create(struct dsa_port *port)
 
 	ret = dsa_slave_phy_setup(slave_dev);
 	if (ret) {
-		netdev_err(master, "error %d setting up slave PHY for %s\n",
-			   ret, slave_dev->name);
+		dev_err(ds->dev, "error %d setting up PHY for port %d\n",
+			ret, port->index);
 		goto out_gcells;
 	}
 
-- 
2.25.1


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

* Re: [PATCH net] net: dsa: change PHY error message again
  2020-08-23 21:35 [PATCH net] net: dsa: change PHY error message again Vladimir Oltean
@ 2020-08-23 22:26 ` Andrew Lunn
  2020-08-24  3:37   ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-08-23 22:26 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: netdev, davem, f.fainelli, vivien.didelot

On Mon, Aug 24, 2020 at 12:35:20AM +0300, Vladimir Oltean wrote:
> slave_dev->name is only populated at this stage if it was specified
> through a label in the device tree. However that is not mandatory.

Hi Vladimir

It is not mandatory, but it is normal.

> When it isn't, the error message looks like this:
> 
> [    5.037057] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
> [    5.044672] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
> [    5.052275] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
> [    5.059877] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
> 
> which is especially confusing since the error gets printed on behalf of
> the DSA master (fsl_enetc in this case).
> 
> Printing an error message that contains a valid reference to the DSA
> port's name is difficult at this point in the initialization stage, so
> at least we should print some info that is more reliable, even if less
> user-friendly. That may be the driver name and the hardware port index.
> 
> After this change, the error is printed as:
> 
> [    4.957403] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 0
> [    4.964231] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 1
> [    4.971055] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 2
> [    4.977871] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 3

I would prefer both the port number and the interface name. With
setups using D in DSA, there are examples where port 1 on the first
switch is lan1, and port 1 of the second switch is lan5. Having both
avoids some confusion.

Another option would be to call dev_alloc_name() after
alloc_netdev_mqs() if there is no label. The eth%d will then get
replaced with a unique name.

> Fixes: 65951a9eb65e ("net: dsa: Improve subordinate PHY error message")

I'm not sure this actually meets the stable criteria.

       Andrew

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

* Re: [PATCH net] net: dsa: change PHY error message again
  2020-08-23 22:26 ` Andrew Lunn
@ 2020-08-24  3:37   ` Florian Fainelli
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2020-08-24  3:37 UTC (permalink / raw)
  To: Andrew Lunn, Vladimir Oltean; +Cc: netdev, davem, vivien.didelot



On 8/23/2020 3:26 PM, Andrew Lunn wrote:
> On Mon, Aug 24, 2020 at 12:35:20AM +0300, Vladimir Oltean wrote:
>> slave_dev->name is only populated at this stage if it was specified
>> through a label in the device tree. However that is not mandatory.
> 
> Hi Vladimir
> 
> It is not mandatory, but it is normal.
> 
>> When it isn't, the error message looks like this:
>>
>> [    5.037057] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
>> [    5.044672] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
>> [    5.052275] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
>> [    5.059877] fsl_enetc 0000:00:00.2 eth2: error -19 setting up slave PHY for eth%d
>>
>> which is especially confusing since the error gets printed on behalf of
>> the DSA master (fsl_enetc in this case).
>>
>> Printing an error message that contains a valid reference to the DSA
>> port's name is difficult at this point in the initialization stage, so
>> at least we should print some info that is more reliable, even if less
>> user-friendly. That may be the driver name and the hardware port index.
>>
>> After this change, the error is printed as:
>>
>> [    4.957403] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 0
>> [    4.964231] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 1
>> [    4.971055] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 2
>> [    4.977871] mscc_felix 0000:00:00.5: error -19 setting up PHY for port 3
> 
> I would prefer both the port number and the interface name. With
> setups using D in DSA, there are examples where port 1 on the first
> switch is lan1, and port 1 of the second switch is lan5. Having both
> avoids some confusion.

How about printing the tree, switch id and port number that way we have 
all the uniquely identifying information at hand?

> 
> Another option would be to call dev_alloc_name() after
> alloc_netdev_mqs() if there is no label. The eth%d will then get
> replaced with a unique name.

That would work, too.

> 
>> Fixes: 65951a9eb65e ("net: dsa: Improve subordinate PHY error message")
> 
> I'm not sure this actually meets the stable criteria.

Agreed this might be a little bit too much.
-- 
Florian

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

end of thread, other threads:[~2020-08-24  3:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-23 21:35 [PATCH net] net: dsa: change PHY error message again Vladimir Oltean
2020-08-23 22:26 ` Andrew Lunn
2020-08-24  3:37   ` Florian Fainelli

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).