Subject: RE: Potential issue with PHYs connected to the same MDIO bus and different MACs

From: <[email-masked]>
Date: Sat, 5 Nov 2022 18:14:02 +0100

Oh, my!
Yes, this is so obvious but I could not see it...!
I really thank you for your time, and I apologize for overlooking this.

Kind Regards,
Piergiorgio

-----Original Message-----
From: Vladimir Oltean <[email-masked]> 
Sent: 5 November, 2022 17:38
To: [email-masked]
Cc: [email-masked]
Subject: Re: Potential issue with PHYs connected to the same MDIO bus and
different MACs

On Sat, Nov 05, 2022 at 03:39:07PM +0100, [email-masked]
wrote:
>    priv->phylink_config.dev = &pdev->dev;
>    priv->phylink_config.type = PHYLINK_NETDEV;

The problem is here. You think that &pdev->dev is the same as &ndev->dev,
but it isn't (and it's SET_NETDEV_DEV that makes the linkage between the 2).
Use &ndev->dev here, and check out how phylink uses the "dev" field:

#define to_net_dev(d) container_of(d, struct net_device, dev)

	if (config->type == PHYLINK_NETDEV) {
		pl->netdev = to_net_dev(config->dev);