include/linux/phy_link_topology.h
Source file repositories/reference/linux-study-clean/include/linux/phy_link_topology.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/phy_link_topology.h- Extension
.h- Size
- 1879 bytes
- Lines
- 88
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ethtool.hlinux/netdevice.h
Detected Declarations
struct xarraystruct phy_devicestruct sfp_busstruct phy_link_topologystruct phy_device_nodefunction phy_link_topo_emptyfunction phy_link_topo_get_phyfunction phy_link_topo_add_phyfunction phy_link_topo_del_phy
Annotated Snippet
struct phy_link_topology {
struct xarray phys;
u32 next_phy_index;
};
struct phy_device_node {
enum phy_upstream upstream_type;
union {
struct net_device *netdev;
struct phy_device *phydev;
} upstream;
struct sfp_bus *parent_sfp_bus;
struct phy_device *phy;
};
static inline bool phy_link_topo_empty(struct net_device *dev)
{
return !dev->link_topo;
}
#if IS_ENABLED(CONFIG_PHYLIB)
int phy_link_topo_add_phy(struct net_device *dev,
struct phy_device *phy,
enum phy_upstream upt, void *upstream);
void phy_link_topo_del_phy(struct net_device *dev, struct phy_device *phy);
static inline struct phy_device *
phy_link_topo_get_phy(struct net_device *dev, u32 phyindex)
{
struct phy_link_topology *topo = dev->link_topo;
struct phy_device_node *pdn;
if (!topo)
return NULL;
pdn = xa_load(&topo->phys, phyindex);
if (pdn)
return pdn->phy;
return NULL;
}
#else
static inline int phy_link_topo_add_phy(struct net_device *dev,
struct phy_device *phy,
enum phy_upstream upt, void *upstream)
{
return 0;
}
static inline void phy_link_topo_del_phy(struct net_device *dev,
struct phy_device *phy)
{
}
static inline struct phy_device *
phy_link_topo_get_phy(struct net_device *dev, u32 phyindex)
{
return NULL;
}
#endif
#endif /* __PHY_LINK_TOPOLOGY_H */
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/netdevice.h`.
- Detected declarations: `struct xarray`, `struct phy_device`, `struct sfp_bus`, `struct phy_link_topology`, `struct phy_device_node`, `function phy_link_topo_empty`, `function phy_link_topo_get_phy`, `function phy_link_topo_add_phy`, `function phy_link_topo_del_phy`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.