All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next PatchV2] octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields
@ 2025-05-23 11:26 Hariprasad Kelam
  2025-05-23 13:45 ` Simon Horman
  2025-05-28  0:18 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Hariprasad Kelam @ 2025-05-23 11:26 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Hariprasad Kelam, Sunil Goutham, Linu Cherian, Geetha sowjanya,
	Jerin Jacob, Subbaraya Sundeep, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Bharat Bhushan

The Octeontx2/CN10k netdev drivers access a shared firmware structure
to obtain link configuration details, such as supported and advertised
link modes.

This patch updates the shared firmware data to include additional
fields like 'Autonegotiation' and 'Port type'.

ethtool eth1

Settings for eth1:
        Supported ports: [ ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
                                10000baseT/Full
                                10000baseKR/Full
                                1000baseX/Full
                                10000baseSR/Full
                                10000baseLR/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: BaseR
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: BaseR
        Speed: 10000Mb/s
        Duplex: Full
        Port: AUI
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Current message level: 0x00000000 (0)

        Link detected: yes

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
---
V2* Add validation for 'port' parameter
    include full output of ethtool ethx

 .../net/ethernet/marvell/octeontx2/af/mbox.h  |  4 +++-
 .../marvell/octeontx2/nic/otx2_ethtool.c      | 24 +++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
index 005ca8a056c0..4a305c183987 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
@@ -652,7 +652,9 @@ struct cgx_lmac_fwdata_s {
 	/* Only applicable if SFP/QSFP slot is present */
 	struct sfp_eeprom_s sfp_eeprom;
 	struct phy_s phy;
-#define LMAC_FWDATA_RESERVED_MEM 1021
+	u64 advertised_an:1;
+	u64 port;
+#define LMAC_FWDATA_RESERVED_MEM 1019
 	u64 reserved[LMAC_FWDATA_RESERVED_MEM];
 };
 
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 45b8c9230184..5482a9a1908a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -1174,11 +1174,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,
@@ -1200,6 +1202,11 @@ static int otx2_get_link_ksettings(struct net_device *netdev,
 						     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);
 	otx2_get_fec_info(rsp->fwdata.advertised_fec,
@@ -1208,6 +1215,15 @@ 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_AUI:
+		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 PatchV2] octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields
  2025-05-23 11:26 [net-next PatchV2] octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields Hariprasad Kelam
@ 2025-05-23 13:45 ` Simon Horman
  2025-05-28  0:18 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-05-23 13:45 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: netdev, linux-kernel, Sunil Goutham, Linu Cherian,
	Geetha sowjanya, Jerin Jacob, Subbaraya Sundeep, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Bharat Bhushan

On Fri, May 23, 2025 at 04:56:38PM +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 updates the shared firmware data to include additional
> fields like 'Autonegotiation' and 'Port type'.
> 
> ethtool eth1
> 
> Settings for eth1:
>         Supported ports: [ ]
>         Supported link modes:   10baseT/Half 10baseT/Full
>                                 100baseT/Half 100baseT/Full
>                                 1000baseT/Half 1000baseT/Full
>                                 10000baseT/Full
>                                 10000baseKR/Full
>                                 1000baseX/Full
>                                 10000baseSR/Full
>                                 10000baseLR/Full
>         Supported pause frame use: No
>         Supports auto-negotiation: Yes
>         Supported FEC modes: BaseR
>         Advertised link modes:  Not reported
>         Advertised pause frame use: No
>         Advertised auto-negotiation: Yes
>         Advertised FEC modes: BaseR
>         Speed: 10000Mb/s
>         Duplex: Full
>         Port: AUI
>         PHYAD: 0
>         Transceiver: internal
>         Auto-negotiation: off
>         Current message level: 0x00000000 (0)
> 
>         Link detected: yes
> 
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> ---
> V2* Add validation for 'port' parameter
>     include full output of ethtool ethx

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


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

* Re: [net-next PatchV2] octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields
  2025-05-23 11:26 [net-next PatchV2] octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields Hariprasad Kelam
  2025-05-23 13:45 ` Simon Horman
@ 2025-05-28  0:18 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-05-28  0:18 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: netdev, linux-kernel, Sunil Goutham, Linu Cherian,
	Geetha sowjanya, Jerin Jacob, Subbaraya Sundeep, Andrew Lunn,
	David S. Miller, Eric Dumazet, Paolo Abeni, Bharat Bhushan

On Fri, 23 May 2025 16:56:38 +0530 Hariprasad Kelam wrote:
> +	case PORT_TP:
> +	case PORT_AUI:
> +		cmd->base.port = rsp->fwdata.port;
> +		break;

You're running 10g Ethernet over a 15 pin serial port? :/
AFAIU PORT_AUI refers to 30 year old, 10Mbps connectors.
You probably mean PORT_DA (Direct Attached [Copper]) ?

If that's right and the FW gets it wrong just fix it up in the driver?

	case PORT_AUI: /* FW uses the wrong ID for DA */
		cmd->base.port = PORT_DA;
		break;

? Please note that net-next is now closed for 2 weeks of the merge
window.
-- 
pw-bot: cr

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

end of thread, other threads:[~2025-05-28  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 11:26 [net-next PatchV2] octeontx2-pf: ethtool: Display "Autoneg" and "Port" fields Hariprasad Kelam
2025-05-23 13:45 ` Simon Horman
2025-05-28  0:18 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.