Thread View: linux.kernel.netdev
5 messages
5 total messages
Started by "Doddagoudar, Susheela M"
Fri, 20 Nov 2026 12:45
Proposal: per-lane PHY polarity get/set via ethtool PHY tunables
Author: "Doddagoudar, Susheela M"
Date: Fri, 20 Nov 2026 12:45
Date: Fri, 20 Nov 2026 12:45
102 lines
23723 bytes
23723 bytes
Hi All,
I would like feedback on a proposed ethtool netlink interface for getting and setting
the polarity of individual PHY lanes.
USE CASE
This helps debug link-up failures caused by swapped lane polarity. A user can read and flip
the polarity of a lane at runtime to see if the link comes up.
PROPOSED INTERFACE
ethtool --set-phy-tunable <if-name> rx-pol <invert/normal/auto> <lane>
ethtool --get-phy-tunable <if-name> rx-pol <lane>
ethtool --set-phy-tunable <if-name> tx-pol <invert/normal> <lane>
ethtool --get-phy-tunable <if-name> tx-pol <lane>
Two new PHY tunables, handled through the existing ETHTOOL_MSG_PHY_TUNABLE_GET and
ETHTOOL_MSG_PHY_TUNABLE_SET commands:
ETHTOOL_A_PHY_TUNABLE_RX_POL
ETHTOOL_A_PHY_TUNABLE_TX_POL
Each one is a nest with two attributes:
lane (u16) lane number within the PHY
value (u16) polarity, enum phy-pol
The polarity values match PHY_POL_* in include/dt-bindings/phy/phy.h:
enum ethtool_phy_pol {
ETHTOOL_PHY_POL_NORMAL,
ETHTOOL_PHY_POL_INVERT,
ETHTOOL_PHY_POL_AUTO, // Rx only
};
On GET the request carries the lane, and the reply returns lane and value.
On SET both lane and value are required.
Is the PHY tunable framework the right place for lane polarity, or would you prefer a different location?
The netlink spec (Documentation/netlink/specs/ethtool.yaml) change, abbreviated:
-
name: phy-pol
type: enum
name-prefix: ethtool-phy-pol-
doc: Lane polarity. Values must match PHY_POL_* in include/dt-bindings/phy/phy.h.
entries: [ normal, invert, auto ]
# in the phy-tunable attribute set
-
name: tx-pol
type: nest
value: 9
nested-attributes: phy-tunable-tx-pol
-
name: rx-pol
type: nest
value: 10
nested-attributes: phy-tunable-rx-pol
-
name: phy-tunable-rx-pol # phy-tunable-tx-pol is identical
attributes:
-
name: lane
type: u16
-
name: value
type: u16
enum: phy-pol
In the ethtool core (net/ethtool/phytunable.c) the nested attribute is parsed with a
small policy and handed to the driver as a u16 pair through the existing
PHY tunable get/set path.
static const struct nla_policy
ethnl_rx_pol_policy[ETHTOOL_A_PHY_TUNABLE_RX_POL_MAX + 1] = {
[ETHTOOL_A_PHY_TUNABLE_RX_POL_LANE] = { .type = NLA_U16 },
[ETHTOOL_A_PHY_TUNABLE_RX_POL_VALUE] = { .type = NLA_U16 },
};
/* set path */
pol_arg[0] = nla_get_u16(pol_tb[lane_attr]);
pol_arg[1] = nla_get_u16(pol_tb[value_attr]);
phy_tunable.id = tx_pol ? ETHTOOL_PHY_TX_POL : ETHTOOL_PHY_RX_POL;
phy_tunable.type_id = ETHTOOL_TUNABLE_U16;
phy_tunable.len = sizeof(pol_arg);
phy_tunable_data = pol_arg;
Thanks,
Susheela
Re: Proposal: per-lane PHY polarity get/set via ethtool PHY tunables
Author: Andrew Lunn
Date: Fri, 20 Nov 2026 13:29
Date: Fri, 20 Nov 2026 13:29
18 lines
8901 bytes
8901 bytes
On Fri, Nov 20, 2026 at 12:45:56PM +0000, Doddagoudar, Susheela M wrote: > Hi All, > > I would like feedback on a proposed ethtool netlink interface for getting and setting > the polarity of individual PHY lanes. > > USE CASE > This helps debug link-up failures caused by swapped lane polarity. A user can read and flip > the polarity of a lane at runtime to see if the link comes up. Isn't swapped lanes a hardware problem? The PCB layout is wrong. The poor person who first brings up the board needs to figure out what the PCB designed did, but after that it is just Device Tree properties. I don't see a need for ethtool. Andrew
Re: Proposal: per-lane PHY polarity get/set via ethtool PHY tunables
Author: Vladimir Oltean
Date: Fri, 20 Nov 2026 14:26
Date: Fri, 20 Nov 2026 14:26
33 lines
13229 bytes
13229 bytes
On Fri, 20 Nov 2026 at 15:29, Andrew Lunn <andrew@lunn.ch> wrote: > > On Fri, Nov 20, 2026 at 12:45:56PM +0000, Doddagoudar, Susheela M wrote: > > Hi All, > > > > I would like feedback on a proposed ethtool netlink interface for getting and setting > > the polarity of individual PHY lanes. > > > > USE CASE > > This helps debug link-up failures caused by swapped lane polarity. A user can read and flip > > the polarity of a lane at runtime to see if the link comes up. > > Isn't swapped lanes a hardware problem? The PCB layout is wrong. The > poor person who first brings up the board needs to figure out what the > PCB designed did, but after that it is just Device Tree properties. > > I don't see a need for ethtool. > > Andrew > It's not a hardware problem, it's a solution to complex routing. More details in commit fceb17ac05e772ffc82f1f008e876bf7752f0576. Anyway, I also don't see a need for ethtool. To the OP: have you seen https://elixir.bootlin.com/linux/v7.3.1/source/drivers/phy/phy-common-props.c#L128 https://elixir.bootlin.com/linux/v7.3.1/source/Documentation/devicetree/bindings/phy/phy-common-props.yaml ? They are already used from some Ethernet PHY drivers.
RE: Proposal: per-lane PHY polarity get/set via ethtool PHY tunables
Author: "Doddagoudar, Susheela M"
Date: Fri, 20 Nov 2026 16:35
Date: Fri, 20 Nov 2026 16:35
68 lines
23016 bytes
23016 bytes
Hi All, On Device Tree platforms, inverted PHY lane polarity is described statically via the PHY_POL_* properties. Non-DT systems, such as x86 platforms where polarity comes from firmware or NVM, have no equivalent, and still need a way to set it at runtime for bring-up and validation. Two reasons a static description is not sufficient there: 1.ACPI overlay-based workarounds require PCI re-enumeration, which tears down the netdev. 2.Dynamic devlink port splitting changes the single- vs multi-lane topology and, with it, the per-lane polarity requirements. A runtime ethtool interface is needed to override the probe-time firmware or DT defaults after a split. Thanks, Susheela -----Original Message----- From: Vladimir Oltean <olteanv@gmail.com> Sent: 20 November 2026 19:56 To: Andrew Lunn <andrew@lunn.ch> Cc: Doddagoudar, Susheela M <susheela.m.doddagoudar@intel.com>; netdev@vger.kernel.org; maxime.chevallier@bootlin.com; Lindberg, Magnus <magnus.k.lindberg@ericsson.com>; Chintalapalle, Balaji <balaji.chintalapalle@intel.com>; D H, Siddaraju <siddaraju.dh@intel.com> Subject: Re: Proposal: per-lane PHY polarity get/set via ethtool PHY tunables On Fri, 20 Nov 2026 at 15:29, Andrew Lunn <andrew@lunn.ch> wrote: > > On Fri, Nov 20, 2026 at 12:45:56PM +0000, Doddagoudar, Susheela M wrote: > > Hi All, > > > > I would like feedback on a proposed ethtool netlink interface for > > getting and setting the polarity of individual PHY lanes. > > > > USE CASE > > This helps debug link-up failures caused by swapped lane polarity. A > > user can read and flip the polarity of a lane at runtime to see if the link comes up. > > Isn't swapped lanes a hardware problem? The PCB layout is wrong. The > poor person who first brings up the board needs to figure out what the > PCB designed did, but after that it is just Device Tree properties. > > I don't see a need for ethtool. > > Andrew > It's not a hardware problem, it's a solution to complex routing. More details in commit fceb17ac05e772ffc82f1f008e876bf7752f0576. Anyway, I also don't see a need for ethtool. To the OP: have you seen https://elixir.bootlin.com/linux/v7.3.1/source/drivers/phy/phy-common-props.c#L128 https://elixir.bootlin.com/linux/v7.3.1/source/Documentation/devicetree/bindings/phy/phy-common-props.yaml ? They are already used from some Ethernet PHY drivers.
Re: Proposal: per-lane PHY polarity get/set via ethtool PHY tunables
Author: Andrew Lunn
Date: Fri, 20 Nov 2026 17:01
Date: Fri, 20 Nov 2026 17:01
38 lines
10232 bytes
10232 bytes
On Fri, Nov 20, 2026 at 04:35:54PM +0000, Doddagoudar, Susheela M wrote: > Hi All, > > On Device Tree platforms, inverted PHY lane polarity is described statically via the PHY_POL_* properties. > Non-DT systems, such as x86 platforms where polarity comes from firmware or NVM, have no equivalent, > and still need a way to set it at runtime for bring-up and validation. Firmware and NVM are part of the problem, since there is no standardization of them across vendors. Since there is no standardisation, you are going to need dedicated tools to change them, so is it really that difficult to add one printf() in your vendor tools? > Two reasons a static description is not sufficient there: > 1.ACPI overlay-based workarounds require PCI re-enumeration, which tears down the netdev. So what. You try all combinations/permutations until it works, burn it into ACPI and the problem is solved. This should be a one time thing. > 2.Dynamic devlink port splitting changes the single- vs multi-lane topology and, with it, the > per-lane polarity requirements. Why should a port splitter require the polarity of a pair to change? A runtime ethtool interface is needed to override the probe-time > firmware or DT defaults after a split. How are you going to explain this to the end user? "If you device does not work after splitting the port, please try these magical ethtool commands until it works." Are you old enough to remember straight and twisted UTP ethernet cables? That was painful, and you seem to want to bring that pain back. That pain resulted in Auto MDI-X. Has the industry really not learned from that? Andrew
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads