From patchwork Wed Jan 22 22:54:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 3525821 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A94529F1C3 for ; Wed, 22 Jan 2014 22:55:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C75A0201BA for ; Wed, 22 Jan 2014 22:55:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED699201B9 for ; Wed, 22 Jan 2014 22:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbaAVWzs (ORCPT ); Wed, 22 Jan 2014 17:55:48 -0500 Received: from mail.candelatech.com ([208.74.158.172]:51441 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751649AbaAVWzr (ORCPT ); Wed, 22 Jan 2014 17:55:47 -0500 Received: from ben-dt2.candelatech.com (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id s0MMtIkK007633 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Jan 2014 14:55:23 -0800 From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH 2/2] mac80211: Support tx-hw-crypt with rx-sw-crypt. Date: Wed, 22 Jan 2014 14:54:56 -0800 Message-Id: <1390431296-20568-2-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1390431296-20568-1-git-send-email-greearb@candelatech.com> References: <1390431296-20568-1-git-send-email-greearb@candelatech.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Some NICs can be made to offload the tx encryption and run the rx encryption in software. This can be used to allow connecting several stations to the same AP, since most hardware appears to hash only on the remote peer's MAC. Signed-off-by: Ben Greear --- include/net/mac80211.h | 4 ++++ net/mac80211/tkip.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f4ab2fb..dc552c7 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1203,6 +1203,9 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev); * fall back to software crypto. Note that this flag deals only with * RX, if your crypto engine can't deal with TX you can also set the * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. + * @IEEE80211_KEY_FLAG_SW_RX_CRYPT: This flag indicates hardware will not + * do any decrypt for received packets, though it may have uploaded + * the hardware key to be used for encrypting transmitted frames. */ enum ieee80211_key_flags { IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, @@ -1211,6 +1214,7 @@ enum ieee80211_key_flags { IEEE80211_KEY_FLAG_SW_MGMT_TX = 1<<4, IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, IEEE80211_KEY_FLAG_RX_MGMT = 1<<6, + IEEE80211_KEY_FLAG_SW_RX_CRYPT = 1<<7, }; /** diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index 0ae2077..83ac9d9 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c @@ -283,7 +283,8 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); } if (key->local->ops->update_tkip_key && - key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && + (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && + !(key->conf.flags & IEEE80211_KEY_FLAG_SW_RX_CRYPT)) && key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { struct ieee80211_sub_if_data *sdata = key->sdata;