summaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-19 10:39:08 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-19 10:39:08 -0800
commit8bf22c33e7a172fbc72464f4cc484d23a6b412ba (patch)
tree7034d84f09ee8c239574adec764ddae7594775f0 /drivers/net/phy
parent4f13d0dabc87fb585b96d90cc4b29f67a2995405 (diff)
parent571dcbeb8e635182bb825ae758399831805693c2 (diff)
Merge tag 'net-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netdavem/net-next/maindavem/net-next/HEAD
Pull networking fixes from Jakub Kicinski: "Including fixes from Netfilter. Current release - new code bugs: - net: fix backlog_unlock_irq_restore() vs CONFIG_PREEMPT_RT - eth: mlx5e: XSK, Fix unintended ICOSQ change - phy_port: correctly recompute the port's linkmodes - vsock: prevent child netns mode switch from local to global - couple of kconfig fixes for new symbols Previous releases - regressions: - nfc: nci: fix false-positive parameter validation for packet data - net: do not delay zero-copy skbs in skb_attempt_defer_free() Previous releases - always broken: - mctp: ensure our nlmsg responses to user space are zero-initialised - ipv6: ioam: fix heap buffer overflow in __ioam6_fill_trace_data() - fixes for ICMP rate limiting Misc: - intel: fix PCI device ID conflict between i40e and ipw2200" * tag 'net-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (85 commits) net: nfc: nci: Fix parameter validation for packet data net/mlx5e: Use unsigned for mlx5e_get_max_num_channels net/mlx5e: Fix deadlocks between devlink and netdev instance locks net/mlx5e: MACsec, add ASO poll loop in macsec_aso_set_arm_event net/mlx5: Fix misidentification of write combining CQE during poll loop net/mlx5e: Fix misidentification of ASO CQE during poll loop net/mlx5: Fix multiport device check over light SFs bonding: alb: fix UAF in rlb_arp_recv during bond up/down bnge: fix reserving resources from FW eth: fbnic: Advertise supported XDP features. rds: tcp: fix uninit-value in __inet_bind net/rds: Fix NULL pointer dereference in rds_tcp_accept_one octeontx2-af: Fix default entries mcam entry action net/mlx5e: XSK, Fix unintended ICOSQ change ipv6: icmp: icmpv6_xrlim_allow() optimization if net.ipv6.icmp.ratelimit is zero ipv4: icmp: icmpv4_xrlim_allow() optimization if net.ipv4.icmp_ratelimit is zero ipv6: icmp: remove obsolete code in icmpv6_xrlim_allow() inet: move icmp_global_{credit,stamp} to a separate cache line icmp: prevent possible overflow in icmp_global_allow() selftests/net: packetdrill: add ipv4-mapped-ipv6 tests ...
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy_device.c3
-rw-r--r--drivers/net/phy/phy_port.c33
2 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 8a3eb1839a3d..9b8eaac63b90 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3499,6 +3499,9 @@ static int of_phy_ports(struct phy_device *phydev)
port->parent_type = PHY_PORT_PHY;
port->phy = phydev;
+
+ linkmode_copy(port->supported, phydev->supported);
+
err = phy_add_port(phydev, port);
if (err) {
phy_port_destroy(port);
diff --git a/drivers/net/phy/phy_port.c b/drivers/net/phy/phy_port.c
index ec93c8ca051e..63d1bb154dc7 100644
--- a/drivers/net/phy/phy_port.c
+++ b/drivers/net/phy/phy_port.c
@@ -53,7 +53,7 @@ struct phy_port *phy_of_parse_port(struct device_node *dn)
enum ethtool_link_medium medium;
struct phy_port *port;
const char *med_str;
- u32 pairs = 0, mediums = 0;
+ u32 pairs = 0;
int ret;
ret = fwnode_property_read_string(fwnode, "media", &med_str);
@@ -85,17 +85,12 @@ struct phy_port *phy_of_parse_port(struct device_node *dn)
return ERR_PTR(-EINVAL);
}
- mediums |= BIT(medium);
-
- if (!mediums)
- return ERR_PTR(-EINVAL);
-
port = phy_port_alloc();
if (!port)
return ERR_PTR(-ENOMEM);
port->pairs = pairs;
- port->mediums = mediums;
+ port->mediums = BIT(medium);
return port;
}
@@ -113,16 +108,10 @@ EXPORT_SYMBOL_GPL(phy_of_parse_port);
*/
void phy_port_update_supported(struct phy_port *port)
{
- __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = { 0 };
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {0};
unsigned long mode;
int i;
- for_each_set_bit(i, &port->mediums, __ETHTOOL_LINK_MEDIUM_LAST) {
- linkmode_zero(supported);
- phy_caps_medium_get_supported(supported, i, port->pairs);
- linkmode_or(port->supported, port->supported, supported);
- }
-
/* If there's no pairs specified, we grab the default number of
* pairs as the max of the default pairs for each linkmode
*/
@@ -132,6 +121,22 @@ void phy_port_update_supported(struct phy_port *port)
port->pairs = max_t(int, port->pairs,
ethtool_linkmode_n_pairs(mode));
+ for_each_set_bit(i, &port->mediums, __ETHTOOL_LINK_MEDIUM_LAST) {
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(med_supported) = {0};
+
+ phy_caps_medium_get_supported(med_supported, i, port->pairs);
+ linkmode_or(supported, supported, med_supported);
+ }
+
+ /* If port->supported is already populated, filter it out with the
+ * medium/pair support. Otherwise, let's just use this medium-based
+ * support as the port's supported list.
+ */
+ if (linkmode_empty(port->supported))
+ linkmode_copy(port->supported, supported);
+ else
+ linkmode_and(port->supported, supported, port->supported);
+
/* Serdes ports supported through SFP may not have any medium set,
* as they will output PHY_INTERFACE_MODE_XXX modes. In that case, derive
* the supported list based on these interfaces