1*10266SQuaker.Fang@Sun.COM /* 2*10266SQuaker.Fang@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 3*10266SQuaker.Fang@Sun.COM * Use is subject to license terms. 4*10266SQuaker.Fang@Sun.COM */ 5*10266SQuaker.Fang@Sun.COM 6*10266SQuaker.Fang@Sun.COM /* 7*10266SQuaker.Fang@Sun.COM * Copyright (c) 2007 Sam Leffler, Errno Consulting 8*10266SQuaker.Fang@Sun.COM * All rights reserved. 9*10266SQuaker.Fang@Sun.COM * 10*10266SQuaker.Fang@Sun.COM * Redistribution and use in source and binary forms, with or without 11*10266SQuaker.Fang@Sun.COM * modification, are permitted provided that the following conditions 12*10266SQuaker.Fang@Sun.COM * are met: 13*10266SQuaker.Fang@Sun.COM * 1. Redistributions of source code must retain the above copyright 14*10266SQuaker.Fang@Sun.COM * notice, this list of conditions and the following disclaimer. 15*10266SQuaker.Fang@Sun.COM * 2. Redistributions in binary form must reproduce the above copyright 16*10266SQuaker.Fang@Sun.COM * notice, this list of conditions and the following disclaimer in the 17*10266SQuaker.Fang@Sun.COM * documentation and/or other materials provided with the distribution. 18*10266SQuaker.Fang@Sun.COM * 19*10266SQuaker.Fang@Sun.COM * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20*10266SQuaker.Fang@Sun.COM * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21*10266SQuaker.Fang@Sun.COM * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22*10266SQuaker.Fang@Sun.COM * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23*10266SQuaker.Fang@Sun.COM * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24*10266SQuaker.Fang@Sun.COM * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25*10266SQuaker.Fang@Sun.COM * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26*10266SQuaker.Fang@Sun.COM * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27*10266SQuaker.Fang@Sun.COM * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28*10266SQuaker.Fang@Sun.COM * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29*10266SQuaker.Fang@Sun.COM */ 30*10266SQuaker.Fang@Sun.COM 31*10266SQuaker.Fang@Sun.COM #ifndef _SYS_NET80211_HT_H 32*10266SQuaker.Fang@Sun.COM #define _SYS_NET80211_HT_H 33*10266SQuaker.Fang@Sun.COM 34*10266SQuaker.Fang@Sun.COM /* 35*10266SQuaker.Fang@Sun.COM * 802.11n protocol implementation definitions. 36*10266SQuaker.Fang@Sun.COM */ 37*10266SQuaker.Fang@Sun.COM 38*10266SQuaker.Fang@Sun.COM #ifdef __cplusplus 39*10266SQuaker.Fang@Sun.COM extern "C" { 40*10266SQuaker.Fang@Sun.COM #endif 41*10266SQuaker.Fang@Sun.COM 42*10266SQuaker.Fang@Sun.COM struct ieee80211com; 43*10266SQuaker.Fang@Sun.COM struct ieee80211_node; 44*10266SQuaker.Fang@Sun.COM struct ieee80211_channel; 45*10266SQuaker.Fang@Sun.COM 46*10266SQuaker.Fang@Sun.COM #define IEEE80211_AGGR_BAWMAX 64 /* max block ack window size */ 47*10266SQuaker.Fang@Sun.COM /* threshold for aging overlapping non-HT bss */ 48*10266SQuaker.Fang@Sun.COM #define IEEE80211_NONHT_PRESENT_AGE (60*1000) /* msec */ 49*10266SQuaker.Fang@Sun.COM 50*10266SQuaker.Fang@Sun.COM #define M_AMPDU 0x8000 /* A-MPDU processing done */ 51*10266SQuaker.Fang@Sun.COM #define M_WEP 0x4000 /* WEP done by hardware */ 52*10266SQuaker.Fang@Sun.COM #define M_80211_RX (M_AMPDU | M_WEP) 53*10266SQuaker.Fang@Sun.COM 54*10266SQuaker.Fang@Sun.COM typedef uint16_t ieee80211_seq; 55*10266SQuaker.Fang@Sun.COM 56*10266SQuaker.Fang@Sun.COM struct ieee80211_tx_ampdu { 57*10266SQuaker.Fang@Sun.COM ushort_t txa_flags; 58*10266SQuaker.Fang@Sun.COM #define IEEE80211_AGGR_IMMEDIATE 0x0001 /* BA policy */ 59*10266SQuaker.Fang@Sun.COM #define IEEE80211_AGGR_XCHGPEND 0x0002 /* ADDBA response pending */ 60*10266SQuaker.Fang@Sun.COM #define IEEE80211_AGGR_RUNNING 0x0004 /* ADDBA response received */ 61*10266SQuaker.Fang@Sun.COM #define IEEE80211_AGGR_SETUP 0x0008 /* deferred state setup */ 62*10266SQuaker.Fang@Sun.COM #define IEEE80211_AGGR_NAK 0x0010 /* peer NAK'd ADDBA request */ 63*10266SQuaker.Fang@Sun.COM uint8_t txa_ac; 64*10266SQuaker.Fang@Sun.COM uint8_t txa_token; /* dialog token */ 65*10266SQuaker.Fang@Sun.COM int txa_qbytes; /* data queued (bytes) */ 66*10266SQuaker.Fang@Sun.COM short txa_qframes; /* data queued (frames) */ 67*10266SQuaker.Fang@Sun.COM ieee80211_seq txa_seqstart; 68*10266SQuaker.Fang@Sun.COM ieee80211_seq txa_start; 69*10266SQuaker.Fang@Sun.COM uint16_t txa_wnd; /* BA window size */ 70*10266SQuaker.Fang@Sun.COM uint8_t txa_attempts; /* # setup attempts */ 71*10266SQuaker.Fang@Sun.COM clock_t txa_lastrequest; /* time of last ADDBA request */ 72*10266SQuaker.Fang@Sun.COM timeout_id_t txa_timer; 73*10266SQuaker.Fang@Sun.COM }; 74*10266SQuaker.Fang@Sun.COM 75*10266SQuaker.Fang@Sun.COM /* return non-zero if AMPDU tx for the TID is running */ 76*10266SQuaker.Fang@Sun.COM #define IEEE80211_AMPDU_RUNNING(tap) \ 77*10266SQuaker.Fang@Sun.COM (((tap)->txa_flags & IEEE80211_AGGR_RUNNING) != 0) 78*10266SQuaker.Fang@Sun.COM 79*10266SQuaker.Fang@Sun.COM /* return non-zero if AMPDU tx for the TID is running or started */ 80*10266SQuaker.Fang@Sun.COM #define IEEE80211_AMPDU_REQUESTED(tap) \ 81*10266SQuaker.Fang@Sun.COM (((tap)->txa_flags & (IEEE80211_AGGR_RUNNING | \ 82*10266SQuaker.Fang@Sun.COM IEEE80211_AGGR_XCHGPEND | IEEE80211_AGGR_NAK)) != 0) 83*10266SQuaker.Fang@Sun.COM 84*10266SQuaker.Fang@Sun.COM struct ieee80211_rx_ampdu { 85*10266SQuaker.Fang@Sun.COM int rxa_flags; 86*10266SQuaker.Fang@Sun.COM int rxa_qbytes; /* data queued (bytes) */ 87*10266SQuaker.Fang@Sun.COM short rxa_qframes; /* data queued (frames) */ 88*10266SQuaker.Fang@Sun.COM ieee80211_seq rxa_seqstart; 89*10266SQuaker.Fang@Sun.COM ieee80211_seq rxa_start; /* start of current BA window */ 90*10266SQuaker.Fang@Sun.COM uint16_t rxa_wnd; /* BA window size */ 91*10266SQuaker.Fang@Sun.COM clock_t rxa_age; /* age of oldest frame in window */ 92*10266SQuaker.Fang@Sun.COM int rxa_nframes; /* frames since ADDBA */ 93*10266SQuaker.Fang@Sun.COM mblk_t *rxa_m[IEEE80211_AGGR_BAWMAX]; 94*10266SQuaker.Fang@Sun.COM }; 95*10266SQuaker.Fang@Sun.COM 96*10266SQuaker.Fang@Sun.COM void ieee80211_ht_attach(struct ieee80211com *); 97*10266SQuaker.Fang@Sun.COM void ieee80211_ht_detach(struct ieee80211com *); 98*10266SQuaker.Fang@Sun.COM 99*10266SQuaker.Fang@Sun.COM void ieee80211_ht_announce(struct ieee80211com *); 100*10266SQuaker.Fang@Sun.COM 101*10266SQuaker.Fang@Sun.COM extern const int ieee80211_htrates[16]; 102*10266SQuaker.Fang@Sun.COM const struct ieee80211_htrateset *ieee80211_get_suphtrates( 103*10266SQuaker.Fang@Sun.COM struct ieee80211com *, const struct ieee80211_channel *); 104*10266SQuaker.Fang@Sun.COM 105*10266SQuaker.Fang@Sun.COM int ieee80211_setup_htrates(struct ieee80211_node *, 106*10266SQuaker.Fang@Sun.COM const uint8_t *htcap, int flags); 107*10266SQuaker.Fang@Sun.COM void ieee80211_setup_basic_htrates(struct ieee80211_node *, 108*10266SQuaker.Fang@Sun.COM const uint8_t *htinfo); 109*10266SQuaker.Fang@Sun.COM 110*10266SQuaker.Fang@Sun.COM mblk_t *ieee80211_decap_amsdu(struct ieee80211_node *, mblk_t *); 111*10266SQuaker.Fang@Sun.COM 112*10266SQuaker.Fang@Sun.COM int ieee80211_ampdu_reorder(struct ieee80211_node *, mblk_t *); 113*10266SQuaker.Fang@Sun.COM void ieee80211_recv_bar(struct ieee80211_node *, mblk_t *); 114*10266SQuaker.Fang@Sun.COM void ieee80211_ht_node_init(struct ieee80211_node *, const uint8_t *); 115*10266SQuaker.Fang@Sun.COM void ieee80211_ht_node_cleanup(struct ieee80211_node *); 116*10266SQuaker.Fang@Sun.COM struct ieee80211_channel *ieee80211_ht_adjust_channel(struct ieee80211com *, 117*10266SQuaker.Fang@Sun.COM struct ieee80211_channel *, int); 118*10266SQuaker.Fang@Sun.COM 119*10266SQuaker.Fang@Sun.COM void ieee80211_ht_wds_init(struct ieee80211_node *); 120*10266SQuaker.Fang@Sun.COM void ieee80211_ht_node_join(struct ieee80211_node *); 121*10266SQuaker.Fang@Sun.COM void ieee80211_ht_node_leave(struct ieee80211_node *); 122*10266SQuaker.Fang@Sun.COM void ieee80211_htinfo_update(struct ieee80211com *, int protmode); 123*10266SQuaker.Fang@Sun.COM void ieee80211_ht_timeout(struct ieee80211com *); 124*10266SQuaker.Fang@Sun.COM void ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *); 125*10266SQuaker.Fang@Sun.COM void ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *); 126*10266SQuaker.Fang@Sun.COM void ieee80211_recv_action(struct ieee80211_node *, 127*10266SQuaker.Fang@Sun.COM const uint8_t *, const uint8_t *); 128*10266SQuaker.Fang@Sun.COM int ieee80211_ampdu_request(struct ieee80211_node *, 129*10266SQuaker.Fang@Sun.COM struct ieee80211_tx_ampdu *); 130*10266SQuaker.Fang@Sun.COM void ieee80211_ampdu_stop(struct ieee80211_node *, 131*10266SQuaker.Fang@Sun.COM struct ieee80211_tx_ampdu *); 132*10266SQuaker.Fang@Sun.COM int ieee80211_send_bar(struct ieee80211_node *, 133*10266SQuaker.Fang@Sun.COM const struct ieee80211_tx_ampdu *); 134*10266SQuaker.Fang@Sun.COM int ieee80211_send_action(struct ieee80211_node *, int, int, uint16_t [4]); 135*10266SQuaker.Fang@Sun.COM 136*10266SQuaker.Fang@Sun.COM uint8_t *ieee80211_add_htcap(uint8_t *, struct ieee80211_node *); 137*10266SQuaker.Fang@Sun.COM uint8_t *ieee80211_add_htcap_vendor(uint8_t *, struct ieee80211_node *); 138*10266SQuaker.Fang@Sun.COM uint8_t *ieee80211_add_htinfo(uint8_t *, struct ieee80211_node *); 139*10266SQuaker.Fang@Sun.COM uint8_t *ieee80211_add_htinfo_vendor(uint8_t *, struct ieee80211_node *); 140*10266SQuaker.Fang@Sun.COM 141*10266SQuaker.Fang@Sun.COM struct ieee80211_beacon_offsets; 142*10266SQuaker.Fang@Sun.COM void ieee80211_ht_update_beacon(struct ieee80211com *, 143*10266SQuaker.Fang@Sun.COM struct ieee80211_beacon_offsets *); 144*10266SQuaker.Fang@Sun.COM 145*10266SQuaker.Fang@Sun.COM #ifdef __cplusplus 146*10266SQuaker.Fang@Sun.COM } 147*10266SQuaker.Fang@Sun.COM #endif 148*10266SQuaker.Fang@Sun.COM 149*10266SQuaker.Fang@Sun.COM #endif /* _SYS_NET80211_HT_H */ 150