Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Dec 2016 23:59:53 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310435 - head/sys/net80211
Message-ID:  <201612222359.uBMNxrh0013287@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612222359.uBMNxrh0013287>