linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: thunder: make tx software timestamp independent
@ 2025-05-08  3:44 Jason Xing
  2025-05-09 13:22 ` Willem de Bruijn
  2025-05-09 23:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Xing @ 2025-05-08  3:44 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, horms, sgoutham, andrew+netdev,
	willemb
  Cc: linux-arm-kernel, netdev, Jason Xing

From: Jason Xing <kernelxing@tencent.com>

skb_tx_timestamp() is used for tx software timestamp enabled by
SOF_TIMESTAMPING_TX_SOFTWARE while SKBTX_HW_TSTAMP is used for
SOF_TIMESTAMPING_TX_HARDWARE. As it clearly shows they are different
timestamps in two dimensions, it's not appropriate to group these two
together in the if-statement.

This patch completes three things:
1. make the software one standalone. Users are able to set both
timestamps together with SOF_TIMESTAMPING_OPT_TX_SWHW flag.
2. make the software one generated after the hardware timestamp logic to
avoid generating sw and hw timestamps at one time without
SOF_TIMESTAMPING_OPT_TX_SWHW being set.
3. move the software timestamp call as close to the door bell.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
v2
Link: https://lore.kernel.org/all/20250507030804.70273-1-kerneljasonxing@gmail.com/
The main logic of this patch came out of previous discussion with
Willem, just as the content of this patch says.
---
 drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 06397cc8bb36..5211759bfe47 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -1389,11 +1389,9 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry,
 		this_cpu_inc(nic->pnicvf->drv_stats->tx_tso);
 	}
 
-	/* Check if timestamp is requested */
-	if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
-		skb_tx_timestamp(skb);
+	/* Check if hw timestamp is requested */
+	if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
 		return;
-	}
 
 	/* Tx timestamping not supported along with TSO, so ignore request */
 	if (skb_shinfo(skb)->gso_size)
@@ -1472,6 +1470,8 @@ static inline void nicvf_sq_doorbell(struct nicvf *nic, struct sk_buff *skb,
 
 	netdev_tx_sent_queue(txq, skb->len);
 
+	skb_tx_timestamp(skb);
+
 	/* make sure all memory stores are done before ringing doorbell */
 	smp_wmb();
 
-- 
2.43.5



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

* Re: [PATCH net-next v2] net: thunder: make tx software timestamp independent
  2025-05-08  3:44 [PATCH net-next v2] net: thunder: make tx software timestamp independent Jason Xing
@ 2025-05-09 13:22 ` Willem de Bruijn
  2025-05-09 23:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2025-05-09 13:22 UTC (permalink / raw)
  To: Jason Xing, davem, edumazet, kuba, pabeni, horms, sgoutham,
	andrew+netdev, willemb
  Cc: linux-arm-kernel, netdev, Jason Xing

Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
> 
> skb_tx_timestamp() is used for tx software timestamp enabled by
> SOF_TIMESTAMPING_TX_SOFTWARE while SKBTX_HW_TSTAMP is used for
> SOF_TIMESTAMPING_TX_HARDWARE. As it clearly shows they are different
> timestamps in two dimensions, it's not appropriate to group these two
> together in the if-statement.
> 
> This patch completes three things:
> 1. make the software one standalone. Users are able to set both
> timestamps together with SOF_TIMESTAMPING_OPT_TX_SWHW flag.
> 2. make the software one generated after the hardware timestamp logic to
> avoid generating sw and hw timestamps at one time without
> SOF_TIMESTAMPING_OPT_TX_SWHW being set.
> 3. move the software timestamp call as close to the door bell.
> 
> Signed-off-by: Jason Xing <kernelxing@tencent.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>


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

* Re: [PATCH net-next v2] net: thunder: make tx software timestamp independent
  2025-05-08  3:44 [PATCH net-next v2] net: thunder: make tx software timestamp independent Jason Xing
  2025-05-09 13:22 ` Willem de Bruijn
@ 2025-05-09 23:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-09 23:50 UTC (permalink / raw)
  To: Jason Xing
  Cc: davem, edumazet, kuba, pabeni, horms, sgoutham, andrew+netdev,
	willemb, linux-arm-kernel, netdev, kernelxing

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  8 May 2025 11:44:33 +0800 you wrote:
> From: Jason Xing <kernelxing@tencent.com>
> 
> skb_tx_timestamp() is used for tx software timestamp enabled by
> SOF_TIMESTAMPING_TX_SOFTWARE while SKBTX_HW_TSTAMP is used for
> SOF_TIMESTAMPING_TX_HARDWARE. As it clearly shows they are different
> timestamps in two dimensions, it's not appropriate to group these two
> together in the if-statement.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: thunder: make tx software timestamp independent
    https://git.kernel.org/netdev/net-next/c/179542a98730

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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

end of thread, other threads:[~2025-05-09 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-08  3:44 [PATCH net-next v2] net: thunder: make tx software timestamp independent Jason Xing
2025-05-09 13:22 ` Willem de Bruijn
2025-05-09 23:50 ` patchwork-bot+netdevbpf

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