1753c7e08SAugustin Cavalier /* $NetBSD: ieee80211_rssadapt.h,v 1.4 2005/02/26 22:45:09 perry Exp $ */ 2753c7e08SAugustin Cavalier /*- 3*8244a9baSAugustin Cavalier * SPDX-License-Identifier: BSD-3-Clause 4*8244a9baSAugustin Cavalier * 5753c7e08SAugustin Cavalier * Copyright (c) 2003, 2004 David Young. All rights reserved. 6753c7e08SAugustin Cavalier * 7753c7e08SAugustin Cavalier * Redistribution and use in source and binary forms, with or 8753c7e08SAugustin Cavalier * without modification, are permitted provided that the following 9753c7e08SAugustin Cavalier * conditions are met: 10753c7e08SAugustin Cavalier * 1. Redistributions of source code must retain the above copyright 11753c7e08SAugustin Cavalier * notice, this list of conditions and the following disclaimer. 12753c7e08SAugustin Cavalier * 2. Redistributions in binary form must reproduce the above 13753c7e08SAugustin Cavalier * copyright notice, this list of conditions and the following 14753c7e08SAugustin Cavalier * disclaimer in the documentation and/or other materials provided 15753c7e08SAugustin Cavalier * with the distribution. 16753c7e08SAugustin Cavalier * 3. The name of David Young may not be used to endorse or promote 17753c7e08SAugustin Cavalier * products derived from this software without specific prior 18753c7e08SAugustin Cavalier * written permission. 19753c7e08SAugustin Cavalier * 20753c7e08SAugustin Cavalier * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY 21753c7e08SAugustin Cavalier * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22753c7e08SAugustin Cavalier * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 23753c7e08SAugustin Cavalier * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David 24753c7e08SAugustin Cavalier * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25753c7e08SAugustin Cavalier * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 26753c7e08SAugustin Cavalier * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27753c7e08SAugustin Cavalier * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28753c7e08SAugustin Cavalier * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29753c7e08SAugustin Cavalier * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30753c7e08SAugustin Cavalier * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31753c7e08SAugustin Cavalier * OF SUCH DAMAGE. 32753c7e08SAugustin Cavalier */ 33753c7e08SAugustin Cavalier #ifndef _NET80211_IEEE80211_RSSADAPT_H_ 34753c7e08SAugustin Cavalier #define _NET80211_IEEE80211_RSSADAPT_H_ 35753c7e08SAugustin Cavalier 36753c7e08SAugustin Cavalier /* Data-rate adaptation loosely based on "Link Adaptation Strategy 37753c7e08SAugustin Cavalier * for IEEE 802.11 WLAN via Received Signal Strength Measurement" 38753c7e08SAugustin Cavalier * by Javier del Prado Pavon and Sunghyun Choi. 39753c7e08SAugustin Cavalier */ 40753c7e08SAugustin Cavalier 41753c7e08SAugustin Cavalier /* Buckets for frames 0-128 bytes long, 129-1024, 1025-maximum. */ 42753c7e08SAugustin Cavalier #define IEEE80211_RSSADAPT_BKTS 3 43753c7e08SAugustin Cavalier #define IEEE80211_RSSADAPT_BKT0 128 44753c7e08SAugustin Cavalier #define IEEE80211_RSSADAPT_BKTPOWER 3 /* 2**_BKTPOWER */ 45753c7e08SAugustin Cavalier 46753c7e08SAugustin Cavalier struct ieee80211_rssadapt { 47753c7e08SAugustin Cavalier const struct ieee80211vap *vap; 48753c7e08SAugustin Cavalier int interval; /* update interval (ticks) */ 49753c7e08SAugustin Cavalier }; 50753c7e08SAugustin Cavalier 51753c7e08SAugustin Cavalier struct ieee80211_rssadapt_node { 52753c7e08SAugustin Cavalier struct ieee80211_rssadapt *ra_rs; /* backpointer */ 53753c7e08SAugustin Cavalier struct ieee80211_rateset ra_rates; /* negotiated rates */ 54753c7e08SAugustin Cavalier int ra_rix; /* current rate index */ 55753c7e08SAugustin Cavalier int ra_ticks; /* time of last update */ 56753c7e08SAugustin Cavalier int ra_last_raise; /* time of last rate raise */ 57753c7e08SAugustin Cavalier int ra_raise_interval; /* rate raise time threshold */ 58753c7e08SAugustin Cavalier 59753c7e08SAugustin Cavalier /* Tx failures in this update interval */ 60753c7e08SAugustin Cavalier uint32_t ra_nfail; 61753c7e08SAugustin Cavalier /* Tx successes in this update interval */ 62753c7e08SAugustin Cavalier uint32_t ra_nok; 63753c7e08SAugustin Cavalier /* exponential average packets/second */ 64753c7e08SAugustin Cavalier uint32_t ra_pktrate; 65753c7e08SAugustin Cavalier /* RSSI threshold for each Tx rate */ 66753c7e08SAugustin Cavalier uint16_t ra_rate_thresh[IEEE80211_RSSADAPT_BKTS] 67753c7e08SAugustin Cavalier [IEEE80211_RATE_SIZE]; 68753c7e08SAugustin Cavalier }; 69753c7e08SAugustin Cavalier 70753c7e08SAugustin Cavalier #define IEEE80211_RSSADAPT_SUCCESS 1 71753c7e08SAugustin Cavalier #define IEEE80211_RSSADAPT_FAILURE 0 72753c7e08SAugustin Cavalier #endif /* _NET80211_IEEE80211_RSSADAPT_H_ */ 73