mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
@ 2026-09-07  4:28 Ratheesh Kannoth
  2026-09-07  7:23 ` Leon Romanovsky
  2026-09-07 21:40 ` Jakub Kicinski
  0 siblings, 2 replies; 7+ messages in thread
From: Ratheesh Kannoth @ 2026-09-07  4:28 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, sgoutham,
	Hariprasad Kelam, Ratheesh Kannoth

From: Hariprasad Kelam <hkelam@marvell.com>

otx2_get_link_ksettings() already fills speed, duplex, autoneg, link
modes and FEC from CGX firmware data, but leaves cmd->base.port unset.
As a result, ethtool does not show the physical connector type even
though the firmware provides it in fwdata.port.

Populate cmd->base.port from rsp->fwdata.port so users can see values
such as PORT_TP or PORT_AUI via ethtool.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>

---
v1 -> v2: Addressed sashiko comments.
	https://lore.kernel.org/netdev/20260904154833.3b32ea6a@kernel.org/
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 9bee1b91eeaa..9b4c151b4d7d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -1231,6 +1231,8 @@ 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);
+
+	cmd->base.port = (u8)rsp->fwdata.port;
 	return 0;
 }
 
-- 
2.43.0


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

* Re: [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
  2026-09-07  4:28 [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings Ratheesh Kannoth
@ 2026-09-07  7:23 ` Leon Romanovsky
  2026-09-07 11:01   ` Ratheesh Kannoth
  2026-09-07 21:40 ` Jakub Kicinski
  1 sibling, 1 reply; 7+ messages in thread
From: Leon Romanovsky @ 2026-09-07  7:23 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: linux-kernel, netdev, andrew+netdev, davem, edumazet, kuba,
	pabeni, sgoutham, Hariprasad Kelam

On Mon, Sep 07, 2026 at 09:58:27AM +0530, Ratheesh Kannoth wrote:
> From: Hariprasad Kelam <hkelam@marvell.com>
> 
> otx2_get_link_ksettings() already fills speed, duplex, autoneg, link
> modes and FEC from CGX firmware data, but leaves cmd->base.port unset.
> As a result, ethtool does not show the physical connector type even
> though the firmware provides it in fwdata.port.
> 
> Populate cmd->base.port from rsp->fwdata.port so users can see values
> such as PORT_TP or PORT_AUI via ethtool.
> 
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
> 
> ---
> v1 -> v2: Addressed sashiko comments.
> 	https://lore.kernel.org/netdev/20260904154833.3b32ea6a@kernel.org/
> ---
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> index 9bee1b91eeaa..9b4c151b4d7d 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> @@ -1231,6 +1231,8 @@ 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);
> +
> +	cmd->base.port = (u8)rsp->fwdata.port;

You should declare identical fields with the same type and avoid silently
casting variables.

Thanks

>  	return 0;
>  }
>  
> -- 
> 2.43.0
> 
> 

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

* Re: [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
  2026-09-07  7:23 ` Leon Romanovsky
@ 2026-09-07 11:01   ` Ratheesh Kannoth
  2026-09-07 11:35     ` Leon Romanovsky
  0 siblings, 1 reply; 7+ messages in thread
From: Ratheesh Kannoth @ 2026-09-07 11:01 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: linux-kernel, netdev, andrew+netdev, davem, edumazet, kuba,
	pabeni, sgoutham, Hariprasad Kelam

On 2026-09-07 at 12:53:15, Leon Romanovsky (leon@kernel.org) wrote:
> On Mon, Sep 07, 2026 at 09:58:27AM +0530, Ratheesh Kannoth wrote:
> > From: Hariprasad Kelam <hkelam@marvell.com>
> >
> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> > @@ -1231,6 +1231,8 @@ 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);
> > +
> > +	cmd->base.port = (u8)rsp->fwdata.port;
>
> You should declare identical fields with the same type and avoid silently
> casting variables.
>
> Thanks
You are suggesting to split rsp->fwdata.port to  u8 port + 7-byte pad ?
Currently FW is writing as 64bit.

>
> >  	return 0;
> >  }
> >
> > --
> > 2.43.0
> >
> >

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

