Skip to content

Commit 5c16727

Browse files
committed
net: revert partially applied PHY topology series
The series is causing issues with PHY drivers built as modules. Since it was only partially applied and the merge window has opened let's revert and try again for v6.11. Revert 6916e46 ("net: phy: Introduce ethernet link topology representation") Revert 0ec5ed6 ("net: sfp: pass the phy_device when disconnecting an sfp module's PHY") Revert e75e4e0 ("net: phy: add helpers to handle sfp phy connect/disconnect") Revert fdd3539 ("net: sfp: Add helper to return the SFP bus name") Revert 841942b ("net: ethtool: Allow passing a phy index for some commands") Link: https://lore.kernel.org/all/171242462917.4000.9759453824684907063.git-patchwork-notify@kernel.org/ Link: https://lore.kernel.org/all/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b08191d commit 5c16727

File tree

22 files changed

+8
-385
lines changed

22 files changed

+8
-385
lines changed

Documentation/networking/ethtool-netlink.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Structure of this header is
5757
``ETHTOOL_A_HEADER_DEV_INDEX`` u32 device ifindex
5858
``ETHTOOL_A_HEADER_DEV_NAME`` string device name
5959
``ETHTOOL_A_HEADER_FLAGS`` u32 flags common for all requests
60-
``ETHTOOL_A_HEADER_PHY_INDEX`` u32 phy device index
6160
============================== ====== =============================
6261

6362
``ETHTOOL_A_HEADER_DEV_INDEX`` and ``ETHTOOL_A_HEADER_DEV_NAME`` identify the
@@ -82,12 +81,6 @@ the behaviour is backward compatible, i.e. requests from old clients not aware
8281
of the flag should be interpreted the way the client expects. A client must
8382
not set flags it does not understand.
8483

85-
``ETHTOOL_A_HEADER_PHY_INDEX`` identifies the Ethernet PHY the message relates to.
86-
As there are numerous commands that are related to PHY configuration, and because
87-
there may be more than one PHY on the link, the PHY index can be passed in the
88-
request for the commands that needs it. It is, however, not mandatory, and if it
89-
is not passed for commands that target a PHY, the net_device.phydev pointer
90-
is used.
9184

9285
Bit sets
9386
========

MAINTAINERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8027,8 +8027,6 @@ F: include/linux/mii.h
80278027
F: include/linux/of_net.h
80288028
F: include/linux/phy.h
80298029
F: include/linux/phy_fixed.h
8030-
F: include/linux/phy_link_topology.h
8031-
F: include/linux/phy_link_topology_core.h
80328030
F: include/linux/phylib_stubs.h
80338031
F: include/linux/platform_data/mdio-bcm-unimac.h
80348032
F: include/linux/platform_data/mdio-gpio.h

drivers/net/phy/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Makefile for Linux PHY drivers
33

44
libphy-y := phy.o phy-c45.o phy-core.o phy_device.o \
5-
linkmode.o phy_link_topology.o
5+
linkmode.o
66
mdio-bus-y += mdio_bus.o mdio_device.o
77

88
ifdef CONFIG_MDIO_DEVICE

drivers/net/phy/marvell-88x2222.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,6 @@ static const struct sfp_upstream_ops sfp_phy_ops = {
553553
.link_down = mv2222_sfp_link_down,
554554
.attach = phy_sfp_attach,
555555
.detach = phy_sfp_detach,
556-
.connect_phy = phy_sfp_connect_phy,
557-
.disconnect_phy = phy_sfp_disconnect_phy,
558556
};
559557

560558
static int mv2222_probe(struct phy_device *phydev)

drivers/net/phy/marvell.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,8 +3613,6 @@ static const struct sfp_upstream_ops m88e1510_sfp_ops = {
36133613
.module_remove = m88e1510_sfp_remove,
36143614
.attach = phy_sfp_attach,
36153615
.detach = phy_sfp_detach,
3616-
.connect_phy = phy_sfp_connect_phy,
3617-
.disconnect_phy = phy_sfp_disconnect_phy,
36183616
};
36193617

36203618
static int m88e1510_probe(struct phy_device *phydev)

drivers/net/phy/marvell10g.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,6 @@ static int mv3310_sfp_insert(void *upstream, const struct sfp_eeprom_id *id)
503503
static const struct sfp_upstream_ops mv3310_sfp_ops = {
504504
.attach = phy_sfp_attach,
505505
.detach = phy_sfp_detach,
506-
.connect_phy = phy_sfp_connect_phy,
507-
.disconnect_phy = phy_sfp_disconnect_phy,
508506
.module_insert = mv3310_sfp_insert,
509507
};
510508

