svn commit: r341584 - head/sys/dev/mlx5/mlx5_en

Slava Shwartsman slavash at FreeBSD.org
Wed Dec 5 14:24:04 UTC 2018


Author: slavash
Date: Wed Dec  5 14:24:02 2018
New Revision: 341584
URL: https://svnweb.freebsd.org/changeset/base/341584

Log:
  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.
  
  Submitted by:   hselasky@
  Approved by:    hselasky (mentor)
  MFC after:      1 week
  Sponsored by:   Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/en.h	Wed Dec  5 14:23:31 2018	(r341583)
+++ head/sys/dev/mlx5/mlx5_en/en.h	Wed Dec  5 14:24:02 2018	(r341584)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed Dec  5 14:23:31 2018	(r341583)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed Dec  5 14:24:02 2018	(r341584)
@@ -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: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Wed Dec  5 14:23:31 2018	(r341583)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Wed Dec  5 14:24:02 2018	(r341584)
@@ -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-head mailing list