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: 10196191 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 6DDEC601A0 for ; Fri, 2 Feb 2018 01:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F0A228DA8 for ; Fri, 2 Feb 2018 01:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5373428DAA; Fri, 2 Feb 2018 01:03: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 D8C6028DA8 for ; Fri, 2 Feb 2018 01:03:41 +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=F0yPsDig2/ZTTwRGMpTrMtZT1V+owGU5mebp+AQm43Q=; b=di7 vJfsAXGfrRCxyqx0DFy1tJ6GVdY5bJ4paE4jq1aSzZ221wkX3L4RTNR9Y1h67dt+JWrSxs5XROuOu EYHmCU1ktqs8H8ih89XNf/lZA3/GMhMGzWHR71ei631R5F1O72LYr+hL+2EoAvkQphw0sw8oCKMJJ 8OBKIJnTaPZwBxc1NlSXim9eLR7mdK98CzES39DvIW7vLHUaFV08mIWws1QmsuqUisUujNh9IyWsQ OQCpAUM6KPLFdtAyqEQu7AZ+C34/eZE9+UQdt0DmmULv5C/iNoL+QcmwX6v0wMCpLShtZB2RLF/Zf 0oL3AiOpMaKMzu0+dy8JI13WLGy635Q==; 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 1ehPlI-00077s-4B; Fri, 02 Feb 2018 01:03:28 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ehPlE-00077A-Qh for ath10k@lists.infradead.org; Fri, 02 Feb 2018 01:03:26 +0000 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 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 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 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;