Skip to content

Commit 61a5989

Browse files
Erni Sri Satya VennelaNipaLocal
authored andcommitted
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/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 <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Reviewed-by: Shradha Gupta <[email protected]> Reviewed-by: Saurabh Singh Sengar <[email protected]> Reviewed-by: Long Li <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 7aacfec commit 61a5989

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,7 @@ int mana_query_link_cfg(struct mana_port_context *apc)
12721272
return err;
12731273
}
12741274
apc->speed = resp.link_speed_mbps;
1275+
apc->max_speed = resp.qos_speed_mbps;
12751276
return 0;
12761277
}
12771278

drivers/net/ethernet/microsoft/mana/mana_ethtool.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,12 @@ static int mana_set_ringparam(struct net_device *ndev,
495495
static int mana_get_link_ksettings(struct net_device *ndev,
496496
struct ethtool_link_ksettings *cmd)
497497
{
498+
struct mana_port_context *apc = netdev_priv(ndev);
499+
int err;
500+
501+
err = mana_query_link_cfg(apc);
502+
cmd->base.speed = (err) ? SPEED_UNKNOWN : apc->max_speed;
503+
498504
cmd->base.duplex = DUPLEX_FULL;
499505
cmd->base.port = PORT_OTHER;
500506

include/net/mana/mana.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,8 @@ struct mana_port_context {
533533
u16 port_idx;
534534
/* Currently configured speed (mbps) */
535535
u32 speed;
536+
/* Maximum speed supported by the SKU (mbps) */
537+
u32 max_speed;
536538

537539
bool port_is_up;
538540
bool port_st_save; /* Saved port state */

0 commit comments

Comments
 (0)