svn commit: r310435 - head/sys/net80211
Adrian Chadd
adrian at FreeBSD.org
Thu Dec 22 23:59:55 UTC 2016
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;
More information about the svn-src-head
mailing list