diff options
author | sam <sam@FreeBSD.org> | 2009-03-30 21:53:27 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-03-30 21:53:27 +0000 |
commit | ec9a1dd6fac0b26bda9506bccfb787bf8de40a24 (patch) | |
tree | b2bbd2e1f176a7f310059ed050ec25ce8ffbac3c /sys/dev/wi | |
parent | 138715ea93389ab74634badfa0b13e72e4b94fb3 (diff) | |
download | FreeBSD-src-ec9a1dd6fac0b26bda9506bccfb787bf8de40a24.zip FreeBSD-src-ec9a1dd6fac0b26bda9506bccfb787bf8de40a24.tar.gz |
Hoist 802.11 encapsulation up into net80211:
o call ieee80211_encap in ieee80211_start so frames passed down to drivers
are already encapsulated
o remove ieee80211_encap calls in drivers
o fixup wi so it recreates the 802.3 head it requires from the 802.11
header contents
o move fast-frame aggregation from ath to net80211 (conditional on
IEEE80211_SUPPORT_SUPERG):
- aggregation is now done in ieee80211_start; it is enabled when the
packets/sec exceeds ieee80211_ffppsmin (net.wlan.ffppsmin) and frames
are held on a staging queue according to ieee80211_ffagemax
(net.wlan.ffagemax) to wait for a frame to combine with
- drivers must call back to age/flush the staging queue (ath does this
on tx done, at swba, and on rx according to the state of the tx queues
and/or the contents of the staging queue)
- remove fast-frame-related data structures from ath
- add ieee80211_ff_node_init and ieee80211_ff_node_cleanup to handle
per-node fast-frames state (we reuse 11n tx ampdu state)
o change ieee80211_encap calling convention to include an explicit vap
so frames coming through a WDS vap are recognized w/o setting M_WDS
With these changes any device able to tx/rx 3Kbyte+ frames can use fast-frames.
Reviewed by: thompsa, rpaulo, avatar, imp, sephe
Diffstat (limited to 'sys/dev/wi')
-rw-r--r-- | sys/dev/wi/if_wi.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 172beb3..a4a74e4 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -89,6 +89,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_arp.h> #include <net/ethernet.h> #include <net/if_dl.h> +#include <net/if_llc.h> #include <net/if_media.h> #include <net/if_types.h> @@ -978,6 +979,7 @@ wi_start_locked(struct ifnet *ifp) struct mbuf *m0; struct ieee80211_key *k; struct wi_frame frmhdr; + const struct llc *llc; int cur; WI_LOCK_ASSERT(sc); @@ -996,19 +998,33 @@ wi_start_locked(struct ifnet *ifp) ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - /* NB: copy before 802.11 header is prepended */ - m_copydata(m0, 0, ETHER_HDR_LEN, - (caddr_t)&frmhdr.wi_ehdr); - ni = (struct ieee80211_node *) m0->m_pkthdr.rcvif; - m0 = ieee80211_encap(ni, m0); - if (m0 == NULL) { - ifp->if_oerrors++; - ieee80211_free_node(ni); - continue; - } + /* reconstruct 802.3 header */ wh = mtod(m0, struct ieee80211_frame *); + switch (wh->i_fc[1]) { + case IEEE80211_FC1_DIR_TODS: + IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_shost, + wh->i_addr2); + IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_dhost, + wh->i_addr3); + break; + case IEEE80211_FC1_DIR_NODS: + IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_shost, + wh->i_addr2); + IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_dhost, + wh->i_addr1); + break; + case IEEE80211_FC1_DIR_FROMDS: + IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_shost, + wh->i_addr3); + IEEE80211_ADDR_COPY(frmhdr.wi_ehdr.ether_dhost, + wh->i_addr1); + break; + } + llc = (const struct llc *)( + mtod(m0, const uint8_t *) + ieee80211_hdrsize(wh)); + frmhdr.wi_ehdr.ether_type = llc->llc_snap.ether_type; frmhdr.wi_tx_ctl = htole16(WI_ENC_TX_802_11|WI_TXCNTL_TX_EX); if (wh->i_fc[1] & IEEE80211_FC1_WEP) { k = ieee80211_crypto_encap(ni, m0); |