From owner-svn-src-stable@freebsd.org Thu Mar 16 09:40:55 2017 Return-Path: Delivered-To: svn-src-stable@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 753E6D0D483; Thu, 16 Mar 2017 09:40:55 +0000 (UTC) (envelope-from royger@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 360DE1337; Thu, 16 Mar 2017 09:40:55 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2G9esms058171; Thu, 16 Mar 2017 09:40:54 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2G9esfe058170; Thu, 16 Mar 2017 09:40:54 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201703160940.v2G9esfe058170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 16 Mar 2017 09:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315403 - stable/11/sys/dev/xen/netfront X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Mar 2017 09:40:55 -0000 Author: royger Date: Thu Mar 16 09:40:54 2017 New Revision: 315403 URL: https://svnweb.freebsd.org/changeset/base/315403 Log: MFC r308126: xen/netfront: fix statistics PR: 213439 Modified: stable/11/sys/dev/xen/netfront/netfront.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/11/sys/dev/xen/netfront/netfront.c Thu Mar 16 09:33:36 2017 (r315402) +++ stable/11/sys/dev/xen/netfront/netfront.c Thu Mar 16 09:40:54 2017 (r315403) @@ -156,21 +156,6 @@ static int xn_get_responses(struct netfr #define virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT) #define INVALID_P2M_ENTRY (~0UL) - -struct xn_rx_stats -{ - u_long rx_packets; /* total packets received */ - u_long rx_bytes; /* total bytes received */ - u_long rx_errors; /* bad packets received */ -}; - -struct xn_tx_stats -{ - u_long tx_packets; /* total packets transmitted */ - u_long tx_bytes; /* total bytes transmitted */ - u_long tx_errors; /* packet transmit problems */ -}; - #define XN_QUEUE_NAME_LEN 8 /* xn{t,r}x_%u, allow for two digits */ struct netfront_rxq { struct netfront_info *info; @@ -190,8 +175,6 @@ struct netfront_rxq { struct lro_ctrl lro; struct callout rx_refill; - - struct xn_rx_stats stats; }; struct netfront_txq { @@ -215,8 +198,6 @@ struct netfront_txq { struct task defrtask; bool full; - - struct xn_tx_stats stats; }; struct netfront_info { @@ -1191,7 +1172,7 @@ xn_rxeof(struct netfront_rxq *rxq) if (__predict_false(err)) { if (m) (void )mbufq_enqueue(&mbufq_errq, m); - rxq->stats.rx_errors++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); continue; } @@ -1216,9 +1197,6 @@ xn_rxeof(struct netfront_rxq *rxq) m->m_pkthdr.csum_flags |= CSUM_TSO; } - rxq->stats.rx_packets++; - rxq->stats.rx_bytes += m->m_pkthdr.len; - (void )mbufq_enqueue(&mbufq_rxq, m); rxq->ring.rsp_cons = i; } @@ -1304,12 +1282,6 @@ xn_txeof(struct netfront_txq *txq) "trying to free it again!")); M_ASSERTVALID(m); - /* - * Increment packet count if this is the last - * mbuf of the chain. - */ - if (!m->m_next) - if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (__predict_false(gnttab_query_foreign_access( txq->grant_ref[id]) != 0)) { panic("%s: grant id %u still in use by the " @@ -1701,10 +1673,12 @@ xn_assemble_tx_request(struct netfront_t } BPF_MTAP(ifp, m_head); - xn_txeof(txq); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(ifp, IFCOUNTER_OBYTES, m_head->m_pkthdr.len); + if (m_head->m_flags & M_MCAST) + if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); - txq->stats.tx_bytes += m_head->m_pkthdr.len; - txq->stats.tx_packets++; + xn_txeof(txq); return (0); }