From patchwork Tue Feb 6 23:02:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 10204295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0843605BA for ; Tue, 6 Feb 2018 23:02:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D52AB2853E for ; Tue, 6 Feb 2018 23:02:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9DE02867F; Tue, 6 Feb 2018 23:02:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D1C3285C8 for ; Tue, 6 Feb 2018 23:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=58yNf33OyFQj++ATihGC2L+5bufj3NyNY0VQNhvzHuk=; b=Mza Ld2eaX0RQjsjS3Xiab957KiH3uEfBJjBlM4QLb0UHjtZ729VP0LqlbASDDQhX2F6tuUq3K+pIwE6q rT/aac2kkqJrqpqI2SRHtTQMQeO96SXp/M0IgZlXv2Jitd+O9kSEr6aFSMjIi3P9TjyBLJCOnWeIh 8ZQ9ghNezDohBj2WG1abJC8jtHZmcpkk/BTA2n0HQxK5y87FyGAKw43o5Wagz/JtdbWLQmINJCTbL Nwaao+oFSwNsoWPYkgqNsF1iRri0FyqDlnpP8I3j24jVTaABB2FBMleo7u02G4PWFp97ksMYLxTks 5Tg6CpEed6FcKksW7Z+XPEE19mD/T3A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ejCFz-0003O9-32; Tue, 06 Feb 2018 23:02:31 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ejCFu-0003BW-K6 for ath10k@lists.infradead.org; Tue, 06 Feb 2018 23:02:29 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 5593540A7E2; Tue, 6 Feb 2018 15:02:11 -0800 (PST) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Subject: [PATCH v2] ath10k: Support mgt frame per-chain rssi Date: Tue, 6 Feb 2018 15:02:08 -0800 Message-Id: <1517958128-12147-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.11 X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear , ath10k@lists.infradead.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear This provides per-chain rssi for management frames received over wmi. Signed-off-by: Ben Greear --- v2: Fix 'rssh' typo in commit message. drivers/net/wireless/ath/ath10k/wmi.c | 21 ++++++++++++++++++++- drivers/net/wireless/ath/ath10k/wmi.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 905af93..ff37274 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -2287,6 +2287,7 @@ static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar, u32 msdu_len; struct wmi_mgmt_rx_ext_info *ext_info; u32 len; + int i; ev = (struct wmi_10_4_mgmt_rx_event *)skb->data; ev_hdr = &ev->hdr; @@ -2302,6 +2303,8 @@ static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar, arg->snr = ev_hdr->snr; arg->phy_mode = ev_hdr->phy_mode; arg->rate = ev_hdr->rate; + for (i = 0; i<4; i++) + arg->rssi_ctl[i] = ev_hdr->rssi_ctl[i]; msdu_len = __le32_to_cpu(arg->buf_len); if (skb->len < msdu_len) @@ -2357,6 +2360,13 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) u32 buf_len; u16 fc; int ret; + int i; + + /* Initialize the rssi to 'ignore-me' value, stock wave-1 + * firmware doesn't support it. + */ + for (i = 0; i<4; i++) + arg.rssi_ctl[i] = 0x80; ret = ath10k_wmi_pull_mgmt_rx(ar, skb, &arg); if (ret) { @@ -2416,6 +2426,12 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) status->freq = ieee80211_channel_to_frequency(channel, status->band); status->signal = snr + ATH10K_DEFAULT_NOISE_FLOOR; + for (i = 0; i<4; i++) { + if (arg.rssi_ctl[i] != 0x80) { + status->chains |= BIT(i); + status->chain_signal[i] = ATH10K_DEFAULT_NOISE_FLOOR + arg.rssi_ctl[i]; + } + } status->rate_idx = ath10k_mac_bitrate_to_idx(sband, rate / 100); hdr = (struct ieee80211_hdr *)skb->data; @@ -2451,8 +2467,11 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) fc & IEEE80211_FCTL_FTYPE, fc & IEEE80211_FCTL_STYPE); ath10k_dbg(ar, ATH10K_DBG_MGMT, - "event mgmt rx freq %d band %d snr %d, rate_idx %d\n", + "event mgmt rx freq %d band %d snr %d chains: 0x%x(%d %d %d %d), rate_idx %d\n", status->freq, status->band, status->signal, + status->chains, + status->chain_signal[0], status->chain_signal[1], + status->chain_signal[2], status->chain_signal[3], status->rate_idx); ieee80211_rx(ar->hw, skb); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index a3ba191..d198772 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -6490,6 +6490,7 @@ struct wmi_scan_ev_arg { struct wmi_mgmt_rx_ev_arg { __le32 channel; __le32 snr; + u8 rssi_ctl[4]; __le32 rate; __le32 phy_mode; __le32 buf_len;