Date: Tue, 26 May 2015 13:19:05 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283568 - head/sys/net80211 Message-ID: <201505261319.t4QDJ5Hj045298@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505261319.t4QDJ5Hj045298>