ieee80211_ht.h revision 172211
1/*- 2 * Copyright (c) 2007 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 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. 13 * 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. 24 * 25 * $FreeBSD: head/sys/net80211/ieee80211_ht.h 172211 2007-09-17 19:07:24Z sam $ 26 */ 27#ifndef _NET80211_IEEE80211_HT_H_ 28#define _NET80211_IEEE80211_HT_H_ 29 30/* 31 * 802.11n protocol implementation definitions. 32 */ 33 34#define IEEE80211_SEND_ACTION(_ni,_cat, _act, _args) \ 35 ((*(_ic)->ic_send_action)(_ni, _cat, _act, _args)) 36 37#define IEEE80211_AGGR_BAWMAX 64 /* max block ack window size */ 38 39typedef uint16_t ieee80211_seq; 40 41struct ieee80211_tx_ampdu { 42 u_short txa_flags; 43#define IEEE80211_AGGR_IMMEDIATE 0x0001 /* BA policy */ 44#define IEEE80211_AGGR_XCHGPEND 0x0002 /* ADDBA response pending */ 45#define IEEE80211_AGGR_RUNNING 0x0004 /* ADDBA response received */ 46#define IEEE80211_AGGR_SETUP 0x0008 /* deferred state setup */ 47 uint8_t txa_ac; 48 uint8_t txa_token; /* dialog token */ 49 int txa_qbytes; /* data queued (bytes) */ 50 short txa_qframes; /* data queued (frames) */ 51 ieee80211_seq txa_seqstart; 52 ieee80211_seq txa_start; 53 uint16_t txa_wnd; /* BA window size */ 54 uint8_t txa_attempts; /* # setup attempts */ 55 int txa_lastrequest;/* time of last ADDBA request */ 56 struct ifqueue txa_q; /* packet queue */ 57 struct callout txa_timer; 58}; 59 60/* return non-zero if AMPDU tx for the TID is running */ 61#define IEEE80211_AMPDU_RUNNING(tap) \ 62 (((tap)->txa_flags & IEEE80211_AGGR_RUNNING) != 0) 63 64/* return non-zero if AMPDU tx for the TID is running or started */ 65#define IEEE80211_AMPDU_REQUESTED(tap) \ 66 (((tap)->txa_flags & \ 67 (IEEE80211_AGGR_RUNNING|IEEE80211_AGGR_XCHGPEND)) != 0) 68 69struct ieee80211_rx_ampdu { 70 int rxa_flags; 71 int rxa_qbytes; /* data queued (bytes) */ 72 short rxa_qframes; /* data queued (frames) */ 73 ieee80211_seq rxa_seqstart; 74 ieee80211_seq rxa_start; /* start of current BA window */ 75 ieee80211_seq rxa_nxt; /* next seq# in BA window */ 76 uint16_t rxa_wnd; /* BA window size */ 77 struct mbuf *rxa_m[IEEE80211_AGGR_BAWMAX]; 78}; 79 80void ieee80211_ht_attach(struct ieee80211com *); 81void ieee80211_ht_detach(struct ieee80211com *); 82 83void ieee80211_ht_announce(struct ieee80211com *); 84 85extern const int ieee80211_htrates[16]; 86const struct ieee80211_htrateset *ieee80211_get_suphtrates( 87 struct ieee80211com *, const struct ieee80211_channel *); 88 89struct ieee80211_node; 90int ieee80211_setup_htrates(struct ieee80211_node *, 91 const uint8_t *htcap, int flags); 92void ieee80211_setup_basic_htrates(struct ieee80211_node *, 93 const uint8_t *htinfo); 94struct mbuf *ieee80211_decap_amsdu(struct ieee80211_node *, struct mbuf *); 95int ieee80211_ampdu_reorder(struct ieee80211_node *, struct mbuf *); 96void ieee80211_recv_bar(struct ieee80211_node *, struct mbuf *); 97void ieee80211_ht_node_init(struct ieee80211_node *, const uint8_t *); 98void ieee80211_ht_node_cleanup(struct ieee80211_node *); 99void ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *); 100void ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *); 101void ieee80211_recv_action(struct ieee80211_node *, 102 const uint8_t *, const uint8_t *); 103int ieee80211_ampdu_request(struct ieee80211_node *, 104 struct ieee80211_tx_ampdu *); 105int ieee80211_send_bar(struct ieee80211_node *, 106 const struct ieee80211_tx_ampdu *); 107int ieee80211_send_action(struct ieee80211_node *, 108 int, int, uint16_t [4]); 109uint8_t *ieee80211_add_htcap(uint8_t *, struct ieee80211_node *); 110uint8_t *ieee80211_add_htcap_vendor(uint8_t *, struct ieee80211_node *); 111uint8_t *ieee80211_add_htinfo(uint8_t *, struct ieee80211_node *); 112uint8_t *ieee80211_add_htinfo_vendor(uint8_t *, struct ieee80211_node *); 113struct ieee80211_beacon_offsets; 114void ieee80211_ht_update_beacon(struct ieee80211com *, 115 struct ieee80211_beacon_offsets *); 116#endif /* _NET80211_IEEE80211_HT_H_ */ 117