From owner-svn-src-head@FreeBSD.ORG Sun Mar 15 20:33:14 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D5EBB86D; Sun, 15 Mar 2015 20:33:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7C90FEB; Sun, 15 Mar 2015 20:33:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2FKXEXY063735; Sun, 15 Mar 2015 20:33:14 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2FKXEEF063734; Sun, 15 Mar 2015 20:33:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201503152033.t2FKXEEF063734@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 15 Mar 2015 20:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280068 - head/sys/dev/wpi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Mar 2015 20:33:14 -0000 Author: adrian Date: Sun Mar 15 20:33:13 2015 New Revision: 280068 URL: https://svnweb.freebsd.org/changeset/base/280068 Log: Move key processing in wpi_tx_data. (This is in preparation for further work to support hardware encryption.) PR: kern/197143 Submitted by: Andriy Voskoboinyk Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sun Mar 15 20:32:12 2015 (r280067) +++ head/sys/dev/wpi/if_wpi.c Sun Mar 15 20:33:13 2015 (r280068) @@ -2379,7 +2379,7 @@ wpi_tx_data(struct wpi_softc *sc, struct uint32_t flags; uint16_t qos; uint8_t tid, type; - int ac, error, rate, ismcast, totlen; + int ac, error, swcrypt, rate, ismcast, totlen; wh = mtod(m, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; @@ -2422,6 +2422,8 @@ wpi_tx_data(struct wpi_softc *sc, struct error = ENOBUFS; goto fail; } + swcrypt = k->wk_flags & IEEE80211_KEY_SWCRYPT; + /* 802.11 header may have moved. */ wh = mtod(m, struct ieee80211_frame *); } @@ -2508,6 +2510,19 @@ wpi_tx_data(struct wpi_softc *sc, struct if (type != IEEE80211_FC0_TYPE_MGT) tx.data_ntries = tp->maxretry; + if (k != NULL && !swcrypt) { + switch (k->wk_cipher->ic_cipher) { + case IEEE80211_CIPHER_AES_CCM: + tx.security = WPI_CIPHER_CCMP; + break; + + default: + break; + } + + memcpy(tx.key, k->wk_key, k->wk_keylen); + } + tx.len = htole16(totlen); tx.flags = htole32(flags); tx.plcp = rate2plcp(rate); @@ -2517,13 +2532,6 @@ wpi_tx_data(struct wpi_softc *sc, struct tx.cck_mask = 0x0f; tx.rts_ntries = 7; - if (k != NULL && k->wk_cipher->ic_cipher == IEEE80211_CIPHER_AES_CCM) { - if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { - tx.security = WPI_CIPHER_CCMP; - memcpy(tx.key, k->wk_key, k->wk_keylen); - } - } - tx_data.data = &tx; tx_data.ni = ni; tx_data.m = m;