netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: mvneta: add support for hardware timestamps
@ 2025-09-09 15:30 Russell King
  2025-09-09 16:17 ` Russell King (Oracle)
  2025-09-09 21:01 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Russell King @ 2025-09-09 15:30 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Marcin Wojtas, netdev, Paolo Abeni

Add support for hardware timestamps in (e.g.) the PHY by calling
skb_tx_timestamp() as close as reasonably possible to the point that
the hardware is instructed to send the queued packets.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/marvell/mvneta.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 476e73e502fe..5f4e28085640 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2985,6 +2985,13 @@ static netdev_tx_t mvneta_tx(struct sk_buff *skb, struct net_device *dev)
 		if (txq->count >= txq->tx_stop_threshold)
 			netif_tx_stop_queue(nq);
 
+		/* FIXME: This is not really the true transmit point, since
+		 * we batch up several before hitting the hardware, but is
+		 * the best we can do without more complexity to walk the
+		 * packets in the pending section of the transmit queue.
+		 */
+		skb_tx_timestamp(skb);
+
 		if (!netdev_xmit_more() || netif_xmit_stopped(nq) ||
 		    txq->pending + frags > MVNETA_TXQ_DEC_SENT_MASK)
 			mvneta_txq_pend_desc_add(pp, txq, frags);
-- 
2.47.3


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

* Re: [PATCH net-next] net: mvneta: add support for hardware timestamps
  2025-09-09 15:30 [PATCH net-next] net: mvneta: add support for hardware timestamps Russell King
@ 2025-09-09 16:17 ` Russell King (Oracle)
  2025-09-09 21:00   ` Jakub Kicinski
  2025-09-09 21:01 ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Russell King (Oracle) @ 2025-09-09 16:17 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Marcin Wojtas, netdev, Paolo Abeni

On Tue, Sep 09, 2025 at 04:30:01PM +0100, Russell King wrote:
> Add support for hardware timestamps in (e.g.) the PHY by calling
> skb_tx_timestamp() as close as reasonably possible to the point that
> the hardware is instructed to send the queued packets.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 476e73e502fe..5f4e28085640 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -2985,6 +2985,13 @@ static netdev_tx_t mvneta_tx(struct sk_buff *skb, struct net_device *dev)
>  		if (txq->count >= txq->tx_stop_threshold)
>  			netif_tx_stop_queue(nq);
>  
> +		/* FIXME: This is not really the true transmit point, since
> +		 * we batch up several before hitting the hardware, but is
> +		 * the best we can do without more complexity to walk the
> +		 * packets in the pending section of the transmit queue.
> +		 */
> +		skb_tx_timestamp(skb);
> +

A question to netdev timestamping people...

As I understand it, skb_tx_timestamp() not only adds support for
PHY-based hardware timestamping, but also adds software timestamping
at the point this call is made (hence why it needs to be placed
carefully.)

If a driver has skb_tx_timestmap() added, should the driver also
fill in the ethtool .get_ts_info() method, presumably with
ethtool_op_get_ts_info() ?

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH net-next] net: mvneta: add support for hardware timestamps
  2025-09-09 16:17 ` Russell King (Oracle)
@ 2025-09-09 21:00   ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2025-09-09 21:00 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Andrew Lunn, Heiner Kallweit, Andrew Lunn, David S. Miller,
	Eric Dumazet, Marcin Wojtas, netdev, Paolo Abeni

On Tue, 9 Sep 2025 17:17:45 +0100 Russell King (Oracle) wrote:
> If a driver has skb_tx_timestmap() added, should the driver also
> fill in the ethtool .get_ts_info() method, presumably with
> ethtool_op_get_ts_info() ?

Yes.

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

* Re: [PATCH net-next] net: mvneta: add support for hardware timestamps
  2025-09-09 15:30 [PATCH net-next] net: mvneta: add support for hardware timestamps Russell King
  2025-09-09 16:17 ` Russell King (Oracle)
@ 2025-09-09 21:01 ` Jakub Kicinski
  2025-09-09 21:07   ` Russell King (Oracle)
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2025-09-09 21:01 UTC (permalink / raw)
  To: Russell King
  Cc: Andrew Lunn, Heiner Kallweit, Andrew Lunn, David S. Miller,
	Eric Dumazet, Marcin Wojtas, netdev, Paolo Abeni

On Tue, 09 Sep 2025 16:30:01 +0100 Russell King wrote:
> +		/* FIXME: This is not really the true transmit point, since
> +		 * we batch up several before hitting the hardware, but is
> +		 * the best we can do without more complexity to walk the
> +		 * packets in the pending section of the transmit queue.
> +		 */

That's true for all SW/driver timestamps I know of. 
No objection to keeping the comment, just a FWIW.

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

* Re: [PATCH net-next] net: mvneta: add support for hardware timestamps
  2025-09-09 21:01 ` Jakub Kicinski
@ 2025-09-09 21:07   ` Russell King (Oracle)
  0 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2025-09-09 21:07 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Andrew Lunn, Heiner Kallweit, Andrew Lunn, David S. Miller,
	Eric Dumazet, Marcin Wojtas, netdev, Paolo Abeni

On Tue, Sep 09, 2025 at 02:01:13PM -0700, Jakub Kicinski wrote:
> On Tue, 09 Sep 2025 16:30:01 +0100 Russell King wrote:
> > +		/* FIXME: This is not really the true transmit point, since
> > +		 * we batch up several before hitting the hardware, but is
> > +		 * the best we can do without more complexity to walk the
> > +		 * packets in the pending section of the transmit queue.
> > +		 */
> 
> That's true for all SW/driver timestamps I know of. 
> No objection to keeping the comment, just a FWIW.

I'll drop the "FIXME:" prefix and re-send tomorrow with the
.get_ts_info() op filled in.

Thanks Jakub.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

end of thread, other threads:[~2025-09-09 21:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 15:30 [PATCH net-next] net: mvneta: add support for hardware timestamps Russell King
2025-09-09 16:17 ` Russell King (Oracle)
2025-09-09 21:00   ` Jakub Kicinski
2025-09-09 21:01 ` Jakub Kicinski
2025-09-09 21:07   ` Russell King (Oracle)

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).