ieee80211_ht.h revision 170530
145095Ssos/*-
245095Ssos * Copyright (c) 2007 Sam Leffler, Errno Consulting
345095Ssos * All rights reserved.
445095Ssos *
545095Ssos * Redistribution and use in source and binary forms, with or without
645095Ssos * modification, are permitted provided that the following conditions
745095Ssos * are met:
845095Ssos * 1. Redistributions of source code must retain the above copyright
945095Ssos *    notice, this list of conditions and the following disclaimer.
1045095Ssos * 2. Redistributions in binary form must reproduce the above copyright
1145095Ssos *    notice, this list of conditions and the following disclaimer in the
1245095Ssos *    documentation and/or other materials provided with the distribution.
1345095Ssos *
1445095Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1545095Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1645095Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1745095Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1845095Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1945095Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2045095Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2145095Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2245095Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2345095Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2445095Ssos *
2545095Ssos * $FreeBSD: head/sys/net80211/ieee80211_ht.h 170530 2007-06-11 03:36:55Z sam $
2645095Ssos */
2745095Ssos#ifndef _NET80211_IEEE80211_HT_H_
2845116Ssos#define _NET80211_IEEE80211_HT_H_
2945095Ssos
3045095Ssos/*
3145095Ssos * 802.11n protocol implementation definitions.
3245095Ssos */
3345095Ssos
3445095Ssos#define	IEEE80211_SEND_ACTION(_ni,_cat, _act, _args) \
3545095Ssos	((*(_ic)->ic_send_action)(_ni, _cat, _act, _args))
3645095Ssos
3745095Ssos#define	IEEE80211_AGGR_BAWMAX	64	/* max block ack window size */
3845095Ssos
3945095Ssostypedef uint16_t ieee80211_seq;
4045095Ssos
4145095Ssosstruct ieee80211_tx_ampdu {
4245095Ssos	u_short		txa_flags;
4345095Ssos#define	IEEE80211_AGGR_IMMEDIATE	0x0001	/* BA policy */
4445095Ssos#define	IEEE80211_AGGR_XCHGPEND		0x0002	/* ADDBA response pending */
4545095Ssos#define	IEEE80211_AGGR_RUNNING		0x0004	/* ADDBA response received */
4645095Ssos#define	IEEE80211_AGGR_SETUP		0x0008	/* deferred state setup */
4745095Ssos	uint8_t		txa_ac;
4845095Ssos	uint8_t		txa_token;	/* dialog token */
4945095Ssos	int		txa_qbytes;	/* data queued (bytes) */
5045095Ssos	short		txa_qframes;	/* data queued (frames) */
5145095Ssos	ieee80211_seq	txa_seqstart;
5245095Ssos	ieee80211_seq	txa_start;
5345095Ssos	uint16_t	txa_wnd;	/* BA window size */
5445095Ssos	uint8_t		txa_attempts;	/* # setup attempts */
5545095Ssos	int		txa_lastrequest;/* time of last ADDBA request */
5645095Ssos	struct ifqueue	txa_q;		/* packet queue */
5745095Ssos	struct callout	txa_timer;
5845095Ssos};
5945095Ssos
6045095Ssos/* return non-zero if AMPDU tx for the TID is running */
6145095Ssos#define	IEEE80211_AMPDU_RUNNING(tap) \
6245095Ssos	(((tap)->txa_flags & IEEE80211_AGGR_RUNNING) != 0)
6345095Ssos
6445095Ssos/* return non-zero if AMPDU tx for the TID is running or started */
6545095Ssos#define	IEEE80211_AMPDU_REQUESTED(tap) \
6645095Ssos	(((tap)->txa_flags & \
6745095Ssos	 (IEEE80211_AGGR_RUNNING|IEEE80211_AGGR_XCHGPEND)) != 0)
6845095Ssos
6945095Ssosstruct ieee80211_rx_ampdu {
7045095Ssos	int		rxa_flags;
7145095Ssos	int		rxa_qbytes;	/* data queued (bytes) */
7245095Ssos	short		rxa_qframes;	/* data queued (frames) */
7345095Ssos	ieee80211_seq	rxa_seqstart;
7445095Ssos	ieee80211_seq	rxa_start;	/* start of current BA window */
7545095Ssos	ieee80211_seq	rxa_nxt;	/* next seq# in BA window */
7645095Ssos	uint16_t	rxa_wnd;	/* BA window size */
7745095Ssos	struct mbuf *rxa_m[IEEE80211_AGGR_BAWMAX];
7845095Ssos};
7945095Ssos
8045095Ssosvoid	ieee80211_ht_attach(struct ieee80211com *);
8145095Ssosvoid	ieee80211_ht_detach(struct ieee80211com *);
8245095Ssos
8345095Ssosvoid	ieee80211_ht_announce(struct ieee80211com *);
8445095Ssos
8545095Ssosextern const int ieee80211_htrates[16];
8645095Ssosconst struct ieee80211_htrateset *ieee80211_get_suphtrates(
8745095Ssos		struct ieee80211com *, const struct ieee80211_channel *);
8845095Ssos
8945095Ssosstruct ieee80211_node;
9045095Ssosint	ieee80211_setup_htrates(struct ieee80211_node *,
9145095Ssos		const uint8_t *htcap, int flags);
9245095Ssosvoid	ieee80211_setup_basic_htrates(struct ieee80211_node *,
9345095Ssos		const uint8_t *htinfo);
9445095Ssosstruct mbuf *ieee80211_decap_amsdu(struct ieee80211_node *, struct mbuf *);
9545095Ssosint	ieee80211_ampdu_reorder(struct ieee80211_node *, struct mbuf *);
9645095Ssosvoid	ieee80211_recv_bar(struct ieee80211_node *, struct mbuf *);
9745095Ssosvoid	ieee80211_ht_node_init(struct ieee80211_node *, const uint8_t *);
9845095Ssosvoid	ieee80211_ht_node_cleanup(struct ieee80211_node *);
9945095Ssosvoid	ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *);
10045095Ssosvoid	ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *);
10145095Ssosvoid	ieee80211_recv_action(struct ieee80211_node *,
10245095Ssos		const uint8_t *, const uint8_t *);
10345095Ssosint	ieee80211_ampdu_request(struct ieee80211_node *,
10445095Ssos		struct ieee80211_tx_ampdu *);
10545095Ssosint	ieee80211_send_bar(struct ieee80211_node *,
10645095Ssos		const struct ieee80211_tx_ampdu *);
10745095Ssosint	ieee80211_send_action(struct ieee80211_node *,
10845095Ssos		int, int, uint16_t [4]);
10945095Ssosuint8_t	*ieee80211_add_htcap(uint8_t *, struct ieee80211_node *);
11045095Ssosuint8_t	*ieee80211_add_htcap_vendor(uint8_t *, struct ieee80211_node *);
11145095Ssosuint8_t	*ieee80211_add_htinfo(uint8_t *, struct ieee80211_node *);
11245095Ssosuint8_t	*ieee80211_add_htinfo_vendor(uint8_t *, struct ieee80211_node *);
11345095Ssos#endif /* _NET80211_IEEE80211_HT_H_ */
11445095Ssos