]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ethtool: add KSZ87xx low-loss cable PHY tunables
authorFidelio Lawson <lawson.fidelio@gmail.com>
Tue, 9 Jun 2026 16:19:56 +0000 (18:19 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 11 Jun 2026 22:47:56 +0000 (15:47 -0700)
Introduce vendor-specific PHY tunable identifiers to control the
KSZ87xx low-loss cable erratum handling through the ethtool PHY
tunable interface.

The following tunables are added:

- a boolean "short-cable" tunable, applying a documented and
  conservative preset intended for short or low-loss Ethernet cables;

- an integer LPF bandwidth tunable, allowing advanced adjustment of the
  receiver low-pass filter bandwidth;

- an integer DSP EQ initial value tunable, allowing advanced tuning of
  the PHY equalizer initialization.

The actual behavior is implemented by the corresponding PHY and switch
drivers.

Reviewed-by: Marek Vasut <marex@nabladev.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Fidelio Lawson <fidelio.lawson@exotec.com>
Link: https://patch.msgid.link/20260609-ksz87xx_errata_low_loss_connections-v10-2-9ba4418cf3db@exotec.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/uapi/linux/ethtool.h
net/ethtool/common.c
net/ethtool/ioctl.c

index 1cdfb8341df24250635535742adb903b64e478f2..a2091d4e00f3f1c120ba1ffc97ca40e925c9d22c 100644 (file)
@@ -291,6 +291,9 @@ enum phy_tunable_id {
        ETHTOOL_PHY_DOWNSHIFT,
        ETHTOOL_PHY_FAST_LINK_DOWN,
        ETHTOOL_PHY_EDPD,
+       ETHTOOL_PHY_SHORT_CABLE_PRESET,
+       ETHTOOL_PHY_LPF_BW,
+       ETHTOOL_PHY_DSP_EQ_INIT_VALUE,
        /*
         * Add your fresh new phy tunable attribute above and remember to update
         * phy_tunable_strings[] in net/ethtool/common.c
index 84ec88dee05c5e542bae8b083c5e6b2c57b81c00..a24d3a8a9ec1fcd9c91d5940c6b313b49468a604 100644 (file)
@@ -101,6 +101,9 @@ phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN] = {
        [ETHTOOL_PHY_DOWNSHIFT] = "phy-downshift",
        [ETHTOOL_PHY_FAST_LINK_DOWN] = "phy-fast-link-down",
        [ETHTOOL_PHY_EDPD]      = "phy-energy-detect-power-down",
+       [ETHTOOL_PHY_SHORT_CABLE_PRESET] = "phy-short-cable-preset",
+       [ETHTOOL_PHY_LPF_BW]    = "phy-lpf-bandwidth",
+       [ETHTOOL_PHY_DSP_EQ_INIT_VALUE] = "phy-dsp-eq-init-value",
 };
 
 #define __LINK_MODE_NAME(speed, type, duplex) \
index a7bff829b758bd94378a5bd98f8c25b3f05decd4..4b0bc503f9307880e436d5ee30f75476264a0c6b 100644 (file)
@@ -3133,6 +3133,7 @@ static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna)
        switch (tuna->id) {
        case ETHTOOL_PHY_DOWNSHIFT:
        case ETHTOOL_PHY_FAST_LINK_DOWN:
+       case ETHTOOL_PHY_SHORT_CABLE_PRESET:
                if (tuna->len != sizeof(u8) ||
                    tuna->type_id != ETHTOOL_TUNABLE_U8)
                        return -EINVAL;
@@ -3142,6 +3143,12 @@ static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna)
                    tuna->type_id != ETHTOOL_TUNABLE_U16)
                        return -EINVAL;
                break;
+       case ETHTOOL_PHY_LPF_BW:
+       case ETHTOOL_PHY_DSP_EQ_INIT_VALUE:
+               if (tuna->len != sizeof(u32) ||
+                   tuna->type_id != ETHTOOL_TUNABLE_U32)
+                       return -EINVAL;
+               break;
        default:
                return -EINVAL;
        }