From patchwork Mon Sep 27 16:05:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ignacy Gawedzki X-Patchwork-Id: 212922 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 o8RG71Eb010730 for ; Mon, 27 Sep 2010 16:07:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933205Ab0I0QGE (ORCPT ); Mon, 27 Sep 2010 12:06:04 -0400 Received: from ext.lri.fr ([129.175.15.4]:60385 "EHLO ext.lri.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932420Ab0I0QGB (ORCPT ); Mon, 27 Sep 2010 12:06:01 -0400 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 1D0AC3FE61; Mon, 27 Sep 2010 18:05:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DCvjbKZ4-QUj; Mon, 27 Sep 2010 18:05:58 +0200 (CEST) Received: from smtp-ng.lri.fr (smtp-ng [129.175.3.73]) by ext.lri.fr (Postfix) with ESMTP id 0177E3FE4B; Mon, 27 Sep 2010 18:05:58 +0200 (CEST) Received: from qubit.lri.fr (qubit [129.175.11.180]) by smtp-ng.lri.fr (Postfix) with ESMTP id 0901B1200E5; Mon, 27 Sep 2010 18:05:58 +0200 (CEST) Received: from ig by qubit.lri.fr with local (Exim 4.71) (envelope-from ) id 1P0GDG-0001Md-0E; Mon, 27 Sep 2010 18:05:58 +0200 Date: Mon, 27 Sep 2010 18:05:57 +0200 From: Ignacy Gawedzki To: Christian Lamparter Cc: linux-wireless@vger.kernel.org Subject: Re: A few questions about modifications in carl9170 Message-ID: <20100927160557.GA5121@qubit.lri.fr> References: <20100927132957.GA2977@qubit.lri.fr> <201009271737.16603.chunkeey@googlemail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201009271737.16603.chunkeey@googlemail.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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]); Mon, 27 Sep 2010 16:07:03 +0000 (UTC) --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -161,6 +161,12 @@ static void wlan_tx_complete(struct carl9170_tx_superframe *super, bool txs) { struct carl9170_tx_status *status; + union { + uint64_t tsf; + uint32_t tsfa[2]; + } tsf; + static uint64_t old_tsf = 0; + uint64_t new_tsf; status = wlan_get_tx_status_buffer(); @@ -178,6 +184,15 @@ static void wlan_tx_complete(struct carl9170_tx_superframe *super, status->rix = super->s.rix; status->tries = super->s.cnt; status->success = (txs) ? 1 : 0; + read_tsf(tsf.tsfa); + new_tsf = (tsf.tsf & 0xffffffff00000000) | super->s.timestamp; + if (new_tsf > tsf.tsf) + new_tsf -= 0x100000000; + if (new_tsf < old_tsf) + status->duration = (uint32_t)(tsf.tsf - old_tsf); + else + status->duration = (uint32_t)(tsf.tsf - new_tsf); + old_tsf = tsf.tsf; } static bool wlan_tx_consume_retry(struct carl9170_tx_superframe *super) @@ -219,6 +234,13 @@ static void __wlan_tx(struct dma_desc *desc) #ifdef CONFIG_CARL9170FW_NORMAL_TX_RX unsigned int queue = super->s.queue; #endif /* CONFIG_CARL9170FW_LOOPBACK */ + union { + uint64_t now; + uint32_t nowa[2]; + } now; + + read_tsf(now.nowa); + super->s.timestamp = now.now & 0xffffffff; if (unlikely(super->s.fill_in_tsf)) { struct ieee80211_mgmt *mgmt = (void *) &super->f.data.i3e; --- a/include/shared/fwcmd.h +++ b/include/shared/fwcmd.h @@ -215,6 +215,7 @@ struct carl9170_tx_status { u8 rix:2; u8 tries:3; u8 success:1; + u32 duration; } __packed; struct _carl9170_tx_status { /* @@ -223,8 +224,9 @@ struct _carl9170_tx_status { u8 cookie; u8 info; + u32 duration; } __packed; -#define CARL9170_TX_STATUS_SIZE 2 +#define CARL9170_TX_STATUS_SIZE 6 #define CARL9170_RSP_TX_STATUS_NUM (CARL9170_MAX_CMD_PAYLOAD_LEN / \ sizeof(struct _carl9170_tx_status)) --- a/include/shared/wlan.h +++ b/include/shared/wlan.h @@ -254,6 +254,7 @@ struct carl9170_tx_superdesc { u8 fill_in_tsf:1; u8 cab:1; u8 padding2; + u32 timestamp; struct ar9170_tx_rate_info ri[CARL9170_TX_MAX_RATES]; struct ar9170_tx_hw_phy_control rr[CARL9170_TX_MAX_RETRY_RATES]; } __packed; @@ -317,6 +318,7 @@ struct _carl9170_tx_superdesc { u8 ampdu_settings; u8 misc; u8 padding; + u32 timestamp; u8 ri[CARL9170_TX_MAX_RATES]; __le32 rr[CARL9170_TX_MAX_RETRY_RATES]; } __packed; @@ -327,7 +329,7 @@ struct _carl9170_tx_superframe { u8 frame_data[0]; } __packed; -#define CARL9170_TX_SUPERDESC_LEN 24 +#define CARL9170_TX_SUPERDESC_LEN 28 #define AR9170_TX_HWDESC_LEN 8 #define AR9170_TX_SUPERFRAME_LEN (CARL9170_TX_HWDESC_LEN + \ AR9170_TX_SUPERDESC_LEN)