| 1 | /* $NetBSD: ieee80211_rssadapt.h,v 1.9 2016/04/08 14:30:47 roy Exp $ */ |
| 2 | /*- |
| 3 | * Copyright (c) 2003, 2004 David Young. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or |
| 6 | * without modification, are permitted provided that the following |
| 7 | * conditions 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 |
| 11 | * copyright notice, this list of conditions and the following |
| 12 | * disclaimer in the documentation and/or other materials provided |
| 13 | * with the distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY |
| 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 18 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL David |
| 19 | * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
| 21 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
| 26 | * OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef _NET80211_IEEE80211_RSSADAPT_H_ |
| 30 | #define |
| 31 | |
| 32 | /* Data-rate adaptation loosely based on "Link Adaptation Strategy |
| 33 | * for IEEE 802.11 WLAN via Received Signal Strength Measurement" |
| 34 | * by Javier del Prado Pavon and Sunghyun Choi. |
| 35 | */ |
| 36 | |
| 37 | /* Buckets for frames 0-128 bytes long, 129-1024, 1025-maximum. */ |
| 38 | #define 3 |
| 39 | #define 128 |
| 40 | #define 3 /* 2**_BKTPOWER */ |
| 41 | |
| 42 | #define \ |
| 43 | (ieee80211_rssadapt_thresh_denom - ieee80211_rssadapt_thresh_old) |
| 44 | #define \ |
| 45 | (ieee80211_rssadapt_decay_denom - ieee80211_rssadapt_decay_old) |
| 46 | #define \ |
| 47 | (ieee80211_rssadapt_avgrssi_denom - ieee80211_rssadapt_avgrssi_old) |
| 48 | |
| 49 | struct { |
| 50 | /* RSS threshold decay. */ |
| 51 | u_int ; |
| 52 | u_int ; |
| 53 | /* RSS threshold update. */ |
| 54 | u_int ; |
| 55 | u_int ; |
| 56 | /* RSS average update. */ |
| 57 | u_int ; |
| 58 | u_int ; |
| 59 | }; |
| 60 | |
| 61 | struct { |
| 62 | /* exponential average RSSI << 8 */ |
| 63 | u_int16_t ; |
| 64 | /* Tx failures in this update interval */ |
| 65 | u_int32_t ; |
| 66 | /* Tx successes in this update interval */ |
| 67 | u_int32_t ; |
| 68 | /* exponential average packets/second */ |
| 69 | u_int32_t ; |
| 70 | /* RSSI threshold for each Tx rate */ |
| 71 | u_int16_t [IEEE80211_RSSADAPT_BKTS] |
| 72 | [IEEE80211_RATE_SIZE]; |
| 73 | struct timeval ; |
| 74 | struct timeval ; |
| 75 | }; |
| 76 | |
| 77 | /* Properties of a Tx packet, for link adaptation. */ |
| 78 | struct { |
| 79 | u_int ; /* Tx packet length */ |
| 80 | u_int ; /* index into ni->ni_rates */ |
| 81 | struct ieee80211_node *; /* destination STA MAC */ |
| 82 | u_int8_t ; /* destination STA avg RSS @ |
| 83 | * Tx time |
| 84 | */ |
| 85 | }; |
| 86 | |
| 87 | void (struct ieee80211_rssadapt *); |
| 88 | void (struct ieee80211com *, struct ieee80211_node *, |
| 89 | struct ieee80211_rssadapt *, int); |
| 90 | void (struct ieee80211com *, |
| 91 | struct ieee80211_node *, struct ieee80211_rssadapt *, |
| 92 | struct ieee80211_rssdesc *); |
| 93 | void (struct ieee80211com *, |
| 94 | struct ieee80211_rssadapt *, struct ieee80211_rssdesc *); |
| 95 | int (struct ieee80211_rssadapt *, |
| 96 | struct ieee80211_rateset *, struct ieee80211_frame *, u_int, int, |
| 97 | const char *, int); |
| 98 | #ifdef IEEE80211_DEBUG |
| 99 | extern int ; |
| 100 | #endif /* IEEE80211_DEBUG */ |
| 101 | |
| 102 | #endif /* !_NET80211_IEEE80211_RSSADAPT_H_ */ |
| 103 | |
| 104 | |