From patchwork Mon Aug 3 06:37:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yi X-Patchwork-Id: 38839 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n736Zav2024280 for ; Mon, 3 Aug 2009 06:35:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752333AbZHCGfb (ORCPT ); Mon, 3 Aug 2009 02:35:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751881AbZHCGfb (ORCPT ); Mon, 3 Aug 2009 02:35:31 -0400 Received: from mga01.intel.com ([192.55.52.88]:55498 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752214AbZHCGf3 (ORCPT ); Mon, 3 Aug 2009 02:35:29 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 02 Aug 2009 23:33:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,312,1246863600"; d="scan'208";a="713354054" Received: from yzhu-mobl0.sh.intel.com (HELO localhost.localdomain) ([10.239.36.106]) by fmsmga001.fm.intel.com with ESMTP; 02 Aug 2009 23:38:42 -0700 From: Zhu Yi To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, Zhu Yi Subject: [PATCH 3/3] iwmc3200wifi: avoid setting default key for 802.1X and RSNA Date: Mon, 3 Aug 2009 14:37:03 +0800 Message-Id: <1249281423-26435-4-git-send-email-yi.zhu@intel.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1249281423-26435-3-git-send-email-yi.zhu@intel.com> References: <1249281423-26435-1-git-send-email-yi.zhu@intel.com> <1249281423-26435-2-git-send-email-yi.zhu@intel.com> <1249281423-26435-3-git-send-email-yi.zhu@intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org UMAC only allows us to set default key for WEP and auth type is not 802.1X or RSNA. This patch fixes iwmc3200wifi for 802.1X with WEP104. Signed-off-by: Zhu Yi --- drivers/net/wireless/iwmc3200wifi/commands.c | 39 +++++++++++++++++-------- 1 files changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c index 6b36260..aef9971 100644 --- a/drivers/net/wireless/iwmc3200wifi/commands.c +++ b/drivers/net/wireless/iwmc3200wifi/commands.c @@ -526,19 +526,6 @@ int iwm_read_mac(struct iwm_priv *iwm, u8 *mac) return 0; } -int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx) -{ - struct iwm_umac_tx_key_id tx_key_id; - - tx_key_id.hdr.oid = UMAC_WIFI_IF_CMD_GLOBAL_TX_KEY_ID; - tx_key_id.hdr.buf_size = cpu_to_le16(sizeof(struct iwm_umac_tx_key_id) - - sizeof(struct iwm_umac_wifi_if)); - - tx_key_id.key_idx = key_idx; - - return iwm_send_wifi_if_cmd(iwm, &tx_key_id, sizeof(tx_key_id), 1); -} - static int iwm_check_profile(struct iwm_priv *iwm) { if (!iwm->umac_profile_active) @@ -572,6 +559,32 @@ static int iwm_check_profile(struct iwm_priv *iwm) return 0; } +int iwm_set_tx_key(struct iwm_priv *iwm, u8 key_idx) +{ + struct iwm_umac_tx_key_id tx_key_id; + int ret; + + ret = iwm_check_profile(iwm); + if (ret < 0) + return ret; + + /* UMAC only allows to set default key for WEP and auth type is + * NOT 802.1X or RSNA. */ + if ((iwm->umac_profile->sec.ucast_cipher != UMAC_CIPHER_TYPE_WEP_40 && + iwm->umac_profile->sec.ucast_cipher != UMAC_CIPHER_TYPE_WEP_104) || + iwm->umac_profile->sec.auth_type == UMAC_AUTH_TYPE_8021X || + iwm->umac_profile->sec.auth_type == UMAC_AUTH_TYPE_RSNA_PSK) + return 0; + + tx_key_id.hdr.oid = UMAC_WIFI_IF_CMD_GLOBAL_TX_KEY_ID; + tx_key_id.hdr.buf_size = cpu_to_le16(sizeof(struct iwm_umac_tx_key_id) - + sizeof(struct iwm_umac_wifi_if)); + + tx_key_id.key_idx = key_idx; + + return iwm_send_wifi_if_cmd(iwm, &tx_key_id, sizeof(tx_key_id), 1); +} + int iwm_set_key(struct iwm_priv *iwm, bool remove, struct iwm_key *key) { int ret = 0;