drivers/net/phy/phy_device.c

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <linux/phy.h>
3030
#include <linux/phylib_stubs.h>
3131
#include <linux/phy_led_triggers.h>
32-
#include <linux/phy_link_topology.h>
3332
#include <linux/pse-pd/pse.h>
3433
#include <linux/property.h>
3534
#include <linux/rtnetlink.h>
@@ -277,14 +276,6 @@ static void phy_mdio_device_remove(struct mdio_device *mdiodev)
277276

278277
static struct phy_driver genphy_driver;
279278

280-
static struct phy_link_topology *phy_get_link_topology(struct phy_device *phydev)
281-
{
282-
if (phydev->attached_dev)
283-
return phydev->attached_dev->link_topo;
284-
285-
return NULL;
286-
}
287-
288279
static LIST_HEAD(phy_fixup_list);
289280
static DEFINE_MUTEX(phy_fixup_lock);
290281

@@ -1378,46 +1369,6 @@ phy_standalone_show(struct device *dev, struct device_attribute *attr,
13781369
}
13791370
static DEVICE_ATTR_RO(phy_standalone);
13801371

1381-
/**
1382-
* phy_sfp_connect_phy - Connect the SFP module's PHY to the upstream PHY
1383-
* @upstream: pointer to the upstream phy device
1384-
* @phy: pointer to the SFP module's phy device
1385-
*
1386-
* This helper allows keeping track of PHY devices on the link. It adds the
1387-
* SFP module's phy to the phy namespace of the upstream phy
1388-
*/
1389-
int phy_sfp_connect_phy(void *upstream, struct phy_device *phy)
1390-
{
1391-
struct phy_device *phydev = upstream;
1392-
struct phy_link_topology *topo = phy_get_link_topology(phydev);
1393-
1394-
if (topo)
1395-
return phy_link_topo_add_phy(topo, phy, PHY_UPSTREAM_PHY, phydev);
1396-
1397-
return 0;
1398-
}
1399-
EXPORT_SYMBOL(phy_sfp_connect_phy);
1400-
1401-
/**
1402-
* phy_sfp_disconnect_phy - Disconnect the SFP module's PHY from the upstream PHY
1403-
* @upstream: pointer to the upstream phy device
1404-
* @phy: pointer to the SFP module's phy device
1405-
*
1406-
* This helper allows keeping track of PHY devices on the link. It removes the
1407-
* SFP module's phy to the phy namespace of the upstream phy. As the module phy
1408-
* will be destroyed, re-inserting the same module will add a new phy with a
1409-
* new index.
1410-
*/
1411-
void phy_sfp_disconnect_phy(void *upstream, struct phy_device *phy)
1412-
{
1413-
struct phy_device *phydev = upstream;
1414-
struct phy_link_topology *topo = phy_get_link_topology(phydev);
1415-
1416-
if (topo)
1417-
phy_link_topo_del_phy(topo, phy);
1418-
}
1419-
EXPORT_SYMBOL(phy_sfp_disconnect_phy);
1420-
14211372
/**
14221373
* phy_sfp_attach - attach the SFP bus to the PHY upstream network device
14231374
* @upstream: pointer to the phy device
@@ -1560,11 +1511,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
15601511

15611512
if (phydev->sfp_bus_attached)
15621513
dev->sfp_bus = phydev->sfp_bus;
1563-
1564-
err = phy_link_topo_add_phy(dev->link_topo, phydev,
1565-
PHY_UPSTREAM_MAC, dev);
1566-
if (err)
1567-
goto error;
15681514
}
15691515

15701516
/* Some Ethernet drivers try to connect to a PHY device before
@@ -1992,7 +1938,6 @@ void phy_detach(struct phy_device *phydev)
19921938
if (dev) {
19931939
phydev->attached_dev->phydev = NULL;
19941940
phydev->attached_dev = NULL;
1995-
phy_link_topo_del_phy(dev->link_topo, phydev);
19961941
}
19971942
phydev->phylink = NULL;
19981943

drivers/net/phy/phy_link_topology.c

Lines changed: 0 additions & 105 deletions
This file was deleted.

drivers/net/phy/phylink.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,8 +3411,7 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
34113411
return ret;
34123412
}
34133413

3414-
static void phylink_sfp_disconnect_phy(void *upstream,
3415-
struct phy_device *phydev)
3414+
static void phylink_sfp_disconnect_phy(void *upstream)
34163415
{
34173416
phylink_disconnect_phy(upstream);
34183417
}

drivers/net/phy/qcom/at803x.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,6 @@ static const struct sfp_upstream_ops at8031_sfp_ops = {
770770
.attach = phy_sfp_attach,
771771
.detach = phy_sfp_detach,
772772
.module_insert = at8031_sfp_insert,
773-
.connect_phy = phy_sfp_connect_phy,
774-
.disconnect_phy = phy_sfp_disconnect_phy,
775773
};
776774

777775
static int at8031_parse_dt(struct phy_device *phydev)

drivers/net/phy/qcom/qca807x.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,6 @@ static const struct sfp_upstream_ops qca807x_sfp_ops = {
699699
.detach = phy_sfp_detach,
700700
.module_insert = qca807x_sfp_insert,
701701
.module_remove = qca807x_sfp_remove,
702-
.connect_phy = phy_sfp_connect_phy,
703-
.disconnect_phy = phy_sfp_disconnect_phy,
704702
};
705703

706704
static int qca807x_probe(struct phy_device *phydev)

drivers/net/phy/sfp-bus.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static void sfp_unregister_bus(struct sfp_bus *bus)
487487
bus->socket_ops->stop(bus->sfp);
488488
bus->socket_ops->detach(bus->sfp);
489489
if (bus->phydev && ops && ops->disconnect_phy)
490-
ops->disconnect_phy(bus->upstream, bus->phydev);
490+
ops->disconnect_phy(bus->upstream);
491491
}
492492
bus->registered = false;
493493
}
@@ -743,7 +743,7 @@ void sfp_remove_phy(struct sfp_bus *bus)
743743
const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
744744

745745
if (ops && ops->disconnect_phy)
746-
ops->disconnect_phy(bus->upstream, bus->phydev);
746+
ops->disconnect_phy(bus->upstream);
747747
bus->phydev = NULL;
748748
}
749749
EXPORT_SYMBOL_GPL(sfp_remove_phy);
@@ -860,14 +860,3 @@ void sfp_unregister_socket(struct sfp_bus *bus)
860860
sfp_bus_put(bus);
861861
}
862862
EXPORT_SYMBOL_GPL(sfp_unregister_socket);
863-
864-
const char *sfp_get_name(struct sfp_bus *bus)
865-
{
866-
ASSERT_RTNL();
867-
868-
if (bus->sfp_dev)
869-
return dev_name(bus->sfp_dev);
870-
871-
return NULL;
872-
}
873-
EXPORT_SYMBOL_GPL(sfp_get_name);

include/linux/netdevice.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <net/dcbnl.h>
4141
#endif
4242
#include <net/netprio_cgroup.h>
43+
4344
#include <linux/netdev_features.h>
4445
#include <linux/neighbour.h>
4546
#include <uapi/linux/netdevice.h>
@@ -51,7 +52,6 @@
5152
#include <net/net_trackers.h>
5253
#include <net/net_debug.h>
5354
#include <net/dropreason-core.h>
54-
#include <linux/phy_link_topology_core.h>
5555

5656
struct netpoll_info;
5757
struct device;
@@ -1975,7 +1975,6 @@ enum netdev_reg_state {
19751975
* @fcoe_ddp_xid: Max exchange id for FCoE LRO by ddp
19761976
*
19771977
* @priomap: XXX: need comments on this one
1978-
* @link_topo: Physical link topology tracking attached PHYs
19791978
* @phydev: Physical device may attach itself
19801979
* for hardware timestamping
19811980
* @sfp_bus: attached &struct sfp_bus structure.
@@ -2368,7 +2367,6 @@ struct net_device {
23682367
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
23692368
struct netprio_map __rcu *priomap;
23702369
#endif
2371-
struct phy_link_topology *link_topo;
23722370
struct phy_device *phydev;
23732371
struct sfp_bus *sfp_bus;
23742372
struct lock_class_key *qdisc_tx_busylock;

include/linux/phy.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,6 @@ struct macsec_ops;
550550
* @drv: Pointer to the driver for this PHY instance
551551
* @devlink: Create a link between phy dev and mac dev, if the external phy
552552
* used by current mac interface is managed by another mac interface.
553-
* @phyindex: Unique id across the phy's parent tree of phys to address the PHY
554-
* from userspace, similar to ifindex. A zero index means the PHY
555-
* wasn't assigned an id yet.
556553
* @phy_id: UID for this device found during discovery
557554
* @c45_ids: 802.3-c45 Device Identifiers if is_c45.
558555
* @is_c45: Set to true if this PHY uses clause 45 addressing.
@@ -653,7 +650,6 @@ struct phy_device {
653650

654651
struct device_link *devlink;
655652

656-
u32 phyindex;
657653
u32 phy_id;
658654

659655
struct phy_c45_device_ids c45_ids;
@@ -1758,8 +1754,6 @@ int phy_suspend(struct phy_device *phydev);
17581754
int phy_resume(struct phy_device *phydev);
17591755
int __phy_resume(struct phy_device *phydev);
17601756
int phy_loopback(struct phy_device *phydev, bool enable);
1761-
int phy_sfp_connect_phy(void *upstream, struct phy_device *phy);
1762-
void phy_sfp_disconnect_phy(void *upstream, struct phy_device *phy);
17631757
void phy_sfp_attach(void *upstream, struct sfp_bus *bus);
17641758
void phy_sfp_detach(void *upstream, struct sfp_bus *bus);
17651759
int phy_sfp_probe(struct phy_device *phydev,

0 commit comments

Comments
 (0)