From patchwork Mon Sep 25 22:29:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 9970615 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 49413602CB for ; Mon, 25 Sep 2017 22:30:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A2E228AC5 for ; Mon, 25 Sep 2017 22:30:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EEDA28DD5; Mon, 25 Sep 2017 22:30:26 +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 857B428DCD for ; Mon, 25 Sep 2017 22:30:25 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=f82UKqrTrQCNFAw/X6WJeKefdMxEMtu8Z6it0Ulj4tU=; b=okiOIkvMTYKmPp 7KfAymw9cJgMFohQJPLxj+94ne3gBxGEvdLzmfRMkCHrsflf2NJxL6533TvPFQfEfyiuQ2XPFrubf u+eFK/7F3YBWQrgvBliEgpxsTT4LCDqjLBhTsNcRPg7RzdbajlCYg5Z2TO78N7d+EqN1qNBD3GX/Y y/rqmv5fqXXrrmqVrrkIMUGVJMBpjOn0Na03+/eRWXVzSaHKcmpE1o2s/beRCTsOjPuiaZF3iURRD YyaI0XTzmybSaIg1S2c564kRdjdsJ81TnM7SXS0K4WPioHuftgap/R2FcTUuFNAjx8TpfpNpZdySr uUMTPWUC0ATU1OJuKj8Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dwbtI-0002gh-Lb; Mon, 25 Sep 2017 22:30:16 +0000 Received: from sabertooth01.qualcomm.com ([65.197.215.72]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dwbtE-0001Qr-KR for ath10k@lists.infradead.org; Mon, 25 Sep 2017 22:30:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1506378612; x=1537914612; h=from:to:cc:subject:date:message-id:mime-version; bh=3hCCS+ZLFLHPOPxOxb0z3D2KgCwRO53h4OZBdfPsj/8=; b=hmQ35diws5hymzxY0TMgPT64/nic5RZXFu85UyYM5nR/YW8zx0HsgKWl 5+0I9DX6i4kLF3aJENz425zWZe81YFxh7j1n5q4OjO//9F2DhaCFBC24M 3anl/ltG4p6YF7E9K1PN2MRjENmenP/nqcioM7I15euCXNs1sh3p7q8tt s=; X-IronPort-AV: E=Sophos;i="5.42,437,1500966000"; d="scan'208";a="115270547" Received: from unknown (HELO ironmsg11-lv.qualcomm.com) ([10.47.202.155]) by sabertooth01.qualcomm.com with ESMTP; 25 Sep 2017 15:29:50 -0700 X-IronPort-AV: E=McAfee;i="5900,7806,8665"; a="11316363" X-MGA-submission: =?us-ascii?q?MDHxkXAanclnKvOfEjLVEfmzJWyturGAviFJuI?= =?us-ascii?q?5SENriuIzkJL2avIMqK8G8qNo9FVC4CUEJDy+2jVYCEViE/aeetf2PlC?= =?us-ascii?q?OBQz25YuVHkwCUfnUuY63YWm7M6BZJ9QTha2cieKkLIsPqv/e3VNcP9S?= =?us-ascii?q?kl?= Received: from nalasexr01h.na.qualcomm.com ([10.49.56.54]) by ironmsg11-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 25 Sep 2017 15:29:50 -0700 Received: from qcmail1.qualcomm.com (10.80.80.8) by NALASEXR01H.na.qualcomm.com (10.49.56.54) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Mon, 25 Sep 2017 15:29:43 -0700 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Mon, 25 Sep 2017 15:29:42 -0700 From: Rajkumar Manoharan To: Subject: [PATCH v2] ath10k: add new cipher suite support Date: Mon, 25 Sep 2017 15:29:41 -0700 Message-ID: <1506378581-13598-1-git-send-email-rmanohar@qti.qualcomm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01C.na.qualcomm.com (10.85.0.83) To NALASEXR01H.na.qualcomm.com (10.49.56.54) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170925_153012_728325_42817D87 X-CRM114-Status: GOOD ( 13.39 ) 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: Jouni Malinen , linux-wireless@vger.kernel.org, Rajkumar Manoharan , rmanohar@codeaurora.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP QCA99x0 and QCA4019 family chips support CCMP-256, GCMP-128, and GCMP-256 ciphers in hardware, so advertise support for these. As firmware does not support group management frame ciphers (BIP), handle them in software (mac80211). Reviewed-by: Sebastian Gottschall Cc: Jouni Malinen Signed-off-by: Rajkumar Manoharan --- v2: fix a bug in assigning n_cipher_suites. fill hw_param n_cipher_suites for all chips. drivers/net/wireless/ath/ath10k/core.c | 12 ++++++++++ drivers/net/wireless/ath/ath10k/hw.h | 3 +++ drivers/net/wireless/ath/ath10k/mac.c | 43 ++++++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath10k/wmi.h | 1 + 4 files changed, 57 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index a4f635820f35..71de3a28b59c 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -74,6 +74,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA9887_HW_1_0_VERSION, @@ -97,6 +98,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA6174_HW_2_1_VERSION, @@ -119,6 +121,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA6174_HW_2_1_VERSION, @@ -141,6 +144,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA6174_HW_3_0_VERSION, @@ -163,6 +167,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA6174_HW_3_2_VERSION, @@ -188,6 +193,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA99X0_HW_2_0_DEV_VERSION, @@ -216,6 +222,7 @@ .spectral_bin_discard = 4, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 11, }, { .id = QCA9984_HW_1_0_DEV_VERSION, @@ -249,6 +256,7 @@ */ .vht160_mcs_rx_highest = 1560, .vht160_mcs_tx_highest = 1560, + .n_cipher_suites = 11, }, { .id = QCA9888_HW_2_0_DEV_VERSION, @@ -281,6 +289,7 @@ */ .vht160_mcs_rx_highest = 780, .vht160_mcs_tx_highest = 780, + .n_cipher_suites = 11, }, { .id = QCA9377_HW_1_0_DEV_VERSION, @@ -303,6 +312,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -327,6 +337,7 @@ .spectral_bin_discard = 0, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 8, }, { .id = QCA4019_HW_1_0_DEV_VERSION, @@ -356,6 +367,7 @@ .spectral_bin_discard = 4, .vht160_mcs_rx_highest = 0, .vht160_mcs_tx_highest = 0, + .n_cipher_suites = 11, }, }; diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 0c089f6dd3d9..ed30d5b6cd0e 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -550,6 +550,9 @@ struct ath10k_hw_params { */ int vht160_mcs_rx_highest; int vht160_mcs_tx_highest; + + /* Number of ciphers supported (i.e First N) in cipher_suites array */ + int n_cipher_suites; }; struct htt_rx_desc; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 5683f1a5330e..89455231754c 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -242,6 +242,16 @@ static int ath10k_send_key(struct ath10k_vif *arvif, case WLAN_CIPHER_SUITE_WEP104: arg.key_cipher = WMI_CIPHER_WEP; break; + case WLAN_CIPHER_SUITE_CCMP_256: + arg.key_cipher = WMI_CIPHER_AES_CCM; + break; + case WLAN_CIPHER_SUITE_GCMP: + case WLAN_CIPHER_SUITE_GCMP_256: + arg.key_cipher = WMI_CIPHER_AES_GCM; + break; + case WLAN_CIPHER_SUITE_BIP_GMAC_128: + case WLAN_CIPHER_SUITE_BIP_GMAC_256: + case WLAN_CIPHER_SUITE_BIP_CMAC_256: case WLAN_CIPHER_SUITE_AES_CMAC: WARN_ON(1); return -EINVAL; @@ -5723,7 +5733,10 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, u32 flags2; /* this one needs to be done in software */ - if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) + if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || + key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || + key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || + key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) return 1; if (arvif->nohwcrypt) @@ -8074,7 +8087,22 @@ int ath10k_mac_register(struct ath10k *ar) WLAN_CIPHER_SUITE_WEP104, WLAN_CIPHER_SUITE_TKIP, WLAN_CIPHER_SUITE_CCMP, + + /* Do not add hardware supported ciphers before this line. + * Allow software encryption for all chips. Don't forget to + * update n_cipher_suites below. + */ WLAN_CIPHER_SUITE_AES_CMAC, + WLAN_CIPHER_SUITE_BIP_CMAC_256, + WLAN_CIPHER_SUITE_BIP_GMAC_128, + WLAN_CIPHER_SUITE_BIP_GMAC_256, + + /* Only QCA99x0 and QCA4019 varients support GCMP-128, GCMP-256 + * and CCMP-256 in hardware. + */ + WLAN_CIPHER_SUITE_GCMP, + WLAN_CIPHER_SUITE_GCMP_256, + WLAN_CIPHER_SUITE_CCMP_256, }; struct ieee80211_supported_band *band; void *channels; @@ -8313,7 +8341,18 @@ int ath10k_mac_register(struct ath10k *ar) } ar->hw->wiphy->cipher_suites = cipher_suites; - ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); + + /* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128 + * and GCMP-256 ciphers in hardware. Fetch number of ciphers supported + * from chip specific hw_param table. + */ + if (!ar->hw_params.n_cipher_suites || + ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) { + ath10k_err(ar, "invalid hw_params.n_cipher_suites %d\n", + ar->hw_params.n_cipher_suites); + ar->hw_params.n_cipher_suites = 8; + } + ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites; wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 7a3606dde227..c02b21cff38d 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -4751,6 +4751,7 @@ struct wmi_key_seq_counter { #define WMI_CIPHER_WAPI 0x5 #define WMI_CIPHER_CKIP 0x6 #define WMI_CIPHER_AES_CMAC 0x7 +#define WMI_CIPHER_AES_GCM 0x8 struct wmi_vdev_install_key_cmd { __le32 vdev_id;