From patchwork Mon Dec 17 15:30:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 1905831 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 32246DFB79 for ; Sat, 22 Dec 2012 14:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751238Ab2LVOyX (ORCPT ); Sat, 22 Dec 2012 09:54:23 -0500 Received: from mail-we0-f176.google.com ([74.125.82.176]:60910 "EHLO mail-we0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751144Ab2LVOyX (ORCPT ); Sat, 22 Dec 2012 09:54:23 -0500 Received: by mail-we0-f176.google.com with SMTP id r5so2717629wey.35 for ; Sat, 22 Dec 2012 06:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:in-reply-to:references:from:date:subject:to :cc; bh=v8IMrzsNrt6y6/yLgn0s4nWZHCxjwm4Kgc4NwWUdE6w=; b=BDQ22gZoCT55Yzkj1pN+I7rt/5I0qjvPJi+pc9rn4TwVidjT9MinerAFcMK/yP5An4 dWeLHV1M7c8I+h0uenP9nLycpPe8rc7JWUXtYf1uOwJ2swYH+57vd8BpJW6zmrte+lsB LgJEla8MOMItpmyjgZzvmjKqn2rHejt6tt9A+BhBTWol8K4bcOjgcl+r3qmQ+PyO8ZwE r7YAzYyF9ENbW9ZjPWM8CvFvBJN44u9KdO+Ou7It1C3/MTp3XiFSF6//umOCmoiZLKFp 7cLZTW9qYG7+qe5CO6JfqBCurgNLc+k/G+Y46kZfRMeKhQ5rWygsQPMm/p5bKkzbfbns pdpQ== X-Received: by 10.180.78.226 with SMTP id e2mr26062402wix.1.1356187567627; Sat, 22 Dec 2012 06:46:07 -0800 (PST) Received: from debian64.localnet (pD9F88B3A.dip.t-dialin.net. [217.248.139.58]) by mx.google.com with ESMTPS id u6sm23578165wif.2.2012.12.22.06.46.05 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 22 Dec 2012 06:46:06 -0800 (PST) Received: from localhost ([127.0.0.1] helo=debian64.localnet ident=chuck) by debian64.localnet with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1TmQKq-0004Aa-SE; Sat, 22 Dec 2012 15:46:02 +0100 Message-Id: <97df7bfd2d02a7cf3862c2b86878c3a9aa3d6ccf.1356186145.git.chunkeey@googlemail.com> In-Reply-To: <8f92b38a456c1dd901ce2022fcb66609a5b8ac4b.1356186145.git.chunkeey@googlemail.com> References: <8f92b38a456c1dd901ce2022fcb66609a5b8ac4b.1356186145.git.chunkeey@googlemail.com> From: Christian Lamparter Date: Mon, 17 Dec 2012 16:30:05 +0100 Subject: [PATCH 5/8] carl9170: don't enable hw crypto offload, if the fw doesn't support it To: linux-wireless@vger.kernel.org Cc: linville@tuxdriver.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Previously, op_start would set disable_offload always to false, even if it was set to true by the fw parser. Signed-off-by: Christian Lamparter --- drivers/net/wireless/ath/carl9170/carl9170.h | 1 + drivers/net/wireless/ath/carl9170/fw.c | 2 +- drivers/net/wireless/ath/carl9170/main.c | 33 +++++++++++++++++--------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h index 2df17f1..c77874c 100644 --- a/drivers/net/wireless/ath/carl9170/carl9170.h +++ b/drivers/net/wireless/ath/carl9170/carl9170.h @@ -290,6 +290,7 @@ struct ar9170 { unsigned int rx_size; unsigned int tx_seq_table; bool ba_filter; + bool disable_offload_fw; } fw; /* interface configuration combinations */ diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c index 401a080..6e76179 100644 --- a/drivers/net/wireless/ath/carl9170/fw.c +++ b/drivers/net/wireless/ath/carl9170/fw.c @@ -282,7 +282,7 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) if (!SUPP(CARL9170FW_COMMAND_CAM)) { dev_info(&ar->udev->dev, "crypto offloading is disabled " "by firmware.\n"); - ar->disable_offload = true; + ar->fw.disable_offload_fw = true; } if (SUPP(CARL9170FW_PSM) && SUPP(CARL9170FW_FIXED_5GHZ_PSM)) diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 5d3cb88..c1a272d 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c @@ -358,8 +358,13 @@ static int carl9170_op_start(struct ieee80211_hw *hw) ar->ps.last_action = jiffies; ar->ps.last_slept = jiffies; ar->erp_mode = CARL9170_ERP_AUTO; - ar->rx_software_decryption = false; - ar->disable_offload = false; + + /* Set "disable hw crypto offload" whenever the module parameter + * nohwcrypt is true or if the firmware does not support it. + */ + ar->disable_offload = modparam_nohwcrypt | + ar->fw.disable_offload_fw; + ar->rx_software_decryption = ar->disable_offload; for (i = 0; i < ar->hw->queues; i++) { ar->queue_stop_timeout[i] = jiffies; @@ -565,12 +570,20 @@ static int carl9170_init_interface(struct ar9170 *ar, memcpy(common->macaddr, vif->addr, ETH_ALEN); - if (modparam_nohwcrypt || - ((vif->type != NL80211_IFTYPE_STATION) && - (vif->type != NL80211_IFTYPE_AP))) { - ar->rx_software_decryption = true; - ar->disable_offload = true; - } + /* We have to fall back to software crypto, whenever + * the user choose to participates in an IBSS. HW + * offload for IBSS RSN is not supported by this driver. + * + * NOTE: If the previous main interface has already + * disabled hw crypto offload, we have to keep this + * previous disable_offload setting as it was. + * Altough ideally, we should notify mac80211 and tell + * it to forget about any HW crypto offload for now. + */ + ar->disable_offload |= ((vif->type != NL80211_IFTYPE_STATION) && + (vif->type != NL80211_IFTYPE_AP)); + + ar->rx_software_decryption = ar->disable_offload; err = carl9170_set_operating_mode(ar); return err; @@ -1160,9 +1173,7 @@ static int carl9170_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, if (ar->disable_offload || !vif) return -EOPNOTSUPP; - /* - * We have to fall back to software encryption, whenever - * the user choose to participates in an IBSS or is connected + /* Fall back to software encryption whenever the driver is connected * to more than one network. * * This is very unfortunate, because some machines cannot handle