diff options
author | David S. Miller <davem@davemloft.net> | 2024-04-06 18:25:15 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-04-06 18:25:15 +0100 |
commit | 267e31750ae89f845cfe7df8f577b19482d9ef9b (patch) | |
tree | ceeb19f9bb2bf74edce1cfaceea5e8de70c09f3c /net/core/dev.c | |
parent | d133ef1ee2a256ba5a589493cd28dccfede6af11 (diff) | |
parent | 841942bc62122c59f654f799c2d00ce3fda93efa (diff) |
Merge branch 'phy-listing-link_topology-tracking'
Maxime Chevallier says:
====================
Introduce PHY listing and link_topology tracking
This is V11 for the link topology addition, allowing to track all PHYs
that are linked to netdevices.
This V11 addresses the various netlink-related issues that were raised
by Jakub, and fixes some typos in the documentation.
As a remainder, here's what the PHY listings would look like :
- eth0 has a 88x3310 acting as media converter, and an SFP module with
an embedded 88e1111 PHY
- eth2 has a 88e1510 PHY
PHY for eth0:
PHY index: 1
Driver name: mv88x3310
PHY device name: f212a600.mdio-mii:00
Downstream SFP bus name: sfp-eth0
PHY id: 0
Upstream type: MAC
PHY for eth0:
PHY index: 2
Driver name: Marvell 88E1111
PHY device name: i2c:sfp-eth0:16
PHY id: 21040322
Upstream type: PHY
Upstream PHY index: 1
Upstream SFP name: sfp-eth0
PHY for eth2:
PHY index: 1
Driver name: Marvell 88E1510
PHY device name: f212a200.mdio-mii:00
PHY id: 21040593
Upstream type: MAC
Ethtool patches : https://github.com/minimaxwell/ethtool/tree/link-topo-v6
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 92f5bddbc2de..854a3a28a8d8 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -158,6 +158,7 @@ #include <net/page_pool/types.h> #include <net/page_pool/helpers.h> #include <net/rps.h> +#include <linux/phy_link_topology_core.h> #include "dev.h" #include "net-sysfs.h" @@ -10962,6 +10963,12 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, #ifdef CONFIG_NET_SCHED hash_init(dev->qdisc_hash); #endif + dev->link_topo = phy_link_topo_create(dev); + if (IS_ERR(dev->link_topo)) { + dev->link_topo = NULL; + goto free_all; + } + dev->priv_flags = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; setup(dev); @@ -11050,6 +11057,8 @@ void free_netdev(struct net_device *dev) free_percpu(dev->xdp_bulkq); dev->xdp_bulkq = NULL; + phy_link_topo_destroy(dev->link_topo); + /* Compatibility with error handling in drivers */ if (dev->reg_state == NETREG_UNINITIALIZED) { netdev_freemem(dev); |