* [PATCH net-next v2 0/3] misc drivers' sw timestamp changes
@ 2025-05-10 13:48 Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 1/3] net: atlantic: generate software timestamp just before the doorbell Jason Xing
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jason Xing @ 2025-05-10 13:48 UTC (permalink / raw)
To: tariqt, andrew+netdev, davem, edumazet, kuba, pabeni,
willemdebruijn.kernel, irusskikh, bharat, ayush.sawal,
mcoquelin.stm32, alexandre.torgue
Cc: linux-arm-kernel, netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
This series modified three outstanding drivers among more than 100 drivers
because the software timestamp generation is too early. The idea of this
series is derived from the brief talk[1] with Willem. In conclusion, this
series makes the generation of software timestamp near/before kicking the
doorbell for drivers.
[1]: https://lore.kernel.org/all/681b9d2210879_1f6aad294bc@willemb.c.googlers.com.notmuch/
V2
Link: https://lore.kernel.org/all/20250508033328.12507-1-kerneljasonxing@gmail.com/
1. remove lan966x patch since it breaks PHY timestamping.
2. move skb_tx_timestamp() earlier than before in cxgb4_eth_xmit() to
avoid skb being orphaned/consumed.
3. revise the commit log.
Jason Xing (3):
net: atlantic: generate software timestamp just before the doorbell
net: cxgb4: generate software timestamp just before the doorbell
net: stmmac: generate software timestamp just before the doorbell
drivers/net/ethernet/aquantia/atlantic/aq_main.c | 1 -
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 ++
drivers/net/ethernet/chelsio/cxgb4/sge.c | 5 +++--
.../net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++-----
5 files changed, 8 insertions(+), 9 deletions(-)
--
2.43.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2 1/3] net: atlantic: generate software timestamp just before the doorbell
2025-05-10 13:48 [PATCH net-next v2 0/3] misc drivers' sw timestamp changes Jason Xing
@ 2025-05-10 13:48 ` Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 2/3] net: cxgb4: " Jason Xing
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jason Xing @ 2025-05-10 13:48 UTC (permalink / raw)
To: tariqt, andrew+netdev, davem, edumazet, kuba, pabeni,
willemdebruijn.kernel, irusskikh, bharat, ayush.sawal,
mcoquelin.stm32, alexandre.torgue
Cc: linux-arm-kernel, netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Make sure the call of skb_tx_timestamp is as close as possible to the
doorbell.
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_main.c | 1 -
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
index c1d1673c5749..b565189e5913 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
@@ -123,7 +123,6 @@ static netdev_tx_t aq_ndev_start_xmit(struct sk_buff *skb, struct net_device *nd
}
#endif
- skb_tx_timestamp(skb);
return aq_nic_xmit(aq_nic, skb);
}
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index bf3aa46887a1..e71cd10e4e1f 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -898,6 +898,8 @@ int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)
frags = aq_nic_map_skb(self, skb, ring);
+ skb_tx_timestamp(skb);
+
if (likely(frags)) {
err = self->aq_hw_ops->hw_ring_tx_xmit(self->aq_hw,
ring, frags);
--
2.43.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next v2 2/3] net: cxgb4: generate software timestamp just before the doorbell
2025-05-10 13:48 [PATCH net-next v2 0/3] misc drivers' sw timestamp changes Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 1/3] net: atlantic: generate software timestamp just before the doorbell Jason Xing
@ 2025-05-10 13:48 ` Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 3/3] net: stmmac: " Jason Xing
2025-05-15 2:50 ` [PATCH net-next v2 0/3] misc drivers' sw timestamp changes patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Jason Xing @ 2025-05-10 13:48 UTC (permalink / raw)
To: tariqt, andrew+netdev, davem, edumazet, kuba, pabeni,
willemdebruijn.kernel, irusskikh, bharat, ayush.sawal,
mcoquelin.stm32, alexandre.torgue
Cc: linux-arm-kernel, netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Make sure the call of skb_tx_timestamp is as close as possible to the
doorbell.
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
drivers/net/ethernet/chelsio/cxgb4/sge.c | 5 +++--
.../net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index f991a28a71c3..f2d533acb056 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -1533,7 +1533,6 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
} else {
q = &adap->sge.ethtxq[qidx + pi->first_qset];
}
- skb_tx_timestamp(skb);
reclaim_completed_tx(adap, &q->q, -1, true);
cntrl = TXPKT_L4CSUM_DIS_F | TXPKT_IPCSUM_DIS_F;
@@ -1706,6 +1705,8 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
cpl->len = htons(skb->len);
cpl->ctrl1 = cpu_to_be64(cntrl);
+ skb_tx_timestamp(skb);
+
if (immediate) {
cxgb4_inline_tx_skb(skb, &q->q, sgl);
dev_consume_skb_any(skb);
@@ -2268,7 +2269,6 @@ static int ethofld_hard_xmit(struct net_device *dev,
d = &eosw_txq->desc[eosw_txq->last_pidx];
skb = d->skb;
- skb_tx_timestamp(skb);
wr = (struct fw_eth_tx_eo_wr *)&eohw_txq->q.desc[eohw_txq->q.pidx];
if (unlikely(eosw_txq->state != CXGB4_EO_STATE_ACTIVE &&
@@ -2373,6 +2373,7 @@ static int ethofld_hard_xmit(struct net_device *dev,
eohw_txq->vlan_ins++;
txq_advance(&eohw_txq->q, ndesc);
+ skb_tx_timestamp(skb);
cxgb4_ring_tx_db(adap, &eohw_txq->q, ndesc);
eosw_txq_advance_index(&eosw_txq->last_pidx, 1, eosw_txq->ndesc);
diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
index e8e460a92e0e..4e2096e49684 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
@@ -1640,6 +1640,7 @@ static int chcr_ktls_tunnel_pkt(struct chcr_ktls_info *tx_info,
cxgb4_write_sgl(skb, &q->q, pos, end, 0, sgl_sdesc->addr);
sgl_sdesc->skb = skb;
chcr_txq_advance(&q->q, ndesc);
+ skb_tx_timestamp(skb);
cxgb4_ring_tx_db(tx_info->adap, &q->q, ndesc);
return 0;
}
@@ -1903,7 +1904,6 @@ static int chcr_ktls_sw_fallback(struct sk_buff *skb,
th = tcp_hdr(nskb);
skb_offset = skb_tcp_all_headers(nskb);
data_len = nskb->len - skb_offset;
- skb_tx_timestamp(nskb);
if (chcr_ktls_tunnel_pkt(tx_info, nskb, q))
goto out;
--
2.43.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next v2 3/3] net: stmmac: generate software timestamp just before the doorbell
2025-05-10 13:48 [PATCH net-next v2 0/3] misc drivers' sw timestamp changes Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 1/3] net: atlantic: generate software timestamp just before the doorbell Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 2/3] net: cxgb4: " Jason Xing
@ 2025-05-10 13:48 ` Jason Xing
2025-05-15 2:50 ` [PATCH net-next v2 0/3] misc drivers' sw timestamp changes patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Jason Xing @ 2025-05-10 13:48 UTC (permalink / raw)
To: tariqt, andrew+netdev, davem, edumazet, kuba, pabeni,
willemdebruijn.kernel, irusskikh, bharat, ayush.sawal,
mcoquelin.stm32, alexandre.torgue
Cc: linux-arm-kernel, netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Make sure the call of skb_tx_timestamp is as close as possbile to the
doorbell.
The patch also adjusts the order of setting SKBTX_IN_PROGRESS and
generate software timestamp so that without SOF_TIMESTAMPING_OPT_TX_SWHW
being set the software and hardware timestamps will not appear in the
error queue of socket nearly at the same time (Please see __skb_tstamp_tx()).
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 28b62bd73e23..4446599ba6ee 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4497,8 +4497,6 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
if (priv->sarc_type)
stmmac_set_desc_sarc(priv, first, priv->sarc_type);
- skb_tx_timestamp(skb);
-
if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
priv->hwts_tx_en)) {
/* declare that device is doing timestamping */
@@ -4531,6 +4529,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
}
netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
+ skb_tx_timestamp(skb);
stmmac_flush_tx_descriptors(priv, queue);
stmmac_tx_timer_arm(priv, queue);
@@ -4774,8 +4773,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
if (priv->sarc_type)
stmmac_set_desc_sarc(priv, first, priv->sarc_type);
- skb_tx_timestamp(skb);
-
/* Ready to fill the first descriptor and set the OWN bit w/o any
* problems because all the descriptors are actually ready to be
* passed to the DMA engine.
@@ -4822,7 +4819,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
stmmac_enable_dma_transmission(priv, priv->ioaddr, queue);
-
+ skb_tx_timestamp(skb);
stmmac_flush_tx_descriptors(priv, queue);
stmmac_tx_timer_arm(priv, queue);
--
2.43.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2 0/3] misc drivers' sw timestamp changes
2025-05-10 13:48 [PATCH net-next v2 0/3] misc drivers' sw timestamp changes Jason Xing
` (2 preceding siblings ...)
2025-05-10 13:48 ` [PATCH net-next v2 3/3] net: stmmac: " Jason Xing
@ 2025-05-15 2:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-15 2:50 UTC (permalink / raw)
To: Jason Xing
Cc: tariqt, andrew+netdev, davem, edumazet, kuba, pabeni,
willemdebruijn.kernel, irusskikh, bharat, ayush.sawal,
mcoquelin.stm32, alexandre.torgue, linux-arm-kernel, netdev,
kernelxing
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 10 May 2025 21:48:09 +0800 you wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> This series modified three outstanding drivers among more than 100 drivers
> because the software timestamp generation is too early. The idea of this
> series is derived from the brief talk[1] with Willem. In conclusion, this
> series makes the generation of software timestamp near/before kicking the
> doorbell for drivers.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/3] net: atlantic: generate software timestamp just before the doorbell
https://git.kernel.org/netdev/net-next/c/285ad7477559
- [net-next,v2,2/3] net: cxgb4: generate software timestamp just before the doorbell
https://git.kernel.org/netdev/net-next/c/aaed2789b307
- [net-next,v2,3/3] net: stmmac: generate software timestamp just before the doorbell
https://git.kernel.org/netdev/net-next/c/33d4cc81fcd9
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] 5+ messages in thread
end of thread, other threads:[~2025-05-15 2:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-10 13:48 [PATCH net-next v2 0/3] misc drivers' sw timestamp changes Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 1/3] net: atlantic: generate software timestamp just before the doorbell Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 2/3] net: cxgb4: " Jason Xing
2025-05-10 13:48 ` [PATCH net-next v2 3/3] net: stmmac: " Jason Xing
2025-05-15 2:50 ` [PATCH net-next v2 0/3] misc drivers' sw timestamp changes 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).