Home | History | Annotate | Line # | Download | only in net80211
ieee80211_rssadapt.h revision 1.9.18.2
      1  1.9.18.2    phil /*	$NetBSD: ieee80211_rssadapt.h,v 1.9.18.2 2018/06/28 21:23:01 phil Exp $ */
      2  1.9.18.2    phil 
      3       1.1  dyoung /*-
      4  1.9.18.1    phil  * SPDX-License-Identifier: BSD-3-Clause
      5  1.9.18.1    phil  *
      6       1.1  dyoung  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
      7       1.1  dyoung  *
      8       1.1  dyoung  * Redistribution and use in source and binary forms, with or
      9       1.1  dyoung  * without modification, are permitted provided that the following
     10       1.1  dyoung  * conditions are met:
     11       1.1  dyoung  * 1. Redistributions of source code must retain the above copyright
     12       1.1  dyoung  *    notice, this list of conditions and the following disclaimer.
     13       1.1  dyoung  * 2. Redistributions in binary form must reproduce the above
     14       1.1  dyoung  *    copyright notice, this list of conditions and the following
     15       1.1  dyoung  *    disclaimer in the documentation and/or other materials provided
     16       1.1  dyoung  *    with the distribution.
     17  1.9.18.1    phil  * 3. The name of David Young may not be used to endorse or promote
     18  1.9.18.1    phil  *    products derived from this software without specific prior
     19  1.9.18.1    phil  *    written permission.
     20       1.1  dyoung  *
     21       1.1  dyoung  * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
     22       1.1  dyoung  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     23       1.1  dyoung  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
     24       1.1  dyoung  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL David
     25       1.1  dyoung  * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     26       1.1  dyoung  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
     27       1.1  dyoung  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28       1.1  dyoung  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     29       1.1  dyoung  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     30       1.1  dyoung  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31       1.1  dyoung  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
     32       1.1  dyoung  * OF SUCH DAMAGE.
     33       1.1  dyoung  */
     34       1.6    elad #ifndef _NET80211_IEEE80211_RSSADAPT_H_
     35       1.6    elad #define _NET80211_IEEE80211_RSSADAPT_H_
     36       1.6    elad 
     37       1.1  dyoung /* Data-rate adaptation loosely based on "Link Adaptation Strategy
     38       1.1  dyoung  * for IEEE 802.11 WLAN via Received Signal Strength Measurement"
     39       1.1  dyoung  * by Javier del Prado Pavon and Sunghyun Choi.
     40       1.4   perry  */
     41       1.1  dyoung 
     42       1.1  dyoung /* Buckets for frames 0-128 bytes long, 129-1024, 1025-maximum. */
     43       1.1  dyoung #define	IEEE80211_RSSADAPT_BKTS		3
     44       1.1  dyoung #define IEEE80211_RSSADAPT_BKT0		128
     45       1.4   perry #define	IEEE80211_RSSADAPT_BKTPOWER	3	/* 2**_BKTPOWER */
     46       1.1  dyoung 
     47  1.9.18.1    phil struct ieee80211_rssadapt {
     48  1.9.18.1    phil 	const struct ieee80211vap *vap;
     49  1.9.18.1    phil 	int	interval;			/* update interval (ticks) */
     50       1.2  dyoung };
     51       1.2  dyoung 
     52  1.9.18.1    phil struct ieee80211_rssadapt_node {
     53  1.9.18.1    phil 	struct ieee80211_rssadapt *ra_rs;	/* backpointer */
     54  1.9.18.1    phil 	struct ieee80211_rateset ra_rates;	/* negotiated rates */
     55  1.9.18.1    phil 	int	ra_rix;				/* current rate index */
     56  1.9.18.1    phil 	int	ra_ticks;			/* time of last update */
     57  1.9.18.1    phil 	int	ra_last_raise;			/* time of last rate raise */
     58  1.9.18.1    phil 	int	ra_raise_interval;		/* rate raise time threshold */
     59  1.9.18.1    phil 
     60       1.1  dyoung 	/* Tx failures in this update interval */
     61  1.9.18.1    phil 	uint32_t		ra_nfail;
     62       1.1  dyoung 	/* Tx successes in this update interval */
     63  1.9.18.1    phil 	uint32_t		ra_nok;
     64       1.1  dyoung 	/* exponential average packets/second */
     65  1.9.18.1    phil 	uint32_t		ra_pktrate;
     66       1.1  dyoung 	/* RSSI threshold for each Tx rate */
     67  1.9.18.1    phil 	uint16_t		ra_rate_thresh[IEEE80211_RSSADAPT_BKTS]
     68       1.1  dyoung 					      [IEEE80211_RATE_SIZE];
     69       1.1  dyoung };
     70       1.1  dyoung 
     71  1.9.18.1    phil #define	IEEE80211_RSSADAPT_SUCCESS	1
     72  1.9.18.1    phil #define	IEEE80211_RSSADAPT_FAILURE	0
     73  1.9.18.1    phil #endif /* _NET80211_IEEE80211_RSSADAPT_H_ */
     74