net: thunder: make tx software timestamp independent
Subsystems (3)
PATCH v2 1/1 net: thunder: make tx software timestamp independent
From: Jason Xing <[email protected]>
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.
---
v2
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(-)
drivers/net/ethernet/cavium/thunder/nicvf_queues.c +4 -4
@@ -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 ();
Signature · 1 line
2.43.5
Quoted 16 lines · Jason Xing
From: Jason Xing <[email protected]>
skb_tx_timestamp()is used for tx software timestamp enabled bySOF_TIMESTAMPING_TX_SOFTWAREwhileSKBTX_HW_TSTAMPis used forSOF_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 withSOF_TIMESTAMPING_OPT_TX_SWHWflag.
2. make the software one generated after the hardware timestamp logic to avoid generating sw and hw timestamps at one time withoutSOF_TIMESTAMPING_OPT_TX_SWHWbeing set.
3. move the software timestamp call as close to the door bell.
Quoted 1 line
Signed-off-by Jason Xing <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 8 May 2025 11:44:33 +0800 you wrote:
From: Jason Xing <[email protected]>
skb_tx_timestamp()is used for tx software timestamp enabled bySOF_TIMESTAMPING_TX_SOFTWAREwhileSKBTX_HW_TSTAMPis used forSOF_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html