Skip to contentSkip to conversation

net: lan743x: LAN743X selects FIXED_PHY to resolve a link error

PATCH Superseded Tom Rix 4 participants 9 messages Feb 19, 2023 – Feb 27, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 net: lan743x: LAN743X selects FIXED_PHY to resolve a link error

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

---
 drivers/net/ethernet/microchip/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/microchip/Kconfig +1 -0
index 24c994baad13..43ba71e82260 100644
@@ -47,6 +47,7 @@ config LAN743X
 	depends on PCI
 	depends on PTP_1588_CLOCK_OPTIONAL
 	select PHYLIB
+	select FIXED_PHY
 	select CRC16
 	select CRC32
 	help
Signature · 1 line
2.27.0
#1 lore raw
Quoted 10 lines · Tom Rix

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Hi Tom,

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set. But I do not see a build failure, and I believe that is because when FIXED_PHY is not set then a stub version of fixed_phy_register(), defined as static inline in include/linux/phy_fixed.h, is used.

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

Quoted 19 lines
---
 drivers/net/ethernet/microchip/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/microchip/Kconfig +1 -0
index 24c994baad13..43ba71e82260 100644
@@ -47,6 +47,7 @@ config LAN743X
 	depends on PCI
 	depends on PTP_1588_CLOCK_OPTIONAL
 	select PHYLIB
+	select FIXED_PHY
 	select CRC16
 	select CRC32
 	help
Signature · 1 line
2.27.0
#2 lore raw
Quoted 14 lines · Simon Horman
Quoted 10 lines · Tom Rix

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Hi Tom,

Quoted 8 lines

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set. But I do not see a build failure, and I believe that is because when FIXED_PHY is not set then a stub version of fixed_phy_register(), defined as static inline in include/linux/phy_fixed.h, is used.

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY is a module? What might be needed is

depends on FIXED_PHY || FIXED_PHY=n

Andrew

#3 lore raw
Quoted 22 lines · Andrew Lunn
Quoted 21 lines · Simon Horman
Quoted 10 lines · Tom Rix

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Hi Tom,

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set. But I do not see a build failure, and I believe that is because when FIXED_PHY is not set then a stub version of fixed_phy_register(), defined as static inline in include/linux/phy_fixed.h, is used.

Quoted 6 lines
Quoted 1 line

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY is a module? What might be needed is

depends on FIXED_PHY || FIXED_PHY=n

Thanks Andrew,

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom describes. And his patch does appear to resolve the problem.

Unfortunately your proposed solution seems to run foul of a complex dependency situation.

$ make
...
drivers/net/ethernet/microchip/Kconfig:45:error: recursive dependency detected!
drivers/net/ethernet/microchip/Kconfig:45:	symbol LAN743X depends on FIXED_PHY
drivers/net/phy/Kconfig:48:	symbol FIXED_PHY depends on PHYLIB
drivers/net/phy/Kconfig:16:	symbol PHYLIB is selected by LAN743X
For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
#4 lore raw
Quoted 28 lines · Simon Horman
Quoted 27 lines · Andrew Lunn
Quoted 14 lines · Simon Horman
Quoted 10 lines · Tom Rix

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Hi Tom,

Quoted 8 lines

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set. But I do not see a build failure, and I believe that is because when FIXED_PHY is not set then a stub version of fixed_phy_register(), defined as static inline in include/linux/phy_fixed.h, is used.

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY is a module? What might be needed is

Quoted 6 lines
Quoted 1 line

depends on FIXED_PHY || FIXED_PHY=n

Thanks Andrew,

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom describes. And his patch does appear to resolve the problem.

O.K. So the commit message needs updating to describe the actual problem.

Quoted 2 lines

Unfortunately your proposed solution seems to run foul of a complex dependency situation.

I was never any good at Kconfig. Arnd is the expert at solving problems like this.

You want either everything built in, or FIXED_PHY built in and LAN743X modular, or both modular.

Andrew

#5 lore raw

+Arnd

Quoted 31 lines · Andrew Lunn
Quoted 30 lines · Simon Horman
Quoted 28 lines · Andrew Lunn
Quoted 14 lines · Simon Horman
Quoted 10 lines · Tom Rix

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Hi Tom,

Quoted 8 lines

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set. But I do not see a build failure, and I believe that is because when FIXED_PHY is not set then a stub version of fixed_phy_register(), defined as static inline in include/linux/phy_fixed.h, is used.

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY is a module? What might be needed is

depends on FIXED_PHY || FIXED_PHY=n

Quoted 7 lines
Quoted 4 lines

Thanks Andrew,

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom describes. And his patch does appear to resolve the problem.

O.K. So the commit message needs updating to describe the actual problem.

Yes, that would be a good improvement.

Perhaps a fixes tag too?

Quoted 8 lines
Quoted 2 lines

Unfortunately your proposed solution seems to run foul of a complex dependency situation.

I was never any good at Kconfig. Arnd is the expert at solving problems like this.

You want either everything built in, or FIXED_PHY built in and LAN743X modular, or both modular.

I _think_ the patch, which uses select FIXED_PHY for LAN743X, achieves that.

I CCed Arnd in case he has any input. Though I think I read in an recent email from him that he is out most of this week.

author
#6 lore raw
Quoted 46 lines · Simon Horman

+Arnd

