History

net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer

Count number of transmitted packets that were hardware timestamped at the device DMA layer.

Rahul Rameshbabu committed 2 years ago

Commit cd429011 parent adda5404 files · +12 −2Browse files

Unified · Split

4 files
  1. Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst +5 −0
  2. drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +2 −0
  3. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +1 −0
  4. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +4 −2
Documentation/networking/device_drivers/ethernet/mellanox/mlx5/counters.rst+5−0
@@ -300,6 +300,11 @@ the software port. · 299 unmodified lines
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+2−0
@@ -2066,6 +2066,7 @@ static const struct counter_desc sq_stats_desc[] = { · 2065 unmodified lines
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[] = { · 146 unmodified lines
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+1−0
@@ -431,6 +431,7 @@ struct mlx5e_sq_stats { · 430 unmodified lines
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+4−2
@@ -750,11 +750,13 @@ static void mlx5e_consume_skb(struct mlx5e_txqsq *sq, struct sk_buff *skb, · 749 unmodified lines
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);