From: Ratheesh Kannoth <rkannoth@marvell.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<sgoutham@marvell.com>, "Hariprasad Kelam" <hkelam@marvell.com>,
Ratheesh Kannoth <rkannoth@marvell.com>
Subject: [PATCH v3 net-next] octeontx2-pf: report port connector type in ethtool link ksettings
Date: Wed, 9 Sep 2026 09:36:20 +0530 [thread overview]
Message-ID: <20260909040621.397255-1-rkannoth@marvell.com> (raw)
From: Hariprasad Kelam <hkelam@marvell.com>
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 <hkelam@marvell.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
v2 -> v3:
- Extract only the connector type bits with FIELD_GET(GENMASK(7, 0), ...)
instead of casting the full 64-bit firmware field to u8.
- Validate firmware values against the ethtool PORT_* whitelist before
exposing them to userspace, per Jakub's review.
- Map unrecognized firmware values to PORT_OTHER instead of passing
them through blindly.
v1 -> v2:
- Addressed Sashiko review comments.
https://lore.kernel.org/netdev/20260904154833.3b32ea6a@kernel.org/
---
.../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;
}
--
2.43.0
next reply other threads:[~2026-09-09 4:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 4:06 Ratheesh Kannoth [this message]
2026-09-10 4:32 ` netdev-bot+sashiko
2026-09-10 9:03 ` Ratheesh Kannoth
2026-09-10 10:41 ` Simon Horman
2026-09-15 1:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260909040621.397255-1-rkannoth@marvell.com \
--to=rkannoth@marvell.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkelam@marvell.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sgoutham@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®