net/mlx5: support software TX timestamp
Subsystems (5)
PATCH v2 1/1 net/mlx5: support software TX timestamp
Having a software timestamp (along with existing hardware one) is useful to trace how the packets flow through the stack. mlx5e_tx_skb_update_hwts_flags is called from tx paths to setup HW timestamp; extend it to add software one as well.
---
v2: rename mlx5e_tx_skb_update_hwts_flags (Tariq & Jason)
--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -0
@@ -1689,6 +1689,7 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,return 0 ; info->so_timestamping =SOF_TIMESTAMPING_TX_HARDWARE | +SOF_TIMESTAMPING_TX_SOFTWARE |SOF_TIMESTAMPING_RX_HARDWARE |SOF_TIMESTAMPING_RAW_HARDWARE ;
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +4 -3
@@ -337,10 +337,11 @@ static void mlx5e_sq_calc_wqe_attr(struct sk_buff *skb, const struct mlx5e_tx_at }; } -static void mlx5e_tx_skb_update_hwts_flags (struct sk_buff *skb) +static void mlx5e_tx_skb_update_ts_flags (struct sk_buff *skb) {if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ))skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; +skb_tx_timestamp (skb); }static void mlx5e_tx_check_stop (struct mlx5e_txqsq *sq)
@@ -392,7 +393,7 @@ mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb, cseg->opmod_idx_opcode =cpu_to_be32 ((sq->pc <<8 ) | attr->opcode); cseg->qpn_ds =cpu_to_be32 ((sq->sqn <<8 ) | wqe_attr->ds_cnt); -mlx5e_tx_skb_update_hwts_flags (skb); +mlx5e_tx_skb_update_ts_flags (skb); sq->pc += wi->num_wqebbs;
@@ -625,7 +626,7 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,mlx5e_dma_push (sq, txd.dma_addr, txd.len,MLX5E_DMA_MAP_SINGLE );mlx5e_skb_fifo_push (&sq->db.skb_fifo, skb);mlx5e_tx_mpwqe_add_dseg (sq, &txd); -mlx5e_tx_skb_update_hwts_flags (skb); +mlx5e_tx_skb_update_ts_flags (skb);if (unlikely (mlx5e_tx_mpwqe_is_full (&sq->mpwqe))) {/* Might stop the queue and affect the retval of __netdev_tx_sent_queue. */
Signature · 1 line
2.49.0
Quoted 8 lines · Stanislav Fomichev
Having a software timestamp (along with existing hardware one) is useful to trace how the packets flow through the stack.
mlx5e_tx_skb_update_hwts_flagsis called from tx paths to setup HW timestamp; extend it to add software one as well.Reviewed-by Jason Xing <[email protected]>Signed-off-by Stanislav Fomichev <[email protected]>
Thanks for working on this.
An a bit irrelevant topic here is it seems we miss adding SOF_TIMESTAMPING_TX_SOFTWARE in mlx4_en_get_ts_info() since mlx4 has used skb_tx_timestamp function in mlx4_en_xmit(). IIUC, I'm going to send a patch to add this flag.
Thanks,
Jason
Quoted 57 lines
---
v2: renamemlx5e_tx_skb_update_hwts_flags(Tariq & Jason)--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1
-0@@ -1689,6 +1689,7 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,return 0 ; info->so_timestamping =SOF_TIMESTAMPING_TX_HARDWARE | +SOF_TIMESTAMPING_TX_SOFTWARE |SOF_TIMESTAMPING_RX_HARDWARE |SOF_TIMESTAMPING_RAW_HARDWARE ;drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +4
-4@@ -337,10 +337,11 @@ static void mlx5e_sq_calc_wqe_attr(struct sk_buff *skb, const struct mlx5e_tx_at }; } -static void mlx5e_tx_skb_update_hwts_flags (struct sk_buff *skb) +static void mlx5e_tx_skb_update_ts_flags (struct sk_buff *skb) {if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ))skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; +skb_tx_timestamp (skb); }static void mlx5e_tx_check_stop (struct mlx5e_txqsq *sq)@@ -392,7 +393,7 @@ mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb, cseg->opmod_idx_opcode =cpu_to_be32 ((sq->pc <<8 ) | attr->opcode); cseg->qpn_ds =cpu_to_be32 ((sq->sqn <<8 ) | wqe_attr->ds_cnt); -mlx5e_tx_skb_update_hwts_flags (skb); +mlx5e_tx_skb_update_ts_flags (skb); sq->pc += wi->num_wqebbs;@@ -625,7 +626,7 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,mlx5e_dma_push (sq, txd.dma_addr, txd.len,MLX5E_DMA_MAP_SINGLE );mlx5e_skb_fifo_push (&sq->db.skb_fifo, skb);mlx5e_tx_mpwqe_add_dseg (sq, &txd); -mlx5e_tx_skb_update_hwts_flags (skb); +mlx5e_tx_skb_update_ts_flags (skb);if (unlikely (mlx5e_tx_mpwqe_is_full (&sq->mpwqe))) {/* Might stop the queue and affect the retval of __netdev_tx_sent_queue. */ --2.49.0
Quoted 10 lines · Stanislav Fomichev
Having a software timestamp (along with existing hardware one) is useful to trace how the packets flow through the stack.
mlx5e_tx_skb_update_hwts_flagsis called from tx paths to setup HW timestamp; extend it to add software one as well.Reviewed-by Jason Xing <[email protected]>Signed-off-by Stanislav Fomichev <[email protected]>---
v2: renamemlx5e_tx_skb_update_hwts_flags(Tariq & Jason)
---
LGMT,
Quoted 7 lines · Stanislav Fomichev
Having a software timestamp (along with existing hardware one) is useful to trace how the packets flow through the stack.
mlx5e_tx_skb_update_hwts_flagsis called from tx paths to setup HW timestamp; extend it to add software one as well.Reviewed-by Jason Xing <[email protected]>Signed-off-by Stanislav Fomichev <[email protected]>
Quoted 53 lines · Stanislav Fomichev
Having a software timestamp (along with existing hardware one) is useful to trace how the packets flow through the stack.
mlx5e_tx_skb_update_hwts_flagsis called from tx paths to setup HW timestamp; extend it to add software one as well.Reviewed-by Jason Xing <[email protected]>Signed-off-by Stanislav Fomichev <[email protected]>---
v2: renamemlx5e_tx_skb_update_hwts_flags(Tariq & Jason)--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1
-0@@ -1689,6 +1689,7 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,return 0 ; info->so_timestamping =SOF_TIMESTAMPING_TX_HARDWARE | +SOF_TIMESTAMPING_TX_SOFTWARE |SOF_TIMESTAMPING_RX_HARDWARE |SOF_TIMESTAMPING_RAW_HARDWARE ;drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +3
-2@@ -337,10 +337,11 @@ static void mlx5e_sq_calc_wqe_attr(struct sk_buff *skb, const struct mlx5e_tx_at }; } -static void mlx5e_tx_skb_update_hwts_flags (struct sk_buff *skb) +static void mlx5e_tx_skb_update_ts_flags (struct sk_buff *skb) {if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ))skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; +skb_tx_timestamp (skb); }static void mlx5e_tx_check_stop (struct mlx5e_txqsq *sq)@@ -392,7 +393,7 @@ mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb, cseg->opmod_idx_opcode =cpu_to_be32 ((sq->pc <<8 ) | attr->opcode); cseg->qpn_ds =cpu_to_be32 ((sq->sqn <<8 ) | wqe_attr->ds_cnt); -mlx5e_tx_skb_update_hwts_flags (skb); +mlx5e_tx_skb_update_ts_flags (skb); sq->pc += wi->num_wqebbs;
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb, · line 632
Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1
-1@@ -625,7 +626,7 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,mlx5e_dma_push (sq, txd.dma_addr, txd.len,MLX5E_DMA_MAP_SINGLE );mlx5e_skb_fifo_push (&sq->db.skb_fifo, skb);mlx5e_tx_mpwqe_add_dseg (sq, &txd); -mlx5e_tx_skb_update_hwts_flags (skb); +mlx5e_tx_skb_update_ts_flags (skb);if (unlikely (mlx5e_tx_mpwqe_is_full (&sq->mpwqe))) {/* Might stop the queue and affect the retval of __netdev_tx_sent_queue. */
Thanks for your patch.
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 16:51:09 -0700 you wrote:
Having a software timestamp (along with existing hardware one) is useful to trace how the packets flow through the stack.
mlx5e_tx_skb_update_hwts_flagsis called from tx paths to setup HW timestamp; extend it to add software one as well.Reviewed-by Jason Xing <[email protected]>Signed-off-by Stanislav Fomichev <[email protected]>[...]
Here is the summary with links:
- [net-next,v2] net/mlx5: support software TX timestamp
https://git.kernel.org/netdev/net-next/c/2451d3fb388f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html