* Re: [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
  2026-09-07 11:01   ` Ratheesh Kannoth
@ 2026-09-07 11:35     ` Leon Romanovsky
  0 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2026-09-07 11:35 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: linux-kernel, netdev, andrew+netdev, davem, edumazet, kuba,
	pabeni, sgoutham, Hariprasad Kelam

On Mon, Sep 07, 2026 at 04:31:45PM +0530, Ratheesh Kannoth wrote:
> On 2026-09-07 at 12:53:15, Leon Romanovsky (leon@kernel.org) wrote:
> > On Mon, Sep 07, 2026 at 09:58:27AM +0530, Ratheesh Kannoth wrote:
> > > From: Hariprasad Kelam <hkelam@marvell.com>
> > >
> > > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> > > @@ -1231,6 +1231,8 @@ 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);
> > > +
> > > +	cmd->base.port = (u8)rsp->fwdata.port;
> >
> > You should declare identical fields with the same type and avoid silently
> > casting variables.
> >
> > Thanks
> You are suggesting to split rsp->fwdata.port to  u8 port + 7-byte pad ?

pad or reserved, something like that.

Thanks

> Currently FW is writing as 64bit.
> 
> >
> > >  	return 0;
> > >  }
> > >
> > > --
> > > 2.43.0
> > >
> > >

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

* Re: [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
  2026-09-07  4:28 [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings Ratheesh Kannoth
  2026-09-07  7:23 ` Leon Romanovsky
@ 2026-09-07 21:40 ` Jakub Kicinski
  2026-09-08  2:31   ` Ratheesh Kannoth
  1 sibling, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2026-09-07 21:40 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: linux-kernel, netdev, andrew+netdev, davem, edumazet, pabeni,
	sgoutham, Hariprasad Kelam

On Mon, 7 Sep 2026 09:58:27 +0530 Ratheesh Kannoth wrote:
> otx2_get_link_ksettings() already fills speed, duplex, autoneg, link
> modes and FEC from CGX firmware data, but leaves cmd->base.port unset.
> As a result, ethtool does not show the physical connector type even
> though the firmware provides it in fwdata.port.
> 
> Populate cmd->base.port from rsp->fwdata.port so users can see values
> such as PORT_TP or PORT_AUI via ethtool.

I said:

  drivers should not blindly pass values between uAPI and the FW.

That means you have to add some explicit validation/translation
for each value even if they are numerically identical.

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

* Re: [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
  2026-09-07 21:40 ` Jakub Kicinski
@ 2026-09-08  2:31   ` Ratheesh Kannoth
  2026-09-08 20:59     ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Ratheesh Kannoth @ 2026-09-08  2:31 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: linux-kernel, netdev, andrew+netdev, davem, edumazet, pabeni,
	sgoutham, Hariprasad Kelam, Leon Romanovsky

On 2026-09-08 at 03:10:38, Jakub Kicinski (kuba@kernel.org) wrote:
> On Mon, 7 Sep 2026 09:58:27 +0530 Ratheesh Kannoth wrote:
> > otx2_get_link_ksettings() already fills speed, duplex, autoneg, link
> > modes and FEC from CGX firmware data, but leaves cmd->base.port unset.
> > As a result, ethtool does not show the physical connector type even
> > though the firmware provides it in fwdata.port.
> >
> > Populate cmd->base.port from rsp->fwdata.port so users can see values
> > such as PORT_TP or PORT_AUI via ethtool.
>
> I said:
>
>   drivers should not blindly pass values between uAPI and the FW.
>
> That means you have to add some explicit validation/translation
> for each value even if they are numerically identical.

A field_get() would be OK to satisfy this translation ?

cmd->base.port = FIELD_GET(GENMASK(7, 0), rsp->fwdata.port);

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

* Re: [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
  2026-09-08  2:31   ` Ratheesh Kannoth
@ 2026-09-08 20:59     ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2026-09-08 20:59 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: linux-kernel, netdev, andrew+netdev, davem, edumazet, pabeni,
	sgoutham, Hariprasad Kelam, Leon Romanovsky

On Tue, 8 Sep 2026 08:01:55 +0530 Ratheesh Kannoth wrote:
> > I said:
> >
> >   drivers should not blindly pass values between uAPI and the FW.
> >
> > That means you have to add some explicit validation/translation
> > for each value even if they are numerically identical.  
> 
> A field_get() would be OK to satisfy this translation ?
> 
> cmd->base.port = FIELD_GET(GENMASK(7, 0), rsp->fwdata.port);

switch (fw_value) {
	case X:
	case Y:
		return fw_value;
	default:
		return -EINVAL;
}

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

end of thread, other threads:[~2026-09-08 20:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-07  4:28 [PATCH v2 net-next] octeontx2-pf: report port connector type in ethtool link ksettings Ratheesh Kannoth
2026-09-07  7:23 ` Leon Romanovsky
2026-09-07 11:01   ` Ratheesh Kannoth
2026-09-07 11:35     ` Leon Romanovsky
2026-09-07 21:40 ` Jakub Kicinski
2026-09-08  2:31   ` Ratheesh Kannoth
2026-09-08 20:59     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®