[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]

FreeBSD/Linux Kernel Cross Reference
sys/net80211/ieee80211_rssadapt.h

Version: -  FREEBSD  -  FREEBSD7  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  OPENSOLARIS  -  minix-3-1-1  -  TRUSTEDBSD-SEBSD  -  FREEBSD-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  excerpts  -  bigexcerpts 

  1 /*      $FreeBSD: src/sys/net80211/ieee80211_rssadapt.h,v 1.1 2008/04/20 20:35:44 sam Exp $     */
  2 /* $NetBSD: ieee80211_rssadapt.h,v 1.4 2005/02/26 22:45:09 perry Exp $ */
  3 /*-
  4  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
  5  *
  6  * Redistribution and use in source and binary forms, with or
  7  * without modification, are permitted provided that the following
  8  * conditions are met:
  9  * 1. Redistributions of source code must retain the above copyright
 10  *    notice, this list of conditions and the following disclaimer.
 11  * 2. Redistributions in binary form must reproduce the above
 12  *    copyright notice, this list of conditions and the following
 13  *    disclaimer in the documentation and/or other materials provided
 14  *    with the distribution.
 15  * 3. The name of David Young may not be used to endorse or promote
 16  *    products derived from this software without specific prior
 17  *    written permission.
 18  *
 19  * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY
 20  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 22  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL David
 23  * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 25  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 27  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 28  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
 30  * OF SUCH DAMAGE.
 31  */
 32 #ifndef _NET80211_IEEE80211_RSSADAPT_H_
 33 #define _NET80211_IEEE80211_RSSADAPT_H_
 34 
 35 /* Data-rate adaptation loosely based on "Link Adaptation Strategy
 36  * for IEEE 802.11 WLAN via Received Signal Strength Measurement"
 37  * by Javier del Prado Pavon and Sunghyun Choi.
 38  */
 39 
 40 /* Buckets for frames 0-128 bytes long, 129-1024, 1025-maximum. */
 41 #define IEEE80211_RSSADAPT_BKTS         3
 42 #define IEEE80211_RSSADAPT_BKT0         128
 43 #define IEEE80211_RSSADAPT_BKTPOWER     3       /* 2**_BKTPOWER */
 44 
 45 struct ieee80211_rssadapt {
 46         struct ieee80211vap *vap;
 47         int     interval;                       /* update interval (ticks) */
 48 };
 49 
 50 struct ieee80211_rssadapt_node {
 51         struct ieee80211_rssadapt *ra_rs;       /* backpointer */
 52         struct ieee80211_rateset ra_rates;      /* negotiated rates */
 53         int     ra_rix;                         /* current rate index */
 54         int     ra_ticks;                       /* time of last update */
 55         int     ra_last_raise;                  /* time of last rate raise */
 56         int     ra_raise_interval;              /* rate raise time threshold */
 57 
 58         /* Tx failures in this update interval */
 59         uint32_t                ra_nfail;
 60         /* Tx successes in this update interval */
 61         uint32_t                ra_nok;
 62         /* exponential average packets/second */
 63         uint32_t                ra_pktrate;
 64         /* RSSI threshold for each Tx rate */
 65         uint16_t                ra_rate_thresh[IEEE80211_RSSADAPT_BKTS]
 66                                               [IEEE80211_RATE_SIZE];
 67 };
 68 
 69 void    ieee80211_rssadapt_init(struct ieee80211_rssadapt *,
 70             struct ieee80211vap *, int);
 71 void    ieee80211_rssadapt_cleanup(struct ieee80211_rssadapt *);
 72 void    ieee80211_rssadapt_setinterval(struct ieee80211_rssadapt *, int);
 73 void    ieee80211_rssadapt_node_init(struct ieee80211_rssadapt *,
 74             struct ieee80211_rssadapt_node *, struct ieee80211_node *);
 75 int     ieee80211_rssadapt_choose(struct ieee80211_node *,
 76             struct ieee80211_rssadapt_node *, u_int);
 77 
 78 /* NB: these are public only for the inline below */
 79 void    ieee80211_rssadapt_raise_rate(struct ieee80211_rssadapt_node *,
 80             int pktlen, int rssi);
 81 void    ieee80211_rssadapt_lower_rate(struct ieee80211_rssadapt_node *,
 82             int pktlen, int rssi);
 83 
 84 #define IEEE80211_RSSADAPT_SUCCESS      1
 85 #define IEEE80211_RSSADAPT_FAILURE      0
 86 
 87 static __inline void
 88 ieee80211_rssadapt_tx_complete(struct ieee80211_rssadapt_node *ra,
 89     int success, int pktlen, int rssi)
 90 {
 91         if (success) {
 92                 ra->ra_nok++;
 93                 if ((ra->ra_rix + 1) < ra->ra_rates.rs_nrates &&
 94                     (ticks - ra->ra_last_raise) >= ra->ra_raise_interval)
 95                         ieee80211_rssadapt_raise_rate(ra, pktlen, rssi);
 96         } else {
 97                 ra->ra_nfail++;
 98                 ieee80211_rssadapt_lower_rate(ra, pktlen, rssi);
 99         }
100 }
101 #endif /* _NET80211_IEEE80211_RSSADAPT_H_ */
102 

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.