Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Dec 2018 13:12:30 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r341981 - stable/11/sys/dev/mlx5/mlx5_en
Message-ID:  <201812121312.wBCDCUTv010275@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Dec 12 13:12:30 2018
New Revision: 341981
URL: https://svnweb.freebsd.org/changeset/base/341981

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/11/sys/dev/mlx5/mlx5_en/en.h
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/en.h	Wed Dec 12 13:12:10 2018	(r341980)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h	Wed Dec 12 13:12:30 2018	(r341981)
@@ -378,9 +378,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")
@@ -395,6 +396,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/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed Dec 12 13:12:10 2018	(r341980)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed Dec 12 13:12:30 2018	(r341981)
@@ -437,6 +437,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/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Wed Dec 12 13:12:10 2018	(r341980)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Wed Dec 12 13:12:30 2018	(r341981)
@@ -453,7 +453,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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812121312.wBCDCUTv010275>