From afabe5e67b67401aab9002014af56cf2a42743d9 Mon Sep 17 00:00:00 2001 From: Hariprasad Kelam Date: Wed, 9 Sep 2026 09:36:20 +0530 Subject: [PATCH] octeontx2-pf: report port connector type in ethtool link ksettings otx2_get_link_ksettings() already reports speed, duplex, autoneg, link modes and FEC from CGX firmware shared data, but never fills cmd->base.port. As a result, ethtool does not show the physical connector type even though firmware provides it in fwdata.port. Read the connector type from shared firmware data and expose it via ethtool. Extract only the low 8 bits of the firmware field and validate the value against the standard ethtool PORT_* definitions before publishing it to userspace. Signed-off-by: Hariprasad Kelam Signed-off-by: Ratheesh Kannoth Reviewed-by: Simon Horman Link: https://patch.msgid.link/20260909040621.397255-1-rkannoth@marvell.com Signed-off-by: Jakub Kicinski --- .../marvell/octeontx2/nic/otx2_ethtool.c | 18 ++++++++++++++++++ 1 file changed, 18 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..a05dee0085a3 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -1209,6 +1209,7 @@ static int otx2_get_link_ksettings(struct net_device *netdev, { struct otx2_nic *pfvf = netdev_priv(netdev); struct cgx_fw_data *rsp = NULL; + u8 port; cmd->base.duplex = pfvf->linfo.full_duplex; cmd->base.speed = pfvf->linfo.speed; @@ -1231,6 +1232,23 @@ 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); + + port = FIELD_GET(GENMASK(7, 0), rsp->fwdata.port); + switch (port) { + case PORT_TP: + case PORT_AUI: + case PORT_MII: + case PORT_FIBRE: + case PORT_BNC: + case PORT_DA: + case PORT_NONE: + cmd->base.port = port; + break; + default: + cmd->base.port = PORT_OTHER; + break; + } + return 0; }