net/mlx5: support software TX timestamp
Subsystems (5)
PATCH 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.
--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 + 2 files changed, 2 insertions(+)
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 +1 -0
@@ -341,6 +341,7 @@ static void mlx5e_tx_skb_update_hwts_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)
Signature · 1 line
2.49.0
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.Signed-off-by Stanislav Fomichev <[email protected]>
Only one nit as below.
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb)
Quoted 22 lines
--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 + 2 files changed, 2 insertions(+)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 +0
-0@@ -341,6 +341,7 @@ static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb)
nit: the function name including 'hwts' doesn't reflect the following software behavior.
Thanks,
Jason
Quoted 11 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1
-1{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) --2.49.0
Quoted 28 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.Signed-off-by Stanislav Fomichev <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 + 2 files changed, 2 insertions(+)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 +0
-0
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb) · line 344
Quoted 4 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1
-0@@ -341,6 +341,7 @@ static void mlx5e_tx_skb_update_hwts_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);
Doesn't this interfere with skb_tstamp_tx call in the completion flow (mlx5e_consume_skb)?
What happens if both flags (SKBTX_SW_TSTAMP / SKBTX_HW_TSTAMP) are set Is it possible?
Quoted 3 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +0
-0}static void mlx5e_tx_check_stop (struct mlx5e_txqsq *sq)
Hi Tariq,
Quoted 27 lines · Tariq Toukan
Quoted 23 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.Signed-off-by Stanislav Fomichev <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 + 2 files changed, 2 insertions(+)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 ;
Quoted 12 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb) · line 344
Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1
-0@@ -341,6 +341,7 @@ static void mlx5e_tx_skb_update_hwts_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);Doesn't this interfere with
skb_tstamp_txcall in the completion flow (mlx5e_consume_skb)?
skb_tstamp_tx() only takes care of hardware timestamp in this case.
Quoted 3 lines
What happens if both flags (
SKBTX_SW_TSTAMP/SKBTX_HW_TSTAMP) are set Is it possible?
If only these two are set, only hardware timestamp will be passed to the userspace because of the SOF_TIMESTAMPING_OPT_TX_SWHW limit in __skb_tstamp_tx().
If users expect to see both timestamps, thenSOF_TIMESTAMPING_OPT_TX_SWHW has to be set.
Thanks,
Jason
Quoted 6 lines
Quoted 4 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +0
-0}static void mlx5e_tx_check_stop (struct mlx5e_txqsq *sq)
Quoted 49 lines · Jason Xing
Hi Tariq,
Quoted 27 lines · Tariq Toukan
Quoted 23 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.Signed-off-by Stanislav Fomichev <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 + 2 files changed, 2 insertions(+)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 ;Quoted 12 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb) · line 344
Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1
-0@@ -341,6 +341,7 @@ static void mlx5e_tx_skb_update_hwts_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);Doesn't this interfere with
skb_tstamp_txcall in the completion flow (mlx5e_consume_skb)?
skb_tstamp_tx()only takes care of hardware timestamp in this case.Quoted 3 lines
What happens if both flags (
SKBTX_SW_TSTAMP/SKBTX_HW_TSTAMP) are set Is it possible?
Quoted 6 lines
If only these two are set, only hardware timestamp will be passed to the userspace because of the
SOF_TIMESTAMPING_OPT_TX_SWHWlimit in__skb_tstamp_tx().If users expect to see both timestamps, then
SOF_TIMESTAMPING_OPT_TX_SWHWhas to be set.
Right, skb_tx_timestamp does nothing and bails out if it detects SKBTX_IN_PROGRESS. And skb_tstamp_tx in mlx5e_consume_skb handles only (and will trigger only for) HW tstamp case.
Quoted 54 lines · Stanislav Fomichev
Quoted 53 lines · Jason Xing
Hi Tariq,
Quoted 27 lines · Tariq Toukan
Quoted 23 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.Signed-off-by Stanislav Fomichev <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 + 2 files changed, 2 insertions(+)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 ;Quoted 12 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb) · line 344
Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1
-0@@ -341,6 +341,7 @@ static void mlx5e_tx_skb_update_hwts_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);Doesn't this interfere with
skb_tstamp_txcall in the completion flow (mlx5e_consume_skb)?
skb_tstamp_tx()only takes care of hardware timestamp in this case.Quoted 3 lines
What happens if both flags (
SKBTX_SW_TSTAMP/SKBTX_HW_TSTAMP) are set Is it possible?If only these two are set, only hardware timestamp will be passed to the userspace because of the
SOF_TIMESTAMPING_OPT_TX_SWHWlimit in__skb_tstamp_tx().
Quoted 6 lines
Quoted 2 lines
If users expect to see both timestamps, then
SOF_TIMESTAMPING_OPT_TX_SWHWhas to be set.Right,
skb_tx_timestampdoes nothing and bails out if it detectsSKBTX_IN_PROGRESS. Andskb_tstamp_txinmlx5e_consume_skbhandles only (and will trigger only for) HW tstamp case.
I see.
Patch LGTM, except for the function name nit, pointed out in an earlier comment. We could remove the "hw" from function name mlx5e_tx_skb_update_hwts_flags.
Quoted 60 lines · Tariq Toukan
Quoted 57 lines · Stanislav Fomichev
Quoted 55 lines · Jason Xing
Hi Tariq,
Quoted 27 lines · Tariq Toukan
Quoted 23 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.Signed-off-by Stanislav Fomichev <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 1 + 2 files changed, 2 insertions(+)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 ;Quoted 12 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c static void mlx5e_tx_skb_update_hwts_flags(struct sk_buff *skb) · line 344
Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1
-0@@ -341,6 +341,7 @@ static void mlx5e_tx_skb_update_hwts_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);Doesn't this interfere with
skb_tstamp_txcall in the completion flow (mlx5e_consume_skb)?
skb_tstamp_tx()only takes care of hardware timestamp in this case.Quoted 3 lines
What happens if both flags (
SKBTX_SW_TSTAMP/SKBTX_HW_TSTAMP) are set Is it possible?If only these two are set, only hardware timestamp will be passed to the userspace because of the
SOF_TIMESTAMPING_OPT_TX_SWHWlimit in__skb_tstamp_tx().If users expect to see both timestamps, then
SOF_TIMESTAMPING_OPT_TX_SWHWhas to be set.
Quoted 8 lines
Quoted 3 lines
Right,
skb_tx_timestampdoes nothing and bails out if it detectsSKBTX_IN_PROGRESS. Andskb_tstamp_txinmlx5e_consume_skbhandles only (and will trigger only for) HW tstamp case.I see.
Patch LGTM, except for the function name nit, pointed out in an earlier comment.
We could remove the "hw" from function namemlx5e_tx_skb_update_hwts_flags.
SG, will repost with a rename!