Skip to content

Commit cd42901

Browse files
Binary-Eaterkuba-moo
authored andcommitted
net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer
Count number of transmitted packets that were hardware timestamped at the device DMA layer. Signed-off-by: Rahul Rameshbabu <[email protected]> Reviewed-by: Dragos Tatulea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent adda540 commit cd42901

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ the software port.
300300
in the beginning of the queue. This is a normal condition.
301301
- Informative
302302

303+
* - `tx[i]_timestamps`
304+
- Transmitted packets that were hardware timestamped at the device's DMA
305+
layer.
306+
- Informative
307+
303308
* - `tx[i]_added_vlan_packets`
304309
- The number of packets sent where vlan tag insertion was offloaded to the
305310
hardware.

drivers/net/ethernet/mellanox/mlx5/core/en_stats.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,7 @@ static const struct counter_desc sq_stats_desc[] = {
20662066
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
20672067
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },
20682068
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
2069+
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, timestamps) },
20692070
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) },
20702071
{ MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) },
20712072
#ifdef CONFIG_MLX5_EN_TLS
@@ -2218,6 +2219,7 @@ static const struct counter_desc qos_sq_stats_desc[] = {
22182219
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
22192220
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },
22202221
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, nop) },
2222+
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, timestamps) },
22212223
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) },
22222224
{ MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) },
22232225
#ifdef CONFIG_MLX5_EN_TLS

drivers/net/ethernet/mellanox/mlx5/core/en_stats.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ struct mlx5e_sq_stats {
431431
u64 stopped;
432432
u64 dropped;
433433
u64 recover;
434+
u64 timestamps;
434435
/* dirtied @completion */
435436
u64 cqes ____cacheline_aligned_in_smp;
436437
u64 wake;

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,13 @@ static void mlx5e_consume_skb(struct mlx5e_txqsq *sq, struct sk_buff *skb,
750750
u64 ts = get_cqe_ts(cqe);
751751

752752
hwts.hwtstamp = mlx5e_cqe_ts_to_ns(sq->ptp_cyc2time, sq->clock, ts);
753-
if (sq->ptpsq)
753+
if (sq->ptpsq) {
754754
mlx5e_skb_cb_hwtstamp_handler(skb, MLX5E_SKB_CB_CQE_HWTSTAMP,
755755
hwts.hwtstamp, sq->ptpsq->cq_stats);
756-
else
756+
} else {
757757
skb_tstamp_tx(skb, &hwts);
758+
sq->stats->timestamps++;
759+
}
758760
}
759761

760762
napi_consume_skb(skb, napi_budget);

0 commit comments

Comments
 (0)