netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PatchV3] Octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields
@ 2025-07-24 10:10 Hariprasad Kelam
  2025-07-25 13:13 ` Simon Horman
  2025-07-25 23:53 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Hariprasad Kelam @ 2025-07-24 10:10 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Hariprasad Kelam, Sunil Goutham, Geetha sowjanya,
	Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni

The Octeontx2/CN10k netdev drivers access a shared firmware structure
to obtain link configuration details, such as supported and advertised
link modes. This patch adds support to display the same.

ethtool eth1
Settings for eth1:
    Supported ports: [ ]
    Supported link modes:  10000baseCR/Full
	                   10000baseSR/Full
                           10000baseLR/Full
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Supported FEC modes: None
    Advertised link modes: Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: None
    Speed: 10000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Current message level: 0x00000000 (0)
    Link detected: yes

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
---
V3 * Fix port types in firmware 

V2 * Add validation for 'port' parameter
    include full output of ethtool ethx

 .../marvell/octeontx2/nic/otx2_ethtool.c      | 24 +++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 998c734ff839..95a7aa2b6b69 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -1184,11 +1184,13 @@ static void otx2_get_link_mode_info(u64 link_mode_bmap,
 	}
 
 	if (req_mode == OTX2_MODE_ADVERTISED)
-		linkmode_copy(link_ksettings->link_modes.advertising,
-			      otx2_link_modes);
+		linkmode_or(link_ksettings->link_modes.advertising,
+			    link_ksettings->link_modes.advertising,
+			    otx2_link_modes);
 	else
-		linkmode_copy(link_ksettings->link_modes.supported,
-			      otx2_link_modes);
+		linkmode_or(link_ksettings->link_modes.supported,
+			    link_ksettings->link_modes.supported,
+			    otx2_link_modes);
 }
 
 static int otx2_get_link_ksettings(struct net_device *netdev,
@@ -1209,6 +1211,10 @@ static int otx2_get_link_ksettings(struct net_device *netdev,
 		ethtool_link_ksettings_add_link_mode(cmd,
 						     supported,
 						     Autoneg);
+	if (rsp->fwdata.advertised_an)
+		ethtool_link_ksettings_add_link_mode(cmd,
+						     advertising,
+						     Autoneg);
 
 	otx2_get_link_mode_info(rsp->fwdata.advertised_link_modes,
 				OTX2_MODE_ADVERTISED, cmd);
@@ -1218,6 +1224,16 @@ static int otx2_get_link_ksettings(struct net_device *netdev,
 				OTX2_MODE_SUPPORTED, cmd);
 	otx2_get_fec_info(rsp->fwdata.supported_fec,
 			  OTX2_MODE_SUPPORTED, cmd);
+
+	switch (rsp->fwdata.port) {
+	case PORT_TP:
+	case PORT_FIBRE:
+		cmd->base.port = rsp->fwdata.port;
+		break;
+	default:
+		cmd->base.port = PORT_NONE;
+	}
+
 	return 0;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next PatchV3] Octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields
  2025-07-24 10:10 [net-next PatchV3] Octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields Hariprasad Kelam
@ 2025-07-25 13:13 ` Simon Horman
  2025-07-25 23:53 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-07-25 13:13 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: netdev, linux-kernel, Sunil Goutham, Geetha sowjanya,
	Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni

On Thu, Jul 24, 2025 at 03:40:57PM +0530, Hariprasad Kelam wrote:
> The Octeontx2/CN10k netdev drivers access a shared firmware structure
> to obtain link configuration details, such as supported and advertised
> link modes. This patch adds support to display the same.
> 
> ethtool eth1
> Settings for eth1:
>     Supported ports: [ ]
>     Supported link modes:  10000baseCR/Full
> 	                   10000baseSR/Full
>                            10000baseLR/Full
>     Supported pause frame use: No
>     Supports auto-negotiation: Yes
>     Supported FEC modes: None
>     Advertised link modes: Not reported
>     Advertised pause frame use: No
>     Advertised auto-negotiation: Yes
>     Advertised FEC modes: None
>     Speed: 10000Mb/s
>     Duplex: Full
>     Port: Twisted Pair
>     PHYAD: 0
>     Transceiver: internal
>     Auto-negotiation: on
>     MDI-X: Unknown
>     Current message level: 0x00000000 (0)
>     Link detected: yes
> 
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> ---
> V3 * Fix port types in firmware 
> 
> V2 * Add validation for 'port' parameter
>     include full output of ethtool ethx

Thanks, I believe this addresses Jakub's review of v2.

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net-next PatchV3] Octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields
  2025-07-24 10:10 [net-next PatchV3] Octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields Hariprasad Kelam
  2025-07-25 13:13 ` Simon Horman
@ 2025-07-25 23:53 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-07-25 23:53 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: netdev, linux-kernel, Sunil Goutham, Geetha sowjanya,
	Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, David S. Miller,
	Eric Dumazet, Paolo Abeni

On Thu, 24 Jul 2025 15:40:57 +0530 Hariprasad Kelam wrote:
>     Supported link modes:  10000baseCR/Full
> 	                   10000baseSR/Full
>                            10000baseLR/Full

>     Speed: 10000Mb/s
>     Duplex: Full
>     Port: Twisted Pair

How can you have twisted pair with those link modes.
Twisted pair is 10000baseT/Full.
If the link mode is CR the correct port type is PORT_DA.
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-25 23:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24 10:10 [net-next PatchV3] Octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields Hariprasad Kelam
2025-07-25 13:13 ` Simon Horman
2025-07-25 23:53 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).