~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/phy_link_topology.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * PHY device list allow maintaining a list of PHY devices that are
  4  * part of a netdevice's link topology. PHYs can for example be chained,
  5  * as is the case when using a PHY that exposes an SFP module, on which an
  6  * SFP transceiver that embeds a PHY is connected.
  7  *
  8  * This list can then be used by userspace to leverage individual PHY
  9  * capabilities.
 10  */
 11 #ifndef __PHY_LINK_TOPOLOGY_H
 12 #define __PHY_LINK_TOPOLOGY_H
 13 
 14 #include <linux/ethtool.h>
 15 #include <linux/netdevice.h>
 16 
 17 struct xarray;
 18 struct phy_device;
 19 struct sfp_bus;
 20 
 21 struct phy_link_topology {
 22         struct xarray phys;
 23         u32 next_phy_index;
 24 };
 25 
 26 struct phy_device_node {
 27         enum phy_upstream upstream_type;
 28 
 29         union {
 30                 struct net_device       *netdev;
 31                 struct phy_device       *phydev;
 32         } upstream;
 33 
 34         struct sfp_bus *parent_sfp_bus;
 35 
 36         struct phy_device *phy;
 37 };
 38 
 39 #if IS_ENABLED(CONFIG_PHYLIB)
 40 int phy_link_topo_add_phy(struct net_device *dev,
 41                           struct phy_device *phy,
 42                           enum phy_upstream upt, void *upstream);
 43 
 44 void phy_link_topo_del_phy(struct net_device *dev, struct phy_device *phy);
 45 
 46 static inline struct phy_device *
 47 phy_link_topo_get_phy(struct net_device *dev, u32 phyindex)
 48 {
 49         struct phy_link_topology *topo = dev->link_topo;
 50         struct phy_device_node *pdn;
 51 
 52         if (!topo)
 53                 return NULL;
 54 
 55         pdn = xa_load(&topo->phys, phyindex);
 56         if (pdn)
 57                 return pdn->phy;
 58 
 59         return NULL;
 60 }
 61 
 62 #else
 63 static inline int phy_link_topo_add_phy(struct net_device *dev,
 64                                         struct phy_device *phy,
 65                                         enum phy_upstream upt, void *upstream)
 66 {
 67         return 0;
 68 }
 69 
 70 static inline void phy_link_topo_del_phy(struct net_device *dev,
 71                                          struct phy_device *phy)
 72 {
 73 }
 74 
 75 static inline struct phy_device *
 76 phy_link_topo_get_phy(struct net_device *dev, u32 phyindex)
 77 {
 78         return NULL;
 79 }
 80 #endif
 81 
 82 #endif /* __PHY_LINK_TOPOLOGY_H */
 83 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php