netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] octeontx2-pf: Fix ethtool timestamping capabilities for SDP representors
@ 2026-09-07  3:23 nshettyj
  2026-09-10  3:25 ` netdev-bot+sashiko
  0 siblings, 1 reply; 2+ messages in thread
From: nshettyj @ 2026-09-07  3:23 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Roy Franz, Nitin Shetty J, Sunil Goutham, Geetha sowjanya,
	Ratheesh Kannoth, Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Richard Cochran, Simon Horman

From: Roy Franz <rfranz@marvell.com>

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 <nshettyj@marvell.com>
Signed-off-by: Roy Franz <rfranz@marvell.com>
---
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


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

end of thread, other threads:[~2026-09-10  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07  3:23 [PATCH net v3] octeontx2-pf: Fix ethtool timestamping capabilities for SDP representors nshettyj
2026-09-10  3:25 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).