xref: /dflybsd-src/sys/netproto/802_11/ieee80211_rssadapt.h (revision 085ff963b243cbeba68069d0b25c2b798c566b31)
1*085ff963SMatthew Dillon /*	$FreeBSD$	*/
232176cfdSRui Paulo /* $NetBSD: ieee80211_rssadapt.h,v 1.4 2005/02/26 22:45:09 perry Exp $ */
332176cfdSRui Paulo /*-
432176cfdSRui Paulo  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
532176cfdSRui Paulo  *
632176cfdSRui Paulo  * Redistribution and use in source and binary forms, with or
732176cfdSRui Paulo  * without modification, are permitted provided that the following
832176cfdSRui Paulo  * conditions are met:
932176cfdSRui Paulo  * 1. Redistributions of source code must retain the above copyright
1032176cfdSRui Paulo  *    notice, this list of conditions and the following disclaimer.
1132176cfdSRui Paulo  * 2. Redistributions in binary form must reproduce the above
1232176cfdSRui Paulo  *    copyright notice, this list of conditions and the following
1332176cfdSRui Paulo  *    disclaimer in the documentation and/or other materials provided
1432176cfdSRui Paulo  *    with the distribution.
1532176cfdSRui Paulo  * 3. The name of David Young may not be used to endorse or promote
1632176cfdSRui Paulo  *    products derived from this software without specific prior
1732176cfdSRui Paulo  *    written permission.
1832176cfdSRui Paulo  *
1932176cfdSRui Paulo  * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
2032176cfdSRui Paulo  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
2132176cfdSRui Paulo  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
2232176cfdSRui Paulo  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL David
2332176cfdSRui Paulo  * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2432176cfdSRui Paulo  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
2532176cfdSRui Paulo  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2632176cfdSRui Paulo  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2732176cfdSRui Paulo  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2832176cfdSRui Paulo  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2932176cfdSRui Paulo  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
3032176cfdSRui Paulo  * OF SUCH DAMAGE.
3132176cfdSRui Paulo  */
3232176cfdSRui Paulo #ifndef _NET80211_IEEE80211_RSSADAPT_H_
3332176cfdSRui Paulo #define _NET80211_IEEE80211_RSSADAPT_H_
3432176cfdSRui Paulo 
3532176cfdSRui Paulo /* Data-rate adaptation loosely based on "Link Adaptation Strategy
3632176cfdSRui Paulo  * for IEEE 802.11 WLAN via Received Signal Strength Measurement"
3732176cfdSRui Paulo  * by Javier del Prado Pavon and Sunghyun Choi.
3832176cfdSRui Paulo  */
3932176cfdSRui Paulo 
4032176cfdSRui Paulo /* Buckets for frames 0-128 bytes long, 129-1024, 1025-maximum. */
4132176cfdSRui Paulo #define	IEEE80211_RSSADAPT_BKTS		3
4232176cfdSRui Paulo #define IEEE80211_RSSADAPT_BKT0		128
4332176cfdSRui Paulo #define	IEEE80211_RSSADAPT_BKTPOWER	3	/* 2**_BKTPOWER */
4432176cfdSRui Paulo 
4532176cfdSRui Paulo struct ieee80211_rssadapt {
464028af95SRui Paulo 	const struct ieee80211vap *vap;
4732176cfdSRui Paulo 	int	interval;			/* update interval (ticks) */
4832176cfdSRui Paulo };
4932176cfdSRui Paulo 
5032176cfdSRui Paulo struct ieee80211_rssadapt_node {
5132176cfdSRui Paulo 	struct ieee80211_rssadapt *ra_rs;	/* backpointer */
5232176cfdSRui Paulo 	struct ieee80211_rateset ra_rates;	/* negotiated rates */
5332176cfdSRui Paulo 	int	ra_rix;				/* current rate index */
5432176cfdSRui Paulo 	int	ra_ticks;			/* time of last update */
5532176cfdSRui Paulo 	int	ra_last_raise;			/* time of last rate raise */
5632176cfdSRui Paulo 	int	ra_raise_interval;		/* rate raise time threshold */
5732176cfdSRui Paulo 
5832176cfdSRui Paulo 	/* Tx failures in this update interval */
5932176cfdSRui Paulo 	uint32_t		ra_nfail;
6032176cfdSRui Paulo 	/* Tx successes in this update interval */
6132176cfdSRui Paulo 	uint32_t		ra_nok;
6232176cfdSRui Paulo 	/* exponential average packets/second */
6332176cfdSRui Paulo 	uint32_t		ra_pktrate;
6432176cfdSRui Paulo 	/* RSSI threshold for each Tx rate */
6532176cfdSRui Paulo 	uint16_t		ra_rate_thresh[IEEE80211_RSSADAPT_BKTS]
6632176cfdSRui Paulo 					      [IEEE80211_RATE_SIZE];
6732176cfdSRui Paulo };
6832176cfdSRui Paulo 
6932176cfdSRui Paulo #define	IEEE80211_RSSADAPT_SUCCESS	1
7032176cfdSRui Paulo #define	IEEE80211_RSSADAPT_FAILURE	0
7132176cfdSRui Paulo #endif /* _NET80211_IEEE80211_RSSADAPT_H_ */
72