]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: mana: Add speed support in mana_get_link_ksettings
authorErni Sri Satya Vennela <ernis@linux.microsoft.com>
Tue, 17 Jun 2025 07:17:35 +0000 (00:17 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 19 Jun 2025 13:13:49 +0000 (15:13 +0200)
Allow mana ethtool get_link_ksettings operation to report
the maximum speed supported by the SKU in mbps.

The driver retrieves this information by issuing a
HWC command to the hardware via mana_query_link_cfg(),
which retrieves the SKU's maximum supported speed.

These APIs when invoked on hardware that are older/do
not support these APIs, the speed would be reported as UNKNOWN.

Before:
$ethtool enP30832s1
> Settings for enP30832s1:
        Supported ports: [  ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Full
        Auto-negotiation: off
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Link detected: yes

After:
$ethtool enP30832s1
> Settings for enP30832s1:
        Supported ports: [  ]
        Supported link modes:   Not reported
        Supported pause frame use: No
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 16000Mb/s
        Duplex: Full
        Auto-negotiation: off
        Port: Other
        PHYAD: 0
        Transceiver: internal
        Link detected: yes

Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Reviewed-by: Saurabh Singh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Long Li <longli@microsoft.com>
Link: https://patch.msgid.link/1750144656-2021-4-git-send-email-ernis@linux.microsoft.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microsoft/mana/mana_en.c
drivers/net/ethernet/microsoft/mana/mana_ethtool.c
include/net/mana/mana.h

index 547dff450b6ddd6d8dbb8775afa8d11b4127d143..d7079e05dfb87597588f20db24333373897122d0 100644 (file)
@@ -1272,6 +1272,7 @@ int mana_query_link_cfg(struct mana_port_context *apc)
                return err;
        }
        apc->speed = resp.link_speed_mbps;
+       apc->max_speed = resp.qos_speed_mbps;
        return 0;
 }
 
index 4fb3a04994a2dce9467e63bc21c675427ed389c8..a1afa75a946313928f18a5c8f046986b500a340f 100644 (file)
@@ -495,6 +495,12 @@ out:
 static int mana_get_link_ksettings(struct net_device *ndev,
                                   struct ethtool_link_ksettings *cmd)
 {
+       struct mana_port_context *apc = netdev_priv(ndev);
+       int err;
+
+       err = mana_query_link_cfg(apc);
+       cmd->base.speed = (err) ? SPEED_UNKNOWN : apc->max_speed;
+
        cmd->base.duplex = DUPLEX_FULL;
        cmd->base.port = PORT_OTHER;
 
index 038b18340e51334e0c38f3bfc214b3afe0422c54..e1030a7d2daab2297ac70e78f2c09c7bb8fddaa0 100644 (file)
@@ -533,6 +533,8 @@ struct mana_port_context {
        u16 port_idx;
        /* Currently configured speed (mbps) */
        u32 speed;
+       /* Maximum speed supported by the SKU (mbps) */
+       u32 max_speed;
 
        bool port_is_up;
        bool port_st_save; /* Saved port state */