From patchwork Wed May 11 17:02:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 9073521 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 596FE9F1C1 for ; Wed, 11 May 2016 17:10:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ECE520148 for ; Wed, 11 May 2016 17:10:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BE7D20142 for ; Wed, 11 May 2016 17:10:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0Xe2-0005wu-7g; Wed, 11 May 2016 17:09:58 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0Xdu-0005sU-Sh for ath10k@bombadil.infradead.org; Wed, 11 May 2016 17:09:50 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by merlin.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1b0Xdt-0005Ww-OP for ath10k@lists.infradead.org; Wed, 11 May 2016 17:09:50 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 7DEF540C4A7; Wed, 11 May 2016 10:02:44 -0700 (PDT) From: greearb@candelatech.com To: ath10k@lists.infradead.org Subject: [PATCH v2 17/21] ath10k: Enable detecting failure to install key in firmware (CT). Date: Wed, 11 May 2016 10:02:29 -0700 Message-Id: <1462986153-16318-18-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1462986153-16318-1-git-send-email-greearb@candelatech.com> References: <1462986153-16318-1-git-send-email-greearb@candelatech.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160511_130949_945741_B2F9A4E2 X-CRM114-Status: GOOD ( 13.22 ) X-Spam-Score: -3.3 (---) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear CT firmware has been modified so that it will always return a response message when user requests to add a key, even if the key could not actually be added. Upstream firmware may assert or just not respond in a failure case. This change should be compatible with non CT firmware. Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/core.h | 1 + drivers/net/wireless/ath/ath10k/htt.h | 7 +++++-- drivers/net/wireless/ath/ath10k/htt_rx.c | 20 +++++++++++++++++--- drivers/net/wireless/ath/ath10k/mac.c | 3 ++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index f9e3b20..fda66bf 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -848,6 +848,7 @@ struct ath10k { unsigned int filter_flags; unsigned long dev_flags; bool dfs_block_radar_events; + int install_key_rv; /* Store error code from key-install */ /* protected by conf_mutex */ bool radar_enabled; diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index 911c535..c50b343 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -702,8 +702,9 @@ enum htt_security_types { }; enum htt_security_flags { -#define HTT_SECURITY_TYPE_MASK 0x7F +#define HTT_SECURITY_TYPE_MASK 0x3F #define HTT_SECURITY_TYPE_LSB 0 + HTT_SECURITY_IS_FAILURE = 1 << 6, /* CT firmware only */ HTT_SECURITY_IS_UNICAST = 1 << 7 }; @@ -712,7 +713,9 @@ struct htt_security_indication { /* dont use bitfields; undefined behaviour */ u8 flags; /* %htt_security_flags */ struct { - u8 security_type:7, /* %htt_security_types */ + u8 security_type:6, /* %htt_security_types */ + is_failure:1, /* does this response indicate failure + (CT Firmware) */ is_unicast:1; } __packed; } __packed; diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 47da904..02b5417 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2307,9 +2307,23 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) ath10k_dbg(ar, ATH10K_DBG_HTT, "sec ind peer_id %d unicast %d type %d\n", - __le16_to_cpu(ev->peer_id), - !!(ev->flags & HTT_SECURITY_IS_UNICAST), - MS(ev->flags, HTT_SECURITY_TYPE)); + __le16_to_cpu(ev->peer_id), + !!(ev->flags & HTT_SECURITY_IS_UNICAST), + MS(ev->flags, HTT_SECURITY_TYPE)); + + /* CT firmware adds way to determine failure of key set, without + * just timing things out. Indication of failure is determined + * by the 6th bit of the security-type being set. + */ + if (ev->flags & HTT_SECURITY_IS_FAILURE) { + ath10k_warn(ar, "Firmware failed to set security key, peer_id: %d unicast %d type %d\n", + __le16_to_cpu(ev->peer_id), + !!(ev->flags & HTT_SECURITY_IS_UNICAST), + MS(ev->flags, HTT_SECURITY_TYPE)); + ar->install_key_rv = -EINVAL; + } else { + ar->install_key_rv = 0; + } complete(&ar->install_key_done); break; } diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 2169337..373f2ee 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -255,7 +255,8 @@ static int ath10k_install_key(struct ath10k_vif *arvif, if (time_left == 0) return -ETIMEDOUT; - return 0; + ret = ar->install_key_rv; + return ret; } static int ath10k_install_peer_wep_keys(struct ath10k_vif *arvif,