From patchwork Tue Oct 19 07:56:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Randolf X-Patchwork-Id: 264831 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9J7v1Me004416 for ; Tue, 19 Oct 2010 07:57:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755538Ab0JSH5A (ORCPT ); Tue, 19 Oct 2010 03:57:00 -0400 Received: from mail30f.wh2.ocn.ne.jp ([220.111.41.203]:5217 "HELO mail30f.wh2.ocn.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755116Ab0JSH47 (ORCPT ); Tue, 19 Oct 2010 03:56:59 -0400 Received: from vs3003.wh2.ocn.ne.jp (125.206.180.231) by mail30f.wh2.ocn.ne.jp (RS ver 1.0.95vs) with SMTP id 2-0305215016 for ; Tue, 19 Oct 2010 16:56:58 +0900 (JST) Received: (qmail 80106 invoked from network); 19 Oct 2010 07:56:56 -0000 Received: from unknown (HELO localhost6.localdomain6) (220.110.201.18) by with SMTP; 19 Oct 2010 07:56:56 -0000 Subject: [PATCH 2/2] ath5k: Add channel time to survey data To: linville@tuxdriver.com From: Bruno Randolf Cc: ath5k-devel@venema.h4ckr.net, linux-wireless@vger.kernel.org Date: Tue, 19 Oct 2010 16:56:54 +0900 Message-ID: <20101019075654.19979.9679.stgit@localhost6.localdomain6> In-Reply-To: <20101019075648.19979.42181.stgit@localhost6.localdomain6> References: <20101019075648.19979.42181.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 X-SF-Loop: 1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 19 Oct 2010 07:57:01 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 8251946..484aad5 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c @@ -3206,14 +3206,32 @@ static int ath5k_get_survey(struct ieee80211_hw *hw, int idx, { struct ath5k_softc *sc = hw->priv; struct ieee80211_conf *conf = &hw->conf; + struct ath_common *common = ath5k_hw_common(sc->ah); + struct ath_cycle_counters *cc = &common->cc_survey; + unsigned int div = common->clockrate * 1000; - if (idx != 0) + if (idx != 0) return -ENOENT; survey->channel = conf->channel; survey->filled = SURVEY_INFO_NOISE_DBM; survey->noise = sc->ah->ah_noise_floor; + spin_lock_bh(&common->cc_lock); + ath_hw_cycle_counters_update(common); + if (cc->cycles > 0) { + survey->filled |= SURVEY_INFO_CHANNEL_TIME | + SURVEY_INFO_CHANNEL_TIME_BUSY | + SURVEY_INFO_CHANNEL_TIME_RX | + SURVEY_INFO_CHANNEL_TIME_TX; + survey->channel_time += cc->cycles / div; + survey->channel_time_busy += cc->rx_busy / div; + survey->channel_time_rx += cc->rx_frame / div; + survey->channel_time_tx += cc->tx_frame / div; + } + memset(cc, 0, sizeof(*cc)); + spin_unlock_bh(&common->cc_lock); + return 0; }