2 * Copyright (c) 2009 Sam Leffler, Errno Consulting
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * $FreeBSD: head/sys/net80211/ieee80211_superg.h 191753 2009-05-02 20:16:55Z sam $
28 #ifndef _NET80211_IEEE80211_SUPERG_H_
29 #define _NET80211_IEEE80211_SUPERG_H_
32 * Atheros' 802.11 SuperG protocol support.
36 * Atheros advanced capability information element.
38 struct ieee80211_ath_ie {
39 uint8_t ath_id; /* IEEE80211_ELEMID_VENDOR */
40 uint8_t ath_len; /* length in bytes */
41 uint8_t ath_oui[3]; /* ATH_OUI */
42 uint8_t ath_oui_type; /* ATH_OUI_TYPE */
43 uint8_t ath_oui_subtype; /* ATH_OUI_SUBTYPE */
44 uint8_t ath_version; /* spec revision */
45 uint8_t ath_capability; /* capability info */
46 #define ATHEROS_CAP_TURBO_PRIME 0x01 /* dynamic turbo--aka Turbo' */
47 #define ATHEROS_CAP_COMPRESSION 0x02 /* data compression */
48 #define ATHEROS_CAP_FAST_FRAME 0x04 /* fast (jumbo) frames */
49 #define ATHEROS_CAP_XR 0x08 /* Xtended Range support */
50 #define ATHEROS_CAP_AR 0x10 /* Advanded Radar support */
51 #define ATHEROS_CAP_BURST 0x20 /* Bursting - not negotiated */
52 #define ATHEROS_CAP_WME 0x40 /* CWMin tuning */
53 #define ATHEROS_CAP_BOOST 0x80 /* use turbo/!turbo mode */
54 uint8_t ath_defkeyix[2];
57 #define ATH_OUI_VERSION 0x00
58 #define ATH_OUI_SUBTYPE 0x01
61 struct ieee80211_stageq {
62 struct mbuf *head; /* frames linked w/ m_nextpkt */
63 struct mbuf *tail; /* last frame in queue */
64 int depth; /* # items on head */
67 struct ieee80211_superg {
68 /* fast-frames staging q */
69 struct ieee80211_stageq ff_stageq[WME_NUM_AC];
70 int ff_stageqdepth; /* cumulative depth */
73 void ieee80211_superg_attach(struct ieee80211com *);
74 void ieee80211_superg_detach(struct ieee80211com *);
75 void ieee80211_superg_vattach(struct ieee80211vap *);
76 void ieee80211_superg_vdetach(struct ieee80211vap *);
78 uint8_t *ieee80211_add_ath(uint8_t *, uint8_t, ieee80211_keyix);
79 uint8_t *ieee80211_add_athcaps(uint8_t *, const struct ieee80211_node *);
80 void ieee80211_parse_ath(struct ieee80211_node *, uint8_t *);
81 int ieee80211_parse_athparams(struct ieee80211_node *, uint8_t *,
82 const struct ieee80211_frame *);
84 void ieee80211_ff_node_init(struct ieee80211_node *);
85 void ieee80211_ff_node_cleanup(struct ieee80211_node *);
87 struct mbuf *ieee80211_ff_check(struct ieee80211_node *, struct mbuf *);
88 void ieee80211_ff_age(struct ieee80211com *, struct ieee80211_stageq *,
92 ieee80211_ff_flush(struct ieee80211com *ic, int ac)
94 struct ieee80211_superg *sg = ic->ic_superg;
96 if (sg != NULL && sg->ff_stageq[ac].depth)
97 ieee80211_ff_age(ic, &sg->ff_stageq[ac], 0x7fffffff);
101 ieee80211_ff_age_all(struct ieee80211com *ic, int quanta)
103 struct ieee80211_superg *sg = ic->ic_superg;
105 if (sg != NULL && sg->ff_stageqdepth) {
106 if (sg->ff_stageq[WME_AC_VO].depth)
107 ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VO], quanta);
108 if (sg->ff_stageq[WME_AC_VI].depth)
109 ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VI], quanta);
110 if (sg->ff_stageq[WME_AC_BE].depth)
111 ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BE], quanta);
112 if (sg->ff_stageq[WME_AC_BK].depth)
113 ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BK], quanta);
117 struct mbuf *ieee80211_ff_encap(struct ieee80211vap *, struct mbuf *,
118 int, struct ieee80211_key *);
120 struct mbuf *ieee80211_ff_decap(struct ieee80211_node *, struct mbuf *);
122 static __inline struct mbuf *
123 ieee80211_decap_fastframe(struct ieee80211vap *vap, struct ieee80211_node *ni,
126 return IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF) ?
127 ieee80211_ff_decap(ni, m) : m;
130 #endif /* _NET80211_IEEE80211_SUPERG_H_ */