Skip to contentSkip to conversation

net: phy: link_topology: Don't stub-away the topology creation

PATCH In review Maxime Chevallier 2 participants 3 messages Apr 17, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: link_topology: Don't stub-away the topology creation

Some of the phy_link_topology operations are protected by IS_REACHABLE, which can lead to scenarios where the consumer, built as modules, sees the topology unstubbed, whereas the initialization didn't occur.

Don't stub away the creation of the topology, it has no dependency on any other parts like phylib, so we can make it always available.

---
Hi Nathan, Heiner,

I'm currently at EOSS, so I'm sending this patch without having been able to properly test it (build-tested only), but as this addresses an issue for people using -next, I'm sending this anyway, sorry about that.

Hopefully it can address the issue for now, I haven't given-up on your idea to introduce a config option Heiner :)

Thanks,

Maxime

 include/linux/phy_link_topology_core.h | 15 ---------------
 1 file changed, 15 deletions(-)
include/linux/phy_link_topology_core.h +0 -15
index 0a6479055745..61e2592f24ac 100644
@@ -4,22 +4,7 @@
 
 struct phy_link_topology;
 
-#if IS_REACHABLE(CONFIG_PHYLIB)
-
 struct phy_link_topology *phy_link_topo_create(struct net_device *dev);
 void phy_link_topo_destroy(struct phy_link_topology *topo);
 
-#else
-
-static inline struct phy_link_topology *phy_link_topo_create(struct net_device *dev)
-{
-	return NULL;
-}
-
-static inline void phy_link_topo_destroy(struct phy_link_topology *topo)
-{
-}
-
-#endif
-
 #endif /* __PHY_LINK_TOPOLOGY_CORE_H */
Signature · 1 line
2.44.0
#1 lore raw

Hi Maxime,

Quoted 10 lines · Maxime Chevallier

Some of the phy_link_topology operations are protected by IS_REACHABLE, which can lead to scenarios where the consumer, built as modules, sees the topology unstubbed, whereas the initialization didn't occur.

Don't stub away the creation of the topology, it has no dependency on any other parts like phylib, so we can make it always available.

Quoted 6 lines

---
Hi Nathan, Heiner,

I'm currently at EOSS, so I'm sending this patch without having been able to properly test it (build-tested only), but as this addresses an issue for people using -next, I'm sending this anyway, sorry about that.

No worries, thanks for continuing to take a look. Unfortunately, this patch fails to build during the linking stage for me with my configuration:

x86_64-linux-ld: vmlinux.o: in function `free_netdev':
net/core/dev.c:11060:(.text+0xb14030): undefined reference to `phy_link_topo_destroy'
x86_64-linux-ld: vmlinux.o: in function `alloc_netdev_mqs':
net/core/dev.c:10966:(.text+0xb142d6): undefined reference to `phy_link_topo_create'

Quoted 40 lines

Hopefully it can address the issue for now, I haven't given-up on your idea to introduce a config option Heiner :)

Thanks,

Maxime

 include/linux/phy_link_topology_core.h | 15 ---------------
 1 file changed, 15 deletions(-)
include/linux/phy_link_topology_core.h +0 -15
index 0a6479055745..61e2592f24ac 100644
@@ -4,22 +4,7 @@
 
 struct phy_link_topology;
 
-#if IS_REACHABLE(CONFIG_PHYLIB)
-
 struct phy_link_topology *phy_link_topo_create(struct net_device *dev);
 void phy_link_topo_destroy(struct phy_link_topology *topo);
 
-#else
-
-static inline struct phy_link_topology *phy_link_topo_create(struct net_device *dev)
-{
-	return NULL;
-}
-
-static inline void phy_link_topo_destroy(struct phy_link_topology *topo)
-{
-}
-
-#endif
-
 #endif /* __PHY_LINK_TOPOLOGY_CORE_H */
Signature · 1 line
2.44.0
#2 lore raw

Hello Nathan,

Quoted 20 lines · On Wed, 17 Apr 2024 11:07:21 -0700 Nathan Chancellor <[email protected]> wrote:

Hi Maxime,

Quoted 10 lines · Maxime Chevallier

Some of the phy_link_topology operations are protected by IS_REACHABLE, which can lead to scenarios where the consumer, built as modules, sees the topology unstubbed, whereas the initialization didn't occur.

Don't stub away the creation of the topology, it has no dependency on any other parts like phylib, so we can make it always available.

Quoted 6 lines

---
Hi Nathan, Heiner,

I'm currently at EOSS, so I'm sending this patch without having been able to properly test it (build-tested only), but as this addresses an issue for people using -next, I'm sending this anyway, sorry about that.

Quoted 8 lines

No worries, thanks for continuing to take a look. Unfortunately, this patch fails to build during the linking stage for me with my configuration:

x86_64-linux-ld: vmlinux.o: in function `free_netdev':
net/core/dev.c:11060:(.text+0xb14030): undefined reference to `phy_link_topo_destroy'
x86_64-linux-ld: vmlinux.o: in function `alloc_netdev_mqs':
net/core/dev.c:10966:(.text+0xb142d6): undefined reference to `phy_link_topo_create'

Heh serves me well for trying to go too fast :) phy_link_topo_create then need to compile unconditionally, so I'm indeed missing some bits here.

Thanks a lot for testing,

Maxime

Quoted 41 lines
Quoted 41 lines

Hopefully it can address the issue for now, I haven't given-up on your idea to introduce a config option Heiner :)

Thanks,

Maxime

 include/linux/phy_link_topology_core.h | 15 ---------------
 1 file changed, 15 deletions(-)
include/linux/phy_link_topology_core.h +0 -15
index 0a6479055745..61e2592f24ac 100644
@@ -4,22 +4,7 @@
 
 struct phy_link_topology;
 
-#if IS_REACHABLE(CONFIG_PHYLIB)
-
 struct phy_link_topology *phy_link_topo_create(struct net_device *dev);
 void phy_link_topo_destroy(struct phy_link_topology *topo);
 
-#else
-
-static inline struct phy_link_topology *phy_link_topo_create(struct net_device *dev)
-{
-	return NULL;
-}
-
-static inline void phy_link_topo_destroy(struct phy_link_topology *topo)
-{
-}
-
-#endif
-
 #endif /* __PHY_LINK_TOPOLOGY_CORE_H */
Signature · 1 line
2.44.0