From owner-svn-src-all@FreeBSD.ORG Sun May 31 23:29:05 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84A7280C; Sun, 31 May 2015 23:29:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 723E8158F; Sun, 31 May 2015 23:29:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4VNT5JX056650; Sun, 31 May 2015 23:29:05 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4VNT5eP056647; Sun, 31 May 2015 23:29:05 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201505312329.t4VNT5eP056647@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 31 May 2015 23:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283855 - stable/10/sys/net80211 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 May 2015 23:29:05 -0000 Author: ae Date: Sun May 31 23:29:04 2015 New Revision: 283855 URL: https://svnweb.freebsd.org/changeset/base/283855 Log: MFC r283313: Properly update TX statistics for wlan(4). ieee80211_pwrsave() can fail due to queue overflow, check its return code and increment oerrors counter when it fails. Also handle more error cases and update oerrors counter when we don't send mbuf due to some errors. Return ENETDOWN when parent interface isn't ready. Update obytes and omcasts counters in corresponding places. PR: 184626 Differential Revision: https://reviews.freebsd.org/D2621 Modified: stable/10/sys/net80211/ieee80211_output.c stable/10/sys/net80211/ieee80211_wds.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net80211/ieee80211_output.c ============================================================================== --- stable/10/sys/net80211/ieee80211_output.c Sun May 31 23:11:25 2015 (r283854) +++ stable/10/sys/net80211/ieee80211_output.c Sun May 31 23:29:04 2015 (r283855) @@ -131,7 +131,7 @@ ieee80211_vap_pkt_send_dest(struct ieee8 { struct ieee80211com *ic = vap->iv_ic; struct ifnet *ifp = vap->iv_ifp; - int error; + int error, len, mcast; if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && (m->m_flags & M_PWR_SAV) == 0) { @@ -141,7 +141,8 @@ ieee80211_vap_pkt_send_dest(struct ieee8 * the frame back when the time is right. * XXX lose WDS vap linkage? */ - (void) ieee80211_pwrsave(ni, m); + if (ieee80211_pwrsave(ni, m) != 0) + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ieee80211_free_node(ni); /* @@ -170,6 +171,8 @@ ieee80211_vap_pkt_send_dest(struct ieee8 * interface it (might have been) received on. */ m->m_pkthdr.rcvif = (void *)ni; + mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1: 0; + len = m->m_pkthdr.len; BPF_MTAP(ifp, m); /* 802.3 tx */ @@ -235,7 +238,7 @@ ieee80211_vap_pkt_send_dest(struct ieee8 /* NB: stat+msg handled in ieee80211_encap */ IEEE80211_TX_UNLOCK(ic); ieee80211_free_node(ni); - /* XXX better status? */ + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } } @@ -249,8 +252,11 @@ ieee80211_vap_pkt_send_dest(struct ieee8 if (error != 0) { /* NB: IFQ_HANDOFF reclaims mbuf */ ieee80211_free_node(ni); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } else { ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast); + if_inc_counter(ifp, IFCOUNTER_OBYTES, len); } ic->ic_lastdata = ticks; @@ -314,6 +320,7 @@ ieee80211_start_pkt(struct ieee80211vap eh->ether_dhost, "mcast", "%s", "on DWDS"); vap->iv_stats.is_dwds_mcast++; m_freem(m); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* XXX better status? */ return (ENOBUFS); } @@ -415,9 +422,9 @@ ieee80211_vap_transmit(struct ifnet *ifp IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, "%s: ignore queue, parent %s not up+running\n", __func__, parent->if_xname); - /* XXX stat */ m_freem(m); - return (EINVAL); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + return (ENETDOWN); } if (vap->iv_state == IEEE80211_S_SLEEP) { /* @@ -444,7 +451,8 @@ ieee80211_vap_transmit(struct ifnet *ifp IEEE80211_UNLOCK(ic); ifp->if_drv_flags |= IFF_DRV_OACTIVE; m_freem(m); - return (EINVAL); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + return (ENETDOWN); } IEEE80211_UNLOCK(ic); } Modified: stable/10/sys/net80211/ieee80211_wds.c ============================================================================== --- stable/10/sys/net80211/ieee80211_wds.c Sun May 31 23:11:25 2015 (r283854) +++ stable/10/sys/net80211/ieee80211_wds.c Sun May 31 23:29:04 2015 (r283855) @@ -300,8 +300,12 @@ ieee80211_dwds_mcast(struct ieee80211vap /* NB: IFQ_HANDOFF reclaims mbuf */ ifp->if_oerrors++; ieee80211_free_node(ni); - } else + } else { ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); + if_inc_counter(ifp, IFCOUNTER_OBYTES, + m->m_pkthdr.len); + } } }