svn commit: r341980 - stable/12/sys/dev/mlx5/mlx5_en

Hans Petter Selasky hselasky at FreeBSD.org
Wed Dec 12 13:12:11 UTC 2018


Author: hselasky
Date: Wed Dec 12 13:12:10 2018
New Revision: 341980
URL: https://svnweb.freebsd.org/changeset/base/341980

Log:
  MFC r341584:
  mlx5en: Count all transmitted and received bytes.
  
  Add counter for all transmitted and received bytes. Currently only all
  transmitted and received packets were counted. Fix description of RX LRO
  counters while at it.
  
  Sponsored by:   Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/en.h
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_en/en.h	Wed Dec 12 13:11:08 2018	(r341979)
+++ stable/12/sys/dev/mlx5/mlx5_en/en.h	Wed Dec 12 13:12:10 2018	(r341980)
@@ -379,9 +379,10 @@ struct mlx5e_port_stats_debug {
 
 #define	MLX5E_RQ_STATS(m)					\
   m(+1, u64 packets, "packets", "Received packets")		\
+  m(+1, u64 bytes, "bytes", "Received bytes")			\
   m(+1, u64 csum_none, "csum_none", "Received packets")		\
-  m(+1, u64 lro_packets, "lro_packets", "Received packets")	\
-  m(+1, u64 lro_bytes, "lro_bytes", "Received packets")		\
+  m(+1, u64 lro_packets, "lro_packets", "Received LRO packets")	\
+  m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes")	\
   m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO")	\
   m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO")	\
   m(+1, u64 wqe_err, "wqe_err", "Received packets")
@@ -396,6 +397,7 @@ struct mlx5e_rq_stats {
 
 #define	MLX5E_SQ_STATS(m)						\
   m(+1, u64 packets, "packets", "Transmitted packets")			\
+  m(+1, u64 bytes, "bytes", "Transmitted bytes")			\
   m(+1, u64 tso_packets, "tso_packets", "Transmitted packets")		\
   m(+1, u64 tso_bytes, "tso_bytes", "Transmitted bytes")		\
   m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets")	\

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed Dec 12 13:11:08 2018	(r341979)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed Dec 12 13:12:10 2018	(r341980)
@@ -482,6 +482,7 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget)
 		}
 
 		mlx5e_build_rx_mbuf(cqe, rq, mb, byte_cnt);
+		rq->stats.bytes += byte_cnt;
 		rq->stats.packets++;
 
 #if !defined(HAVE_TCP_LRO_RX)

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Wed Dec 12 13:11:08 2018	(r341979)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Wed Dec 12 13:12:10 2018	(r341980)
@@ -472,7 +472,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
 	sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
 	sq->pc += sq->mbuf[pi].num_wqebbs;
 
+	/* Count all traffic going out */
 	sq->stats.packets++;
+	sq->stats.bytes += sq->mbuf[pi].num_bytes;
+
 	*mbp = NULL;	/* safety clear */
 	return (0);
 


More information about the svn-src-all mailing list