[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1749631576-2517-4-git-send-email-ernis@linux.microsoft.com>
Date: Wed, 11 Jun 2025 01:46:15 -0700
From: Erni Sri Satya Vennela <ernis@...ux.microsoft.com>
To: kys@...rosoft.com,
haiyangz@...rosoft.com,
wei.liu@...nel.org,
decui@...rosoft.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
kotaranov@...rosoft.com,
longli@...rosoft.com,
horms@...nel.org,
shirazsaleem@...rosoft.com,
leon@...nel.org,
ernis@...ux.microsoft.com,
shradhagupta@...ux.microsoft.com,
schakrabarti@...ux.microsoft.com,
rosenp@...il.com,
sdf@...ichev.me,
linux-hyperv@...r.kernel.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-rdma@...r.kernel.org
Subject: [PATCH net-next 3/4] net: mana: Add speed support in mana_get_link_ksettings
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 ot that 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@...ux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@...rosoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@...ux.microsoft.com>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 1 +
drivers/net/ethernet/microsoft/mana/mana_ethtool.c | 6 ++++++
include/net/mana/mana.h | 2 ++
3 files changed, 9 insertions(+)
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index b704dbc5e344..d5644400e71f 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -1271,6 +1271,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;
}
diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
index c419626073f5..1026b0b2b59f 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
@@ -427,6 +427,12 @@ static int mana_set_ringparam(struct net_device *ndev,
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;
diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
index 0df84e51d541..5f38dec04d31 100644
--- a/include/net/mana/mana.h
+++ b/include/net/mana/mana.h
@@ -474,6 +474,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 */
--
2.34.1
Powered by blists - more mailing lists