From owner-svn-src-all@freebsd.org Thu Dec 22 23:59:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F260CC8DDBF; Thu, 22 Dec 2016 23:59:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A2A30AB6; Thu, 22 Dec 2016 23:59:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMNxrvb013288; Thu, 22 Dec 2016 23:59:53 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMNxrh0013287; Thu, 22 Dec 2016 23:59:53 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612222359.uBMNxrh0013287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 22 Dec 2016 23:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310435 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 23:59:55 -0000 Author: adrian Date: Thu Dec 22 23:59:53 2016 New Revision: 310435 URL: https://svnweb.freebsd.org/changeset/base/310435 Log: [net80211] WEP offload support. Yes, the ath10k NIC actually also does do WEP TX/RX offload. Tested: * ath10k driver port, WEP STA mode. Modified: head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Thu Dec 22 23:39:11 2016 (r310434) +++ head/sys/net80211/ieee80211_crypto_wep.c Thu Dec 22 23:59:53 2016 (r310435) @@ -180,10 +180,22 @@ wep_encap(struct ieee80211_key *k, struc { struct wep_ctx *ctx = k->wk_private; struct ieee80211com *ic = ctx->wc_ic; + struct ieee80211_frame *wh; uint8_t *ivp; int hdrlen; + int is_mgmt; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); + wh = mtod(m, struct ieee80211_frame *); + is_mgmt = IEEE80211_IS_MGMT(wh); + + /* + * Check to see if IV is required. + */ + if (is_mgmt && (k->wk_flags & IEEE80211_KEY_NOIVMGT)) + return 1; + if ((! is_mgmt) && (k->wk_flags & IEEE80211_KEY_NOIV)) + return 1; /* * Copy down 802.11 header and add the IV + KeyID. @@ -228,9 +240,15 @@ wep_decap(struct ieee80211_key *k, struc struct wep_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->wc_vap; struct ieee80211_frame *wh; + const struct ieee80211_rx_stats *rxs; wh = mtod(m, struct ieee80211_frame *); + rxs = ieee80211_get_rx_params_ptr(m); + + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP)) + goto finish; + /* * Check if the device handled the decrypt in hardware. * If so we just strip the header; otherwise we need to @@ -249,6 +267,9 @@ wep_decap(struct ieee80211_key *k, struc */ ovbcopy(mtod(m, void *), mtod(m, uint8_t *) + wep.ic_header, hdrlen); m_adj(m, wep.ic_header); + +finish: + /* XXX TODO: do we have to strip this for offload devices? */ m_adj(m, -wep.ic_trailer); return 1;