From owner-svn-src-head@FreeBSD.ORG Tue May 26 15:25:02 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D09FCDA; Tue, 26 May 2015 15:25:02 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x231.google.com (mail-ig0-x231.google.com [IPv6:2607:f8b0:4001:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA960878; Tue, 26 May 2015 15:25:01 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igbsb11 with SMTP id sb11so56072794igb.0; Tue, 26 May 2015 08:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=d0fYX7ETkgFprYQsDDOjtdUrNxezo9yy7n/Y4Eb/ngQ=; b=zg2G56UCSEsPILD+WRpOHN+EfMr308UjGxCZtkIb4vRe1cNuva46stk1ilArgOxLLP VAwcmO14Qurwl2IkDck34tp8GKKKltUPpqCtZBNsc+pAbIPTA+wOZci4B7HxbuwzA0Th vPBlq4GQwnxTVOVLUkGUVoK/aSQ6VnAws+/v15mi4lBXUrgLuxWkPYnwpPcYK0LEuB7o LuThTsDgZPP1bA7+vHiSEuntmxjxUrDRawajToz7DkF5Sf3uwxLzsxiT4BQm/eX59oQA 1mInxmYvBExAylEnxupTIQi/d7vxiZPCFcepzp494MoYjce0VUd08YUTcPZuXIkd3oAc tz3w== MIME-Version: 1.0 X-Received: by 10.50.97.105 with SMTP id dz9mr30390614igb.49.1432653901171; Tue, 26 May 2015 08:25:01 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.38.133 with HTTP; Tue, 26 May 2015 08:25:01 -0700 (PDT) In-Reply-To: <201505261319.t4QDJ5Hj045298@svn.freebsd.org> References: <201505261319.t4QDJ5Hj045298@svn.freebsd.org> Date: Tue, 26 May 2015 08:25:01 -0700 X-Google-Sender-Auth: zRlxehus0aPBzpMdxN3nLXuhr58 Message-ID: Subject: Re: svn commit: r283568 - head/sys/net80211 From: Adrian Chadd To: Gleb Smirnoff Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 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: Tue, 26 May 2015 15:25:02 -0000 Hi, We're going to have to move all of the counter API stuff into ieee80211_freebsd.[ch]. -adrian On 26 May 2015 at 06:19, Gleb Smirnoff wrote: > Author: glebius > Date: Tue May 26 13:19:05 2015 > New Revision: 283568 > URL: https://svnweb.freebsd.org/changeset/base/283568 > > Log: > Provide ieee80211_get_counter() that sums up ieee802com > errors to the errors of this vap interface. > > Sponsored by: Netflix > Sponsored by: Nginx, Inc. > > Modified: > head/sys/net80211/ieee80211.c > > Modified: head/sys/net80211/ieee80211.c > ============================================================================== > --- head/sys/net80211/ieee80211.c Tue May 26 12:51:14 2015 (r283567) > +++ head/sys/net80211/ieee80211.c Tue May 26 13:19:05 2015 (r283568) > @@ -95,6 +95,7 @@ static void ieee80211com_media_status(st > static int ieee80211com_media_change(struct ifnet *); > static int media_status(enum ieee80211_opmode, > const struct ieee80211_channel *); > +static uint64_t ieee80211_get_counter(struct ifnet *, ift_counter); > > MALLOC_DEFINE(M_80211_VAP, "80211vap", "802.11 vap state"); > > @@ -303,6 +304,8 @@ ieee80211_ifattach(struct ieee80211com * > taskqueue_thread_enqueue, &ic->ic_tq); > taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s net80211 taskq", > ic->ic_name); > + ic->ic_ierrors = counter_u64_alloc(M_WAITOK); > + ic->ic_oerrors = counter_u64_alloc(M_WAITOK); > /* > * Fill in 802.11 available channel set, mark all > * available channels as active, and pick a default > @@ -401,6 +404,8 @@ ieee80211_ifdetach(struct ieee80211com * > > /* XXX VNET needed? */ > ifmedia_removeall(&ic->ic_media); > + counter_u64_free(ic->ic_ierrors); > + counter_u64_free(ic->ic_oerrors); > > taskqueue_free(ic->ic_tq); > IEEE80211_TX_LOCK_DESTROY(ic); > @@ -423,6 +428,31 @@ default_reset(struct ieee80211vap *vap, > } > > /* > + * Add underlying device errors to vap errors. > + */ > +static uint64_t > +ieee80211_get_counter(struct ifnet *ifp, ift_counter cnt) > +{ > + struct ieee80211vap *vap = ifp->if_softc; > + struct ieee80211com *ic = vap->iv_ic; > + uint64_t rv; > + > + rv = if_get_counter_default(ifp, cnt); > + switch (cnt) { > + case IFCOUNTER_OERRORS: > + rv += counter_u64_fetch(ic->ic_oerrors); > + break; > + case IFCOUNTER_IERRORS: > + rv += counter_u64_fetch(ic->ic_ierrors); > + break; > + default: > + break; > + } > + > + return (rv); > +} > + > +/* > * Prepare a vap for use. Drivers use this call to > * setup net80211 state in new vap's prior attaching > * them with ieee80211_vap_attach (below). > @@ -448,6 +478,7 @@ ieee80211_vap_setup(struct ieee80211com > ifp->if_qflush = ieee80211_vap_qflush; > ifp->if_ioctl = ieee80211_ioctl; > ifp->if_init = ieee80211_init; > + ifp->if_get_counter = ieee80211_get_counter; > > vap->iv_ifp = ifp; > vap->iv_ic = ic; >