From patchwork Fri Feb 2 01:03:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 10196189 X-Patchwork-Delegate: kvalo@adurom.com 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 D0996601A0 for ; Fri, 2 Feb 2018 01:03:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFEDD28DA4 for ; Fri, 2 Feb 2018 01:03:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B261A28DA7; Fri, 2 Feb 2018 01:03:14 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34F7428DA4 for ; Fri, 2 Feb 2018 01:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751788AbeBBBDM (ORCPT ); Thu, 1 Feb 2018 20:03:12 -0500 Received: from mail2.candelatech.com ([208.74.158.173]:38092 "EHLO mail2.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751669AbeBBBDK (ORCPT ); Thu, 1 Feb 2018 20:03:10 -0500 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 7811B40A626; Thu, 1 Feb 2018 17:03:08 -0800 (PST) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: ath10k@lists.infradead.org, Ben Greear Subject: [PATCH] ath10k: Support mgt frame per-chain rssi Date: Thu, 1 Feb 2018 17:03:06 -0800 Message-Id: <1517533386-30766-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.11 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear This provides per-chain rssh for management frames received over wmi. Signed-off-by: Ben Greear --- 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;