[PATCH net v3] octeontx2-pf: Fix ethtool timestamping capabilities for SDP representors
From: <hidden>
Date: 2026-09-07 03:23:39
Also in:
lkml
Subsystem:
marvell octeontx2 physical function driver, networking drivers, the rest · Maintainers:
Sunil Goutham, Geetha sowjanya, Ratheesh Kannoth, Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
From: Roy Franz <redacted>
SDP representors do not support hardware timestamping. Fix this by
skipping PTP initialization for SDP representors in otx2_ptp_init(),
similar to how it is already skipped for LBK VFs. This ensures
otx2_get_ts_info() reports only software timestamping capabilities
to userspace.
Also fix otx2_config_hwtstamp_set() to return -EOPNOTSUPP with a
descriptive error message when PTP is not available, and add null
checks for pfvf->ptp and sq->timestamps in otx2_set_txtstamp() to
avoid a potential NULL dereference.
Fixes: 2f7f33a09516 ("octeontx2-pf: Add representors for sdp MAC")
Signed-off-by: Nitin Shetty J <redacted>
Signed-off-by: Roy Franz <redacted>
---
v3:
- In otx2_config_hwtstamp_set(), replace -ENODEV with -EOPNOTSUPP and
add NL_SET_ERR_MSG_MOD() to provide a descriptive extack error message
when pfvf->ptp is NULL (hardware timestamping not supported).
- In otx2_set_txtstamp(), add guards for pfvf->ptp and sq->timestamps
being non-NULL before entering the hardware TX timestamp path, preventing
a potential NULL pointer dereference on interfaces without PTP support.
v2:
- Disable PTP initialization for SDP representors to cover both
ethtool capabilities and hwtstamp ioctl handling.
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 7 +++++--
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c | 2 +-
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index c0e2100de1d9..b231f5c6b23f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c@@ -2532,8 +2532,11 @@ int otx2_config_hwtstamp_set(struct net_device *netdev, { struct otx2_nic *pfvf = netdev_priv(netdev); - if (!pfvf->ptp) - return -ENODEV; + if (!pfvf->ptp) { + NL_SET_ERR_MSG_MOD(extack, + "Hardware timestamping is not supported"); + return -EOPNOTSUPP; + } switch (config->tx_type) { case HWTSTAMP_TX_OFF:
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c
index 95b0a1e7c936..7b0a51f453ce 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c@@ -386,7 +386,7 @@ int otx2_ptp_init(struct otx2_nic *pfvf) struct ptp_req *req; int err; - if (is_otx2_lbkvf(pfvf->pdev)) { + if (is_otx2_lbkvf(pfvf->pdev) || is_otx2_sdp_rep(pfvf->pdev)) { pfvf->ptp = NULL; return 0; }
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index 8d2d607bc92f..94da021d452e 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c@@ -1135,7 +1135,8 @@ static void otx2_set_txtstamp(struct otx2_nic *pfvf, struct sk_buff *skb, __wsum skb_csum; u64 iova; - if (unlikely(!skb_shinfo(skb)->gso_size && + if (unlikely(pfvf->ptp && sq->timestamps && + !skb_shinfo(skb)->gso_size && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))) { if (unlikely(pfvf->flags & OTX2_FLAG_PTP_ONESTEP_SYNC && otx2_ptp_is_sync(skb, &ptp_offset, &udp_csum_crt))) {
--
2.48.1