Quoted 27 lines · Andrew Lunn
Quoted 26 lines · Simon Horman
Quoted 25 lines · Andrew Lunn
Quoted 13 lines · Simon Horman
Quoted 10 lines · Tom Rix

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Hi Tom,

Quoted 8 lines

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set. But I do not see a build failure, and I believe that is because when FIXED_PHY is not set then a stub version of fixed_phy_register(), defined as static inline in include/linux/phy_fixed.h, is used.

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY is a module? What might be needed is

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

depends on FIXED_PHY || FIXED_PHY=n

Thanks Andrew,

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom describes. And his patch does appear to resolve the problem.

O.K. So the commit message needs updating to describe the actual problem.

Yes, that would be a good improvement.

Perhaps a fixes tag too?

Quoted 5 lines
Quoted 2 lines

Unfortunately your proposed solution seems to run foul of a complex dependency situation.

I was never any good at Kconfig. Arnd is the expert at solving problems like this.

Quoted 7 lines
Quoted 2 lines

You want either everything built in, or FIXED_PHY built in and LAN743X modular, or both modular.

I _think_ the patch, which uses select FIXED_PHY for LAN743X, achieves that.

I CCed Arnd in case he has any input. Though I think I read in an recent email from him that he is out most of this week.

I was out last week as well :)

I considered this a cleanup rather than a fix, I can add that fixes tag.

From my point of view this is a linking problem, I don't mind changing,  what commit message should I use ?

Tom

Quoted 1 line
Reviewed-by
#7 lore raw
Quoted 17 lines · Tom Rix
Quoted 16 lines · Simon Horman
Quoted 6 lines · Andrew Lunn
Quoted 3 lines · Simon Horman

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom describes. And his patch does appear to resolve the problem.

O.K. So the commit message needs updating to describe the actual problem.

Yes, that would be a good improvement.

Perhaps a fixes tag too?

Quoted 5 lines
Quoted 2 lines

Unfortunately your proposed solution seems to run foul of a complex dependency situation.

I was never any good at Kconfig. Arnd is the expert at solving problems like this.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

You want either everything built in, or FIXED_PHY built in and LAN743X modular, or both modular.

I _think_ the patch, which uses select FIXED_PHY for LAN743X, achieves that.

I CCed Arnd in case he has any input. Though I think I read in an recent email from him that he is out most of this week.

FWIW, the original patch looks good to me,

I'm not sure if the #else path in include/linux/phy_fixed.h is actually helpful, as it does not avoid a link failure but just makes it less common. Maybe we should just drop that from the header and require all users of fixed_phy to 'select' that symbol even when they are built-in?

Arnd

#8 lore raw
In reply to Tom Rix
Quoted 50 lines · Tom Rix
Quoted 48 lines · Simon Horman

+Arnd

Quoted 27 lines · Andrew Lunn
Quoted 26 lines · Simon Horman
Quoted 25 lines · Andrew Lunn
Quoted 13 lines · Simon Horman
Quoted 10 lines · Tom Rix

A rand config causes this link error drivers/net/ethernet/microchip/lan743x_main.o: In function `lan743x_netdev_open':
drivers/net/ethernet/microchip/lan743x_main.c:1512: undefined reference to `fixed_phy_register'

lan743x_netdev_open is controlled by LAN743X
fixed_phy_register is controlled by FIXED_PHY

So LAN743X should also select FIXED_PHY

Hi Tom,

Quoted 8 lines

I am a little confused by this.

I did manage to cook up a config with LAN743X=m and FIXED_PHY not set. But I do not see a build failure, and I believe that is because when FIXED_PHY is not set then a stub version of fixed_phy_register(), defined as static inline in include/linux/phy_fixed.h, is used.

Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/include/linux/phy_fixed.h?h=main&id=675f176b4dcc2b75adbcea7ba0e9a649527f53bd#n42

I'n guessing, but it could be that LAN743X is built in, and FIXED_PHY is a module? What might be needed is

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

depends on FIXED_PHY || FIXED_PHY=n

Thanks Andrew,

LAN743X=y and FIXED_PHY=m does indeed produce the problem that Tom describes. And his patch does appear to resolve the problem.

O.K. So the commit message needs updating to describe the actual problem.

Yes, that would be a good improvement.

Perhaps a fixes tag too?

Quoted 7 lines
Quoted 2 lines

Unfortunately your proposed solution seems to run foul of a complex dependency situation.

I was never any good at Kconfig. Arnd is the expert at solving problems like this.

You want either everything built in, or FIXED_PHY built in and LAN743X modular, or both modular.

Quoted 7 lines
Quoted 5 lines

I _think_ the patch, which uses select FIXED_PHY for LAN743X, achieves that.

I CCed Arnd in case he has any input. Though I think I read in an recent email from him that he is out most of this week.

I was out last week as well :)

:)

Quoted 1 line

I considered this a cleanup rather than a fix, I can add that fixes tag.

FWIIW, I'm happy with a cleanup.
And in that chase there should be no fixes tag (conversely, if it is a fix, then there should be a fixes tag).

As a cleanup, I suggest targeting this at net-next ([PATCH net-next]). As net-next is currently closed you'll need to wait for it to re-open. I expect that will happen next week, after v6.3-rc2 has been tagged.

Quoted 2 lines

From my point of view this is a linking problem, I don't mind changing, what commit message should I use ?

I think updating the patch description by adding something like "This problem occurs when LAN743X=y and FIXED_PHY=m." would be sufficient.