Date: Tue, 24 Mar 2009 20:39:08 +0000 (UTC) From: Sam Leffler <sam@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r190391 - in head/sys: conf net80211 Message-ID: <200903242039.n2OKd8LC056178@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sam Date: Tue Mar 24 20:39:08 2009 New Revision: 190391 URL: http://svn.freebsd.org/changeset/base/190391 Log: split Atheros SuperG support out into it's own file that's included only with a new IEEE80211_SUPPORT_SUPERG option Added: head/sys/net80211/ieee80211_superg.c (contents, props changed) head/sys/net80211/ieee80211_superg.h (contents, props changed) Modified: head/sys/conf/files head/sys/conf/options head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_input.c head/sys/net80211/ieee80211_input.h head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_proto.h head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_wds.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/conf/files Tue Mar 24 20:39:08 2009 (r190391) @@ -2215,6 +2215,7 @@ net80211/ieee80211_rssadapt.c optional w net80211/ieee80211_scan.c optional wlan net80211/ieee80211_scan_sta.c optional wlan net80211/ieee80211_sta.c optional wlan +net80211/ieee80211_superg.c optional wlan ieee80211_support_superg net80211/ieee80211_tdma.c optional wlan ieee80211_support_tdma net80211/ieee80211_wds.c optional wlan net80211/ieee80211_xauth.c optional wlan wlan_xauth Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/conf/options Tue Mar 24 20:39:08 2009 (r190391) @@ -789,6 +789,7 @@ INTR_FILTER IEEE80211_DEBUG opt_wlan.h IEEE80211_DEBUG_REFCNT opt_wlan.h IEEE80211_AMPDU_AGE opt_wlan.h +IEEE80211_SUPPORT_SUPERG opt_wlan.h IEEE80211_SUPPORT_TDMA opt_wlan.h # 802.11 TDMA support Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211.c Tue Mar 24 20:39:08 2009 (r190391) @@ -46,6 +46,9 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_regdomain.h> +#ifdef IEEE80211_SUPPORT_SUPERG +#include <net80211/ieee80211_superg.h> +#endif #include <net/bpf.h> @@ -264,6 +267,9 @@ ieee80211_ifattach(struct ieee80211com * ieee80211_node_attach(ic); ieee80211_power_attach(ic); ieee80211_proto_attach(ic); +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_superg_attach(ic); +#endif ieee80211_ht_attach(ic); ieee80211_scan_attach(ic); ieee80211_regdomain_attach(ic); @@ -306,6 +312,9 @@ ieee80211_ifdetach(struct ieee80211com * ieee80211_sysctl_detach(ic); ieee80211_regdomain_detach(ic); ieee80211_scan_detach(ic); +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_superg_detach(ic); +#endif ieee80211_ht_detach(ic); /* NB: must be called before ieee80211_node_detach */ ieee80211_proto_detach(ic); @@ -415,10 +424,6 @@ ieee80211_vap_setup(struct ieee80211com vap->iv_flags |= IEEE80211_F_WME; if (vap->iv_caps & IEEE80211_C_BURST) vap->iv_flags |= IEEE80211_F_BURST; - if (vap->iv_caps & IEEE80211_C_FF) - vap->iv_flags |= IEEE80211_F_FF; - if (vap->iv_caps & IEEE80211_C_TURBOP) - vap->iv_flags |= IEEE80211_F_TURBOP; /* NB: bg scanning only makes sense for station mode right now */ if (vap->iv_opmode == IEEE80211_M_STA && (vap->iv_caps & IEEE80211_C_BGSCAN)) @@ -445,6 +450,9 @@ ieee80211_vap_setup(struct ieee80211com ieee80211_node_vattach(vap); ieee80211_power_vattach(vap); ieee80211_proto_vattach(vap); +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_superg_vattach(vap); +#endif ieee80211_ht_vattach(vap); ieee80211_scan_vattach(vap); ieee80211_regdomain_vattach(vap); @@ -497,7 +505,9 @@ ieee80211_vap_attach(struct ieee80211vap IEEE80211_LOCK(ic); TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next); ieee80211_syncflag_locked(ic, IEEE80211_F_WME); +#ifdef IEEE80211_SUPPORT_SUPERG ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP); +#endif ieee80211_syncflag_locked(ic, IEEE80211_F_PCF); ieee80211_syncflag_locked(ic, IEEE80211_F_BURST); ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_HT); @@ -545,7 +555,9 @@ ieee80211_vap_detach(struct ieee80211vap TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next); ieee80211_syncflag_locked(ic, IEEE80211_F_WME); +#ifdef IEEE80211_SUPPORT_SUPERG ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP); +#endif ieee80211_syncflag_locked(ic, IEEE80211_F_PCF); ieee80211_syncflag_locked(ic, IEEE80211_F_BURST); ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_HT); @@ -562,6 +574,9 @@ ieee80211_vap_detach(struct ieee80211vap ieee80211_regdomain_vdetach(vap); ieee80211_scan_vdetach(vap); +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_superg_vdetach(vap); +#endif ieee80211_ht_vdetach(vap); /* NB: must be before ieee80211_node_vdetach */ ieee80211_proto_vdetach(vap); Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_adhoc.c Tue Mar 24 20:39:08 2009 (r190391) @@ -57,6 +57,9 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_adhoc.h> #include <net80211/ieee80211_input.h> +#ifdef IEEE80211_SUPPORT_SUPERG +#include <net80211/ieee80211_superg.h> +#endif #ifdef IEEE80211_SUPPORT_TDMA #include <net80211/ieee80211_tdma.h> #endif @@ -590,32 +593,13 @@ adhoc_input(struct ieee80211_node *ni, s m = ieee80211_decap_amsdu(ni, m); if (m == NULL) return IEEE80211_FC0_TYPE_DATA; - } else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF) && -#define FF_LLC_SIZE (sizeof(struct ether_header) + sizeof(struct llc)) - m->m_pkthdr.len >= 3*FF_LLC_SIZE) { - struct llc *llc; - - /* - * Check for fast-frame tunnel encapsulation. - */ - if (m->m_len < FF_LLC_SIZE && - (m = m_pullup(m, FF_LLC_SIZE)) == NULL) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, "fast-frame", - "%s", "m_pullup(llc) failed"); - vap->iv_stats.is_rx_tooshort++; + } else { +#ifdef IEEE80211_SUPPORT_SUPERG + m = ieee80211_decap_fastframe(vap, ni, m); + if (m == NULL) return IEEE80211_FC0_TYPE_DATA; - } - llc = (struct llc *)(mtod(m, uint8_t *) + - sizeof(struct ether_header)); - if (llc->llc_snap.ether_type == htons(ATH_FF_ETH_TYPE)) { - m_adj(m, FF_LLC_SIZE); - m = ieee80211_decap_fastframe(ni, m); - if (m == NULL) - return IEEE80211_FC0_TYPE_DATA; - } +#endif } -#undef FF_LLC_SIZE if (dir == IEEE80211_FC1_DIR_DSTODS && ni->ni_wdsvap != NULL) ieee80211_deliver_data(ni->ni_wdsvap, ni, m); else Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_hostap.c Tue Mar 24 20:39:08 2009 (r190391) @@ -57,6 +57,9 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_hostap.h> #include <net80211/ieee80211_input.h> +#ifdef IEEE80211_SUPPORT_SUPERG +#include <net80211/ieee80211_superg.h> +#endif #include <net80211/ieee80211_wds.h> #define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) @@ -752,32 +755,13 @@ hostap_input(struct ieee80211_node *ni, m = ieee80211_decap_amsdu(ni, m); if (m == NULL) return IEEE80211_FC0_TYPE_DATA; - } else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF) && -#define FF_LLC_SIZE (sizeof(struct ether_header) + sizeof(struct llc)) - m->m_pkthdr.len >= 3*FF_LLC_SIZE) { - struct llc *llc; - - /* - * Check for fast-frame tunnel encapsulation. - */ - if (m->m_len < FF_LLC_SIZE && - (m = m_pullup(m, FF_LLC_SIZE)) == NULL) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, "fast-frame", - "%s", "m_pullup(llc) failed"); - vap->iv_stats.is_rx_tooshort++; + } else { +#ifdef IEEE80211_SUPPORT_SUPERG + m = ieee80211_decap_fastframe(vap, ni, m); + if (m == NULL) return IEEE80211_FC0_TYPE_DATA; - } - llc = (struct llc *)(mtod(m, uint8_t *) + - sizeof(struct ether_header)); - if (llc->llc_snap.ether_type == htons(ATH_FF_ETH_TYPE)) { - m_adj(m, FF_LLC_SIZE); - m = ieee80211_decap_fastframe(ni, m); - if (m == NULL) - return IEEE80211_FC0_TYPE_DATA; - } +#endif } -#undef FF_LLC_SIZE if (dir == IEEE80211_FC1_DIR_DSTODS && ni->ni_wdsvap != NULL) ieee80211_deliver_data(ni->ni_wdsvap, ni, m); else @@ -1967,8 +1951,10 @@ hostap_recv_mgmt(struct ieee80211_node * wpa = frm; else if (iswmeinfo(frm)) wme = frm; +#ifdef IEEE80211_SUPPORT_SUPERG else if (isatherosoui(frm)) ath = frm; +#endif else if (vap->iv_flags_ext & IEEE80211_FEXT_HTCOMPAT) { if (ishtcapoui(frm) && htcap == NULL) htcap = frm; @@ -2106,6 +2092,7 @@ hostap_recv_mgmt(struct ieee80211_node * ni->ni_flags |= IEEE80211_NODE_QOS; } else ni->ni_flags &= ~IEEE80211_NODE_QOS; +#ifdef IEEE80211_SUPPORT_SUPERG if (ath != NULL) { setie(ath_ie, ath - sfrm); /* @@ -2113,6 +2100,7 @@ hostap_recv_mgmt(struct ieee80211_node * */ ieee80211_parse_ath(ni, ni->ni_ies.ath_ie); } else +#endif ni->ni_ath_flags = 0; #undef setie } else { Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_input.c Tue Mar 24 20:39:08 2009 (r190391) @@ -358,73 +358,6 @@ ieee80211_decap1(struct mbuf *m, int *fr } /* - * Decap the encapsulated frame pair and dispatch the first - * for delivery. The second frame is returned for delivery - * via the normal path. - */ -struct mbuf * -ieee80211_decap_fastframe(struct ieee80211_node *ni, struct mbuf *m) -{ -#define MS(x,f) (((x) & f) >> f##_S) - struct ieee80211vap *vap = ni->ni_vap; - uint32_t ath; - struct mbuf *n; - int framelen; - - m_copydata(m, 0, sizeof(uint32_t), (caddr_t) &ath); - if (MS(ath, ATH_FF_PROTO) != ATH_FF_PROTO_L2TUNNEL) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, "fast-frame", - "unsupport tunnel protocol, header 0x%x", ath); - vap->iv_stats.is_ff_badhdr++; - m_freem(m); - return NULL; - } - /* NB: skip header and alignment padding */ - m_adj(m, roundup(sizeof(uint32_t) - 2, 4) + 2); - - vap->iv_stats.is_ff_decap++; - - /* - * Decap the first frame, bust it apart from the - * second and deliver; then decap the second frame - * and return it to the caller for normal delivery. - */ - m = ieee80211_decap1(m, &framelen); - if (m == NULL) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, "fast-frame", "%s", "first decap failed"); - vap->iv_stats.is_ff_tooshort++; - return NULL; - } - n = m_split(m, framelen, M_NOWAIT); - if (n == NULL) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, "fast-frame", - "%s", "unable to split encapsulated frames"); - vap->iv_stats.is_ff_split++; - m_freem(m); /* NB: must reclaim */ - return NULL; - } - /* XXX not right for WDS */ - vap->iv_deliver_data(vap, ni, m); /* 1st of pair */ - - /* - * Decap second frame. - */ - m_adj(n, roundup2(framelen, 4) - framelen); /* padding */ - n = ieee80211_decap1(n, &framelen); - if (n == NULL) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, "fast-frame", "%s", "second decap failed"); - vap->iv_stats.is_ff_tooshort++; - } - /* XXX verify framelen against mbuf contents */ - return n; /* 2nd delivered by caller */ -#undef MS -} - -/* * Install received rate set information in the node's state block. */ int @@ -510,16 +443,6 @@ ieee80211_alloc_challenge(struct ieee802 return (ni->ni_challenge != NULL); } -void -ieee80211_parse_ath(struct ieee80211_node *ni, uint8_t *ie) -{ - const struct ieee80211_ath_ie *ath = - (const struct ieee80211_ath_ie *) ie; - - ni->ni_ath_flags = ath->ath_capability; - ni->ni_ath_defkeyix = LE_READ_2(&ath->ath_defkeyix); -} - /* * Parse a Beacon or ProbeResponse frame and return the * useful information in an ieee80211_scanparams structure. @@ -633,8 +556,10 @@ ieee80211_parse_beacon(struct ieee80211_ scan->wpa = frm; else if (iswmeparam(frm) || iswmeinfo(frm)) scan->wme = frm; +#ifdef IEEE80211_SUPPORT_SUPERG else if (isatherosoui(frm)) scan->ath = frm; +#endif #ifdef IEEE80211_SUPPORT_TDMA else if (istdmaoui(frm)) scan->tdma = frm; Modified: head/sys/net80211/ieee80211_input.h ============================================================================== --- head/sys/net80211/ieee80211_input.h Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_input.h Tue Mar 24 20:39:08 2009 (r190391) @@ -148,14 +148,11 @@ struct mbuf *ieee80211_defrag(struct iee struct mbuf *, int); struct mbuf *ieee80211_decap(struct ieee80211vap *, struct mbuf *, int); struct mbuf *ieee80211_decap1(struct mbuf *, int *); -struct mbuf *ieee80211_decap_fastframe(struct ieee80211_node *, - struct mbuf *); int ieee80211_setup_rates(struct ieee80211_node *ni, const uint8_t *rates, const uint8_t *xrates, int flags); void ieee80211_send_error(struct ieee80211_node *, const uint8_t mac[IEEE80211_ADDR_LEN], int subtype, int arg); int ieee80211_alloc_challenge(struct ieee80211_node *); -void ieee80211_parse_ath(struct ieee80211_node *, uint8_t *); int ieee80211_parse_beacon(struct ieee80211_node *, struct mbuf *, struct ieee80211_scanparams *); int ieee80211_parse_action(struct ieee80211_node *, struct mbuf *); Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_ioctl.c Tue Mar 24 20:39:08 2009 (r190391) @@ -584,21 +584,6 @@ ieee80211_ioctl_getmaccmd(struct ieee802 return (acl == NULL ? EINVAL : acl->iac_getioctl(vap, ireq)); } -/* - * Return the current ``state'' of an Atheros capbility. - * If associated in station mode report the negotiated - * setting. Otherwise report the current setting. - */ -static int -getathcap(struct ieee80211vap *vap, int cap) -{ - if (vap->iv_opmode == IEEE80211_M_STA && - vap->iv_state == IEEE80211_S_RUN) - return IEEE80211_ATH_CAP(vap, vap->iv_bss, cap) != 0; - else - return (vap->iv_flags & cap) != 0; -} - static __noinline int ieee80211_ioctl_getcurchan(struct ieee80211vap *vap, struct ieee80211req *ireq) { @@ -974,12 +959,6 @@ ieee80211_ioctl_get80211(struct ieee8021 case IEEE80211_IOC_PUREG: ireq->i_val = (vap->iv_flags & IEEE80211_F_PUREG) != 0; break; - case IEEE80211_IOC_FF: - ireq->i_val = getathcap(vap, IEEE80211_F_FF); - break; - case IEEE80211_IOC_TURBOP: - ireq->i_val = getathcap(vap, IEEE80211_F_TURBOP); - break; case IEEE80211_IOC_BGSCAN: ireq->i_val = (vap->iv_flags & IEEE80211_F_BGSCAN) != 0; break; @@ -2889,24 +2868,6 @@ ieee80211_ioctl_set80211(struct ieee8021 if (isvap11g(vap)) error = ENETRESET; break; - case IEEE80211_IOC_FF: - if (ireq->i_val) { - if ((vap->iv_caps & IEEE80211_C_FF) == 0) - return EOPNOTSUPP; - vap->iv_flags |= IEEE80211_F_FF; - } else - vap->iv_flags &= ~IEEE80211_F_FF; - error = ERESTART; - break; - case IEEE80211_IOC_TURBOP: - if (ireq->i_val) { - if ((vap->iv_caps & IEEE80211_C_TURBOP) == 0) - return EOPNOTSUPP; - vap->iv_flags |= IEEE80211_F_TURBOP; - } else - vap->iv_flags &= ~IEEE80211_F_TURBOP; - error = ENETRESET; - break; case IEEE80211_IOC_BGSCAN: if (ireq->i_val) { if ((vap->iv_caps & IEEE80211_C_BGSCAN) == 0) Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_node.c Tue Mar 24 20:39:08 2009 (r190391) @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_input.h> +#ifdef IEEE80211_SUPPORT_SUPERG +#include <net80211/ieee80211_superg.h> +#endif #ifdef IEEE80211_SUPPORT_TDMA #include <net80211/ieee80211_tdma.h> #endif @@ -754,8 +757,10 @@ ieee80211_sta_join(struct ieee80211vap * if (ieee80211_ies_init(&ni->ni_ies, se->se_ies.data, se->se_ies.len)) { ieee80211_ies_expand(&ni->ni_ies); +#ifdef IEEE80211_SUPPORT_SUPERG if (ni->ni_ies.ath_ie != NULL) ieee80211_parse_ath(ni, ni->ni_ies.ath_ie); +#endif if (ni->ni_ies.htcap_ie != NULL) ieee80211_parse_htcap(ni, ni->ni_ies.htcap_ie); if (ni->ni_ies.htinfo_ie != NULL) @@ -875,8 +880,10 @@ ieee80211_ies_expand(struct ieee80211_ie ies->wpa_ie = ie; else if (iswmeoui(ie)) ies->wme_ie = ie; +#ifdef IEEE80211_SUPPORT_SUPERG else if (isatherosoui(ie)) ies->ath_ie = ie; +#endif #ifdef IEEE80211_SUPPORT_TDMA else if (istdmaoui(ie)) ies->tdma_ie = ie; @@ -1173,8 +1180,10 @@ ieee80211_node_create_wds(struct ieee802 */ if (vap->iv_flags & IEEE80211_F_WME) ni->ni_flags |= IEEE80211_NODE_QOS; +#ifdef IEEE80211_SUPPORT_SUPERG if (vap->iv_flags & IEEE80211_F_FF) ni->ni_flags |= IEEE80211_NODE_FF; +#endif if ((ic->ic_htcaps & IEEE80211_HTC_HT) && (vap->iv_flags_ext & IEEE80211_FEXT_HT)) { /* @@ -1331,8 +1340,10 @@ ieee80211_fakeup_adhoc_node(struct ieee8 */ if (vap->iv_flags & IEEE80211_F_WME) ni->ni_flags |= IEEE80211_NODE_QOS; +#ifdef IEEE80211_SUPPORT_SUPERG if (vap->iv_flags & IEEE80211_F_FF) ni->ni_flags |= IEEE80211_NODE_FF; +#endif } node_setuptxparms(ni); if (ic->ic_newassoc != NULL) @@ -1366,8 +1377,10 @@ ieee80211_init_neighbor(struct ieee80211 ni->ni_flags |= IEEE80211_NODE_QOS; else ni->ni_flags &= ~IEEE80211_NODE_QOS; +#ifdef IEEE80211_SUPPORT_SUPERG if (ni->ni_ies.ath_ie != NULL) ieee80211_parse_ath(ni, ni->ni_ies.ath_ie); +#endif } /* NB: must be after ni_chan is setup */ Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_output.c Tue Mar 24 20:39:08 2009 (r190391) @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_regdomain.h> +#ifdef IEEE80211_SUPPORT_SUPERG +#include <net80211/ieee80211_superg.h> +#endif #ifdef IEEE80211_SUPPORT_TDMA #include <net80211/ieee80211_tdma.h> #endif @@ -62,9 +65,6 @@ __FBSDID("$FreeBSD$"); #define ETHER_HEADER_COPY(dst, src) \ memcpy(dst, src, sizeof(struct ether_header)) -static struct mbuf *ieee80211_encap_fastframe(struct ieee80211vap *, - struct mbuf *m1, const struct ether_header *eh1, - struct mbuf *m2, const struct ether_header *eh2); static int ieee80211_fragment(struct ieee80211vap *, struct mbuf *, u_int hdrsize, u_int ciphdrsize, u_int mtu); static void ieee80211_tx_mgt_cb(struct ieee80211_node *, void *, int); @@ -731,7 +731,7 @@ done: * Drivers and cipher modules assume we have done the necessary work * and fail rudely if they don't find the space they need. */ -static struct mbuf * +struct mbuf * ieee80211_mbuf_adjust(struct ieee80211vap *vap, int hdrsize, struct ieee80211_key *key, struct mbuf *m) { @@ -861,7 +861,7 @@ ieee80211_encap(struct ieee80211_node *n struct ieee80211_frame *wh; struct ieee80211_key *key; struct llc *llc; - int hdrsize, hdrspace, datalen, addqos, txfrag, isff, is4addr; + int hdrsize, hdrspace, datalen, addqos, txfrag, is4addr; /* * Copy existing Ethernet header to a safe place. The @@ -935,56 +935,7 @@ ieee80211_encap(struct ieee80211_node *n else hdrspace = hdrsize; - if ((isff = m->m_flags & M_FF) != 0) { - struct mbuf *m2; - struct ether_header eh2; - - /* - * Fast frame encapsulation. There must be two packets - * chained with m_nextpkt. We do header adjustment for - * each, add the tunnel encapsulation, and then concatenate - * the mbuf chains to form a single frame for transmission. - */ - m2 = m->m_nextpkt; - if (m2 == NULL) { - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: only one frame\n", __func__); - goto bad; - } - m->m_nextpkt = NULL; - /* - * Include fast frame headers in adjusting header - * layout; this allocates space according to what - * ieee80211_encap_fastframe will do. - */ - m = ieee80211_mbuf_adjust(vap, - hdrspace + sizeof(struct llc) + sizeof(uint32_t) + 2 + - sizeof(struct ether_header), - key, m); - if (m == NULL) { - /* NB: ieee80211_mbuf_adjust handles msgs+statistics */ - m_freem(m2); - goto bad; - } - /* - * Copy second frame's Ethernet header out of line - * and adjust for encapsulation headers. Note that - * we make room for padding in case there isn't room - * at the end of first frame. - */ - KASSERT(m2->m_len >= sizeof(eh2), ("no ethernet header!")); - ETHER_HEADER_COPY(&eh2, mtod(m2, caddr_t)); - m2 = ieee80211_mbuf_adjust(vap, - ATH_FF_MAX_HDR_PAD + sizeof(struct ether_header), - NULL, m2); - if (m2 == NULL) { - /* NB: ieee80211_mbuf_adjust handles msgs+statistics */ - goto bad; - } - m = ieee80211_encap_fastframe(vap, m, &eh, m2, &eh2); - if (m == NULL) - goto bad; - } else { + if (__predict_true((m->m_flags & M_FF) == 0)) { /* * Normal frame. */ @@ -1002,6 +953,12 @@ ieee80211_encap(struct ieee80211_node *n llc->llc_snap.org_code[1] = 0; llc->llc_snap.org_code[2] = 0; llc->llc_snap.ether_type = eh.ether_type; + } else { +#ifdef IEEE80211_SUPPORT_SUPERG + m = ieee80211_ff_encap(vap, m, hdrspace, key); + if (m == NULL) +#endif + goto bad; } datalen = m->m_pkthdr.len; /* NB: w/o 802.11 header */ @@ -1047,7 +1004,7 @@ ieee80211_encap(struct ieee80211_node *n case IEEE80211_M_WDS: /* NB: is4addr should always be true */ goto bad; } - if (m->m_flags & M_MORE_DATA) + if (m->m_flags & M_MORE_DATA) wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; if (addqos) { uint8_t *qos; @@ -1128,7 +1085,7 @@ ieee80211_encap(struct ieee80211_node *n txfrag = (m->m_pkthdr.len > vap->iv_fragthreshold && !IEEE80211_IS_MULTICAST(wh->i_addr1) && (vap->iv_caps & IEEE80211_C_TXFRAG) && - !isff); /* NB: don't fragment ff's */ + (m->m_flags & M_FF) == 0); /* NB: don't fragment ff's */ if (key != NULL) { /* * IEEE 802.1X: send EAPOL frames always in the clear. @@ -1175,135 +1132,6 @@ bad: } /* - * Do Ethernet-LLC encapsulation for each payload in a fast frame - * tunnel encapsulation. The frame is assumed to have an Ethernet - * header at the front that must be stripped before prepending the - * LLC followed by the Ethernet header passed in (with an Ethernet - * type that specifies the payload size). - */ -static struct mbuf * -ieee80211_encap1(struct ieee80211vap *vap, struct mbuf *m, - const struct ether_header *eh) -{ - struct llc *llc; - uint16_t payload; - - /* XXX optimize by combining m_adj+M_PREPEND */ - m_adj(m, sizeof(struct ether_header) - sizeof(struct llc)); - llc = mtod(m, struct llc *); - llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; - llc->llc_control = LLC_UI; - llc->llc_snap.org_code[0] = 0; - llc->llc_snap.org_code[1] = 0; - llc->llc_snap.org_code[2] = 0; - llc->llc_snap.ether_type = eh->ether_type; - payload = m->m_pkthdr.len; /* NB: w/o Ethernet header */ - - M_PREPEND(m, sizeof(struct ether_header), M_DONTWAIT); - if (m == NULL) { /* XXX cannot happen */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: no space for ether_header\n", __func__); - vap->iv_stats.is_tx_nobuf++; - return NULL; - } - ETHER_HEADER_COPY(mtod(m, void *), eh); - mtod(m, struct ether_header *)->ether_type = htons(payload); - return m; -} - -/* - * Do fast frame tunnel encapsulation. The two frames and - * Ethernet headers are supplied. The caller is assumed to - * have arrange for space in the mbuf chains for encapsulating - * headers (to avoid major mbuf fragmentation). - * - * The encapsulated frame is returned or NULL if there is a - * problem (should not happen). - */ -static struct mbuf * -ieee80211_encap_fastframe(struct ieee80211vap *vap, - struct mbuf *m1, const struct ether_header *eh1, - struct mbuf *m2, const struct ether_header *eh2) -{ - struct llc *llc; - struct mbuf *m; - int pad; - - /* - * First, each frame gets a standard encapsulation. - */ - m1 = ieee80211_encap1(vap, m1, eh1); - if (m1 == NULL) { - m_freem(m2); - return NULL; - } - m2 = ieee80211_encap1(vap, m2, eh2); - if (m2 == NULL) { - m_freem(m1); - return NULL; - } - - /* - * Pad leading frame to a 4-byte boundary. If there - * is space at the end of the first frame, put it - * there; otherwise prepend to the front of the second - * frame. We know doing the second will always work - * because we reserve space above. We prefer appending - * as this typically has better DMA alignment properties. - */ - for (m = m1; m->m_next != NULL; m = m->m_next) - ; - pad = roundup2(m1->m_pkthdr.len, 4) - m1->m_pkthdr.len; - if (pad) { - if (M_TRAILINGSPACE(m) < pad) { /* prepend to second */ - m2->m_data -= pad; - m2->m_len += pad; - m2->m_pkthdr.len += pad; - } else { /* append to first */ - m->m_len += pad; - m1->m_pkthdr.len += pad; - } - } - - /* - * Now, stick 'em together and prepend the tunnel headers; - * first the Atheros tunnel header (all zero for now) and - * then a special fast frame LLC. - * - * XXX optimize by prepending together - */ - m->m_next = m2; /* NB: last mbuf from above */ - m1->m_pkthdr.len += m2->m_pkthdr.len; - M_PREPEND(m1, sizeof(uint32_t)+2, M_DONTWAIT); - if (m1 == NULL) { /* XXX cannot happen */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: no space for tunnel header\n", __func__); - vap->iv_stats.is_tx_nobuf++; - return NULL; - } - memset(mtod(m1, void *), 0, sizeof(uint32_t)+2); - - M_PREPEND(m1, sizeof(struct llc), M_DONTWAIT); - if (m1 == NULL) { /* XXX cannot happen */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: no space for llc header\n", __func__); - vap->iv_stats.is_tx_nobuf++; - return NULL; - } - llc = mtod(m1, struct llc *); - llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; - llc->llc_control = LLC_UI; - llc->llc_snap.org_code[0] = ATH_FF_SNAP_ORGCODE_0; - llc->llc_snap.org_code[1] = ATH_FF_SNAP_ORGCODE_1; - llc->llc_snap.org_code[2] = ATH_FF_SNAP_ORGCODE_2; - llc->llc_snap.ether_type = htons(ATH_FF_ETH_TYPE); - - vap->iv_stats.is_ff_encap++; - - return m1; -} - -/* * Fragment the frame according to the specified mtu. * The size of the 802.11 header (w/o padding) is provided * so we don't need to recalculate it. We create a new @@ -1568,31 +1396,6 @@ ieee80211_add_wme_param(uint8_t *frm, st } #undef WME_OUI_BYTES -#define ATH_OUI_BYTES 0x00, 0x03, 0x7f -/* - * Add a WME information element to a frame. - */ -static uint8_t * -ieee80211_add_ath(uint8_t *frm, uint8_t caps, uint16_t defkeyix) -{ - static const struct ieee80211_ath_ie info = { - .ath_id = IEEE80211_ELEMID_VENDOR, - .ath_len = sizeof(struct ieee80211_ath_ie) - 2, - .ath_oui = { ATH_OUI_BYTES }, - .ath_oui_type = ATH_OUI_TYPE, - .ath_oui_subtype= ATH_OUI_SUBTYPE, - .ath_version = ATH_OUI_VERSION, - }; - struct ieee80211_ath_ie *ath = (struct ieee80211_ath_ie *) frm; - - memcpy(frm, &info, sizeof(info)); - ath->ath_capability = caps; - ath->ath_defkeyix[0] = (defkeyix & 0xff); - ath->ath_defkeyix[1] = ((defkeyix >> 8) & 0xff); - return frm + sizeof(info); -} -#undef ATH_OUI_BYTES - /* * Add an 11h Power Constraint element to a frame. */ @@ -1977,7 +1780,9 @@ ieee80211_send_mgmt(struct ieee80211_nod + sizeof(struct ieee80211_wme_info) + sizeof(struct ieee80211_ie_htcap) + 4 + sizeof(struct ieee80211_ie_htcap) +#ifdef IEEE80211_SUPPORT_SUPERG + sizeof(struct ieee80211_ath_ie) +#endif + (vap->iv_appie_wpa != NULL ? vap->iv_appie_wpa->ie_len : 0) + (vap->iv_appie_assocreq != NULL ? @@ -2046,6 +1851,7 @@ ieee80211_send_mgmt(struct ieee80211_nod ni->ni_ies.htcap_ie != NULL && ni->ni_ies.htcap_ie[0] == IEEE80211_ELEMID_VENDOR) frm = ieee80211_add_htcap_vendor(frm, ni); +#ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_F_ATHEROS)) frm = ieee80211_add_ath(frm, IEEE80211_ATH_CAP(vap, ni, IEEE80211_F_ATHEROS), @@ -2053,6 +1859,7 @@ ieee80211_send_mgmt(struct ieee80211_nod ni->ni_authmode != IEEE80211_AUTH_8021X && vap->iv_def_txkey != IEEE80211_KEYIX_NONE ? vap->iv_def_txkey : 0x7fff); +#endif /* IEEE80211_SUPPORT_SUPERG */ if (vap->iv_appie_assocreq != NULL) frm = add_appie(frm, vap->iv_appie_assocreq); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); @@ -2088,7 +1895,9 @@ ieee80211_send_mgmt(struct ieee80211_nod + sizeof(struct ieee80211_ie_htcap) + 4 + sizeof(struct ieee80211_ie_htinfo) + 4 + sizeof(struct ieee80211_wme_param) +#ifdef IEEE80211_SUPPORT_SUPERG + sizeof(struct ieee80211_ath_ie) +#endif + (vap->iv_appie_assocresp != NULL ? vap->iv_appie_assocresp->ie_len : 0) ); @@ -2123,10 +1932,12 @@ ieee80211_send_mgmt(struct ieee80211_nod frm = ieee80211_add_htcap_vendor(frm, ni); frm = ieee80211_add_htinfo_vendor(frm, ni); } +#ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_F_ATHEROS)) frm = ieee80211_add_ath(frm, IEEE80211_ATH_CAP(vap, ni, IEEE80211_F_ATHEROS), ni->ni_ath_defkeyix); +#endif /* IEEE80211_SUPPORT_SUPERG */ if (vap->iv_appie_assocresp != NULL) frm = add_appie(frm, vap->iv_appie_assocresp); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); @@ -2227,7 +2038,9 @@ ieee80211_alloc_proberesp(struct ieee802 + sizeof(struct ieee80211_wme_param) + 4 + sizeof(struct ieee80211_ie_htcap) + 4 + sizeof(struct ieee80211_ie_htinfo) +#ifdef IEEE80211_SUPPORT_SUPERG + sizeof(struct ieee80211_ath_ie) +#endif + (vap->iv_appie_proberesp != NULL ? vap->iv_appie_proberesp->ie_len : 0) ); @@ -2310,9 +2123,11 @@ ieee80211_alloc_proberesp(struct ieee802 frm = ieee80211_add_htcap_vendor(frm, bss); frm = ieee80211_add_htinfo_vendor(frm, bss); } +#ifdef IEEE80211_SUPPORT_SUPERG if (bss->ni_ies.ath_ie != NULL && legacy != IEEE80211_SEND_LEGACY_11B) frm = ieee80211_add_ath(frm, bss->ni_ath_flags, bss->ni_ath_defkeyix); +#endif if (vap->iv_appie_proberesp != NULL) frm = add_appie(frm, vap->iv_appie_proberesp); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_proto.c Tue Mar 24 20:39:08 2009 (r190391) @@ -1316,39 +1316,6 @@ ieee80211_resume_all(struct ieee80211com IEEE80211_UNLOCK(ic); } -/* - * Switch between turbo and non-turbo operating modes. - * Use the specified channel flags to locate the new - * channel, update 802.11 state, and then call back into - * the driver to effect the change. - */ -void -ieee80211_dturbo_switch(struct ieee80211vap *vap, int newflags) -{ - struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_channel *chan; - - chan = ieee80211_find_channel(ic, ic->ic_bsschan->ic_freq, newflags); - if (chan == NULL) { /* XXX should not happen */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: no channel with freq %u flags 0x%x\n", - __func__, ic->ic_bsschan->ic_freq, newflags); - return; - } - - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: %s -> %s (freq %u flags 0x%x)\n", __func__, - ieee80211_phymode_name[ieee80211_chan2mode(ic->ic_bsschan)], - ieee80211_phymode_name[ieee80211_chan2mode(chan)], - chan->ic_freq, chan->ic_flags); - - ic->ic_bsschan = chan; - ic->ic_prevchan = ic->ic_curchan; - ic->ic_curchan = chan; - ic->ic_set_channel(ic); - /* NB: do not need to reset ERP state 'cuz we're in sta mode */ -} - void ieee80211_beacon_miss(struct ieee80211com *ic) { Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_proto.h Tue Mar 24 20:39:08 2009 (r190391) @@ -74,6 +74,8 @@ int ieee80211_output(struct ifnet *, str void ieee80211_start(struct ifnet *); int ieee80211_send_nulldata(struct ieee80211_node *); int ieee80211_classify(struct ieee80211_node *, struct mbuf *m); +struct mbuf *ieee80211_mbuf_adjust(struct ieee80211vap *, int, + struct ieee80211_key *, struct mbuf *); struct mbuf *ieee80211_encap(struct ieee80211_node *, struct mbuf *); int ieee80211_send_mgmt(struct ieee80211_node *, int, int); struct ieee80211_appie; Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Tue Mar 24 20:00:28 2009 (r190390) +++ head/sys/net80211/ieee80211_sta.c Tue Mar 24 20:39:08 2009 (r190391) @@ -57,6 +57,9 @@ __FBSDID("$FreeBSD$"); #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_sta.h> #include <net80211/ieee80211_input.h> +#ifdef IEEE80211_SUPPORT_SUPERG +#include <net80211/ieee80211_superg.h> +#endif #define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) @@ -129,6 +132,7 @@ sta_beacon_miss(struct ieee80211vap *vap vap->iv_bmiss_count = 0; vap->iv_stats.is_beacon_miss++; if (vap->iv_roaming == IEEE80211_ROAMING_AUTO) { +#ifdef IEEE80211_SUPPORT_SUPERG /* * If we receive a beacon miss interrupt when using * dynamic turbo, attempt to switch modes before @@ -137,6 +141,7 @@ sta_beacon_miss(struct ieee80211vap *vap if (IEEE80211_ATH_CAP(vap, vap->iv_bss, IEEE80211_NODE_TURBOP)) ieee80211_dturbo_switch(vap, ic->ic_bsschan->ic_flags ^ IEEE80211_CHAN_TURBO); +#endif /* * Try to reassociate before scanning for a new ap. */ @@ -795,32 +800,13 @@ sta_input(struct ieee80211_node *ni, str m = ieee80211_decap_amsdu(ni, m); if (m == NULL) return IEEE80211_FC0_TYPE_DATA; - } else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF) && -#define FF_LLC_SIZE (sizeof(struct ether_header) + sizeof(struct llc)) - m->m_pkthdr.len >= 3*FF_LLC_SIZE) { - struct llc *llc; - - /* - * Check for fast-frame tunnel encapsulation. - */ - if (m->m_len < FF_LLC_SIZE && - (m = m_pullup(m, FF_LLC_SIZE)) == NULL) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - ni->ni_macaddr, "fast-frame", - "%s", "m_pullup(llc) failed"); - vap->iv_stats.is_rx_tooshort++; + } else { +#ifdef IEEE80211_SUPPORT_SUPERG + m = ieee80211_decap_fastframe(vap, ni, m); + if (m == NULL) return IEEE80211_FC0_TYPE_DATA; - } - llc = (struct llc *)(mtod(m, uint8_t *) + - sizeof(struct ether_header)); - if (llc->llc_snap.ether_type == htons(ATH_FF_ETH_TYPE)) { - m_adj(m, FF_LLC_SIZE); - m = ieee80211_decap_fastframe(ni, m); - if (m == NULL) - return IEEE80211_FC0_TYPE_DATA; - } +#endif } -#undef FF_LLC_SIZE ieee80211_deliver_data(vap, ni, m); return IEEE80211_FC0_TYPE_DATA; @@ -1094,51 +1080,6 @@ ieee80211_parse_wmeparams(struct ieee802 #undef MS } -static int -ieee80211_parse_athparams(struct ieee80211_node *ni, uint8_t *frm, - const struct ieee80211_frame *wh) -{ - struct ieee80211vap *vap = ni->ni_vap; - const struct ieee80211_ath_ie *ath; - u_int len = frm[1]; - int capschanged; - uint16_t defkeyix; - - if (len < sizeof(struct ieee80211_ath_ie)-2) { - IEEE80211_DISCARD_IE(vap, - IEEE80211_MSG_ELEMID | IEEE80211_MSG_SUPERG, - wh, "Atheros", "too short, len %u", len); - return -1; - } - ath = (const struct ieee80211_ath_ie *)frm; - capschanged = (ni->ni_ath_flags != ath->ath_capability); - defkeyix = LE_READ_2(ath->ath_defkeyix); - if (capschanged || defkeyix != ni->ni_ath_defkeyix) { - ni->ni_ath_flags = ath->ath_capability; - ni->ni_ath_defkeyix = defkeyix; - IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni, - "ath ie change: new caps 0x%x defkeyix 0x%x", - ni->ni_ath_flags, ni->ni_ath_defkeyix); - } - if (IEEE80211_ATH_CAP(vap, ni, ATHEROS_CAP_TURBO_PRIME)) { - uint16_t curflags, newflags; - *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903242039.n2OKd8LC056178>