diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2016-02-05 19:11:32 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2016-02-05 19:11:32 +0000 |
commit | d1ae35b486f00dc8b5c83c9f9ad2760e1e1e7e4c (patch) | |
tree | 6159d38e869e4b6d2d44711bc6f71b2f713bae2f | |
parent | f0222765dead62a3b76556c806f197aacae4a46c (diff) |
Define EDCA tables for 11n mode. Per 802.11-2012 they are the same as
the tables for 11a/11g modes.
Add a function to append a Microsoft WME parameter element to a frame,
using EDCA tables to construct the parameter records. Some 11n AP's I have
observed provide this element.
None of this code is used yet, so no functional change. I wrote this while
debugging BlockAck and then realized it was only needed for hostap mode.
Once we support 11n in hostap mode and send A-MPDUs, this code will be needed.
-rw-r--r-- | sys/net80211/ieee80211_output.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 911e96b6d06..7659106ee76 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_output.c,v 1.109 2016/02/05 16:07:57 stsp Exp $ */ +/* $OpenBSD: ieee80211_output.c,v 1.110 2016/02/05 19:11:31 stsp Exp $ */ /* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */ /*- @@ -94,6 +94,9 @@ struct mbuf *ieee80211_get_addba_resp(struct ieee80211com *, struct mbuf *ieee80211_get_delba(struct ieee80211com *, struct ieee80211_node *, u_int8_t, u_int8_t, u_int16_t); uint8_t *ieee80211_add_wme_info(uint8_t *, struct ieee80211com *); +#ifndef IEEE80211_STA_ONLY +uint8_t *ieee80211_add_wme_param(uint8_t *, struct ieee80211com *); +#endif struct mbuf *ieee80211_get_sa_query(struct ieee80211com *, struct ieee80211_node *, u_int8_t); struct mbuf *ieee80211_get_action(struct ieee80211com *, @@ -270,6 +273,7 @@ ieee80211_mgmt_output(struct ifnet *ifp, struct ieee80211_node *ni, * 11A 15 1023 * 11B 31 1023 * 11G 15* 1023 (*) aCWmin(1) + * 11N 15 1023 */ #if 0 static const struct ieee80211_edca_ac_params @@ -292,6 +296,12 @@ static const struct ieee80211_edca_ac_params [EDCA_AC_VI] = { 3, 4, 2, 94 }, [EDCA_AC_VO] = { 2, 3, 2, 47 } }, + [IEEE80211_MODE_11N] = { + [EDCA_AC_BK] = { 4, 10, 7, 0 }, + [EDCA_AC_BE] = { 4, 10, 3, 0 }, + [EDCA_AC_VI] = { 3, 4, 2, 94 }, + [EDCA_AC_VO] = { 2, 3, 2, 47 } + }, }; #endif @@ -316,6 +326,12 @@ static const struct ieee80211_edca_ac_params [EDCA_AC_VI] = { 3, 4, 1, 94 }, [EDCA_AC_VO] = { 2, 3, 1, 47 } }, + [IEEE80211_MODE_11N] = { + [EDCA_AC_BK] = { 4, 10, 7, 0 }, + [EDCA_AC_BE] = { 4, 6, 3, 0 }, + [EDCA_AC_VI] = { 3, 4, 1, 94 }, + [EDCA_AC_VO] = { 2, 3, 1, 47 } + }, }; #endif /* IEEE80211_STA_ONLY */ @@ -832,6 +848,42 @@ ieee80211_add_wme_info(uint8_t *frm, struct ieee80211com *ic) return frm; } + +#ifndef IEEE80211_STA_ONLY +/* + * Add a Wifi-Alliance WMM (aka WME) parameter element to a frame. + */ +uint8_t * +ieee80211_add_wme_param(uint8_t *frm, struct ieee80211com *ic) +{ + const struct ieee80211_edca_ac_params *edca; + int aci; + + *frm++ = IEEE80211_ELEMID_VENDOR; + *frm++ = 24; + memcpy(frm, MICROSOFT_OUI, 3); frm += 3; + *frm++ = 2; /* OUI type */ + *frm++ = 1; /* OUI subtype */ + *frm++ = 1; /* version */ + *frm++ = 0; /* info */ + *frm++ = 0; /* reserved */ + + /* setup AC Parameter Records */ + edca = ieee80211_qap_edca_table[ic->ic_curmode]; + for (aci = 0; aci < EDCA_NUM_AC; aci++) { + const struct ieee80211_edca_ac_params *ac = &edca[aci]; + + *frm++ = (aci << 5) | ((ac->ac_acm & 0x1) << 4) | + (ac->ac_aifsn & 0xf); + *frm++ = (ac->ac_ecwmax << 4) | + (ac->ac_ecwmin & 0xf); + LE_WRITE_2(frm, ac->ac_txoplimit); frm += 2; + } + + return frm; +} +#endif + /* * Add an RSN element to a frame (see 802.11-2012 8.4.2.27) */ |