From owner-svn-src-head@freebsd.org Thu Nov 19 10:23:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA913A337A8; Thu, 19 Nov 2015 10:23:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9D381783; Thu, 19 Nov 2015 10:23:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAJANAht099233; Thu, 19 Nov 2015 10:23:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAJANA9D099231; Thu, 19 Nov 2015 10:23:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511191023.tAJANA9D099231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 19 Nov 2015 10:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291069 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2015 10:23:12 -0000 Author: hselasky Date: Thu Nov 19 10:23:10 2015 New Revision: 291069 URL: https://svnweb.freebsd.org/changeset/base/291069 Log: Accumulate out of RX buffers into a 64-bit value and subtract out of RX buffers from number of received packets. Differential Revision: https://reviews.freebsd.org/D4178 Submitted by: Drew Gallatin Sponsored by: Mellanox Technologies MFC after: 3 days Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Thu Nov 19 10:18:13 2015 (r291068) +++ head/sys/dev/mlx5/mlx5_en/en.h Thu Nov 19 10:23:10 2015 (r291069) @@ -141,6 +141,7 @@ typedef void (mlx5e_cq_comp_t)(struct ml m(+1, u64 rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast bytes") \ m(+1, u64 tx_broadcast_packets, "tx_broadcast_packets", "Transmitted broadcast packets") \ m(+1, u64 tx_broadcast_bytes, "tx_broadcast_bytes", "Transmitted broadcast bytes") \ + m(+1, u64 rx_out_of_buffer, "rx_out_of_buffer", "Receive out of buffer, no recv wqes events") \ /* SW counters */ \ m(+1, u64 tso_packets, "tso_packets", "Transmitted TSO packets") \ m(+1, u64 tso_bytes, "tso_bytes", "Transmitted TSO bytes") \ @@ -161,6 +162,7 @@ struct mlx5e_vport_stats { struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_VPORT_STATS(MLX5E_STATS_VAR) + u32 rx_out_of_buffer_prev; }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ @@ -265,17 +267,13 @@ struct mlx5e_vport_stats { m(+1, u64 rs_corrected_symbols_lane3, "rs_corrected_symbols_lane3", \ "FEC corrected symbol counter lane 3") \ -#define MLX5E_PPORT_Q_CONTERS(m) \ - m(+1, u64 out_of_rx_buffer, "out_of_rx_buffer", "out of rx buffers aka no recv wqes events") - /* * Make sure to update mlx5e_update_pport_counters() * when adding a new MLX5E_PPORT_STATS block */ #define MLX5E_PPORT_STATS(m) \ MLX5E_PPORT_IEEE802_3_STATS(m) \ - MLX5E_PPORT_RFC2819_STATS(m) \ - MLX5E_PPORT_Q_CONTERS(m) + MLX5E_PPORT_RFC2819_STATS(m) #define MLX5E_PORT_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 19 10:18:13 2015 (r291068) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 19 10:23:10 2015 (r291069) @@ -378,7 +378,7 @@ mlx5e_update_stats_work(struct work_stru u64 sw_lro_flushed = 0; u64 rx_csum_none = 0; u64 rx_wqe_err = 0; - u32 out_of_rx_buffer = 0; + u32 rx_out_of_buffer = 0; int i; int j; @@ -440,6 +440,16 @@ mlx5e_update_stats_work(struct work_stru memset(out, 0, outlen); + /* get number of out-of-buffer drops first */ + if (mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, + &rx_out_of_buffer)) + goto free_out; + + /* accumulate difference into a 64-bit counter */ + s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - s->rx_out_of_buffer_prev); + s->rx_out_of_buffer_prev = rx_out_of_buffer; + + /* get port statistics */ if (mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen)) goto free_out; @@ -485,7 +495,8 @@ mlx5e_update_stats_work(struct work_stru s->rx_packets = s->rx_unicast_packets + s->rx_multicast_packets + - s->rx_broadcast_packets; + s->rx_broadcast_packets - + s->rx_out_of_buffer; s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + @@ -503,10 +514,14 @@ mlx5e_update_stats_work(struct work_stru s->tx_csum_offload = s->tx_packets - tx_offload_none; s->rx_csum_good = s->rx_packets - s->rx_csum_none; + /* Update per port counters */ + mlx5e_update_pport_counters(priv); + #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ ifp->if_ipackets = s->rx_packets; ifp->if_ierrors = s->rx_error_packets; + ifp->if_iqdrops = s->rx_out_of_buffer; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; @@ -514,12 +529,6 @@ mlx5e_update_stats_work(struct work_stru ifp->if_obytes = s->tx_bytes; #endif - mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, - &out_of_rx_buffer); - - /* Update per port counters */ - mlx5e_update_pport_counters(priv); - priv->stats.pport.out_of_rx_buffer = (u64)out_of_rx_buffer; free_out: kvfree(out); PRIV_UNLOCK(priv); @@ -2178,6 +2187,9 @@ mlx5e_get_counter(struct ifnet *ifp, ift case IFCOUNTER_IERRORS: retval = priv->stats.vport.rx_error_packets; break; + case IFCOUNTER_IQDROPS: + retval = priv->stats.vport.rx_out_of_buffer; + break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; break;