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
300 in the beginning of the queue. This is a normal condition.300 in the beginning of the queue. This is a normal condition.
301 - Informative301 - Informative
302 302
303 * - `tx[i]_timestamps`
304 - Transmitted packets that were hardware timestamped at the device's DMA
305 layer.
306 - Informative
307
303 * - `tx[i]_added_vlan_packets`308 * - `tx[i]_added_vlan_packets`
304 - The number of packets sent where vlan tag insertion was offloaded to the309 - The number of packets sent where vlan tag insertion was offloaded to the
305 hardware.310 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
2066 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },2066 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
2067 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },2067 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },
2068 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },2068 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
2069 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, timestamps) },
2069 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) },2070 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) },
2070 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) },2071 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) },
2071#ifdef CONFIG_MLX5_EN_TLS2072#ifdef CONFIG_MLX5_EN_TLS
@@ -2218,6 +2219,7 @@ static const struct counter_desc qos_sq_stats_desc[] = { · 146 unmodified lines
2218 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },2219 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
2219 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },2220 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },
2220 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, nop) },2221 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, nop) },
2222 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, timestamps) },
2221 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) },2223 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_blks) },
2222 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) },2224 { MLX5E_DECLARE_QOS_TX_STAT(struct mlx5e_sq_stats, mpwqe_pkts) },
2223#ifdef CONFIG_MLX5_EN_TLS2225#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
431 u64 stopped;431 u64 stopped;
432 u64 dropped;432 u64 dropped;
433 u64 recover;433 u64 recover;
434 u64 timestamps;
434 /* dirtied @completion */435 /* dirtied @completion */
435 u64 cqes ____cacheline_aligned_in_smp;436 u64 cqes ____cacheline_aligned_in_smp;
436 u64 wake;437 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
750 u64 ts = get_cqe_ts(cqe);750 u64 ts = get_cqe_ts(cqe);
751 751
752 hwts.hwtstamp = mlx5e_cqe_ts_to_ns(sq->ptp_cyc2time, sq->clock, ts);752 hwts.hwtstamp = mlx5e_cqe_ts_to_ns(sq->ptp_cyc2time, sq->clock, ts);
753 if (sq->ptpsq)753 if (sq->ptpsq) {
754 mlx5e_skb_cb_hwtstamp_handler(skb, MLX5E_SKB_CB_CQE_HWTSTAMP,754 mlx5e_skb_cb_hwtstamp_handler(skb, MLX5E_SKB_CB_CQE_HWTSTAMP,
755 hwts.hwtstamp, sq->ptpsq->cq_stats);755 hwts.hwtstamp, sq->ptpsq->cq_stats);
756 else756 } else {
757 skb_tstamp_tx(skb, &hwts);757 skb_tstamp_tx(skb, &hwts);
758 sq->stats->timestamps++;
759 }
758 }760 }
759 761
760 napi_consume_skb(skb, napi_budget);762 napi_consume_skb(skb, napi_budget);