misc drivers' sw timestamp changes
Subsystems (7)
v2 cover misc drivers' sw timestamp changes
From: Jason Xing <[email protected]>
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/[email protected]/
V2
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(-)
Signature · 1 line
2.43.5
PATCH v2 1/3 net: atlantic: generate software timestamp just before the doorbell
From: Jason Xing <[email protected]>
Make sure the call of skb_tx_timestamp is as close as possible to the doorbell.
--- 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(-)
drivers/net/ethernet/aquantia/atlantic/aq_main.c +0 -1
@@ -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); }
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +2 -0
@@ -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);
Signature · 1 line
2.43.5
PATCH v2 2/3 net: cxgb4: generate software timestamp just before the doorbell
In reply to Jason XingFrom: Jason Xing <[email protected]>
Make sure the call of skb_tx_timestamp is as close as possible to the doorbell.
--- 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(-)
drivers/net/ethernet/chelsio/cxgb4/sge.c +3 -2
@@ -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);
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +1 -1
@@ -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;
Signature · 1 line
2.43.5
PATCH v2 3/3 net: stmmac: generate software timestamp just before the doorbell
In reply to Jason XingFrom: Jason Xing <[email protected]>
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()).
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -5
@@ -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);
Signature · 1 line
2.43.5
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Sat, 10 May 2025 21:48:09 +0800 you wrote:
From: Jason Xing <[email protected]>
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html