1 /*	$OpenBSD: ieee80211_amrr.h,v 1.3 2006/06/17 19:34:31 damien Exp $ */
2 /*	$NetBSD: ieee80211_amrr.h,v 1.1 2006/10/31 21:53:41 joerg Exp $	*/
3 
4 /*
5  * Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
6  */
7 
8 /*
9  * Copyright (c) 2006
10  *	Damien Bergamini <damien.bergamini@free.fr>
11  *
12  * Permission to use, copy, modify, and distribute this software for any
13  * purpose with or without fee is hereby granted, provided that the above
14  * copyright notice and this permission notice appear in all copies.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23  */
24 #ifndef _NET80211_AMRR_H_
25 #define	_NET80211_AMRR_H_
26 
27 /*
28  * Naive implementation of the Adaptive Multi Rate Retry algorithm:
29  *
30  * "IEEE 802.11 Rate Adaptation: A Practical Approach"
31  *  Mathieu Lacage, Hossein Manshaei, Thierry Turletti
32  *  INRIA Sophia - Projet Planete
33  *  http://www-sop.inria.fr/rapports/sophia/RR-5208.html
34  */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 struct ieee80211_node;
41 
42 /*
43  * Rate control settings.
44  */
45 struct ieee80211_amrr {
46 	uint_t	amrr_min_success_threshold;
47 	uint_t	amrr_max_success_threshold;
48 };
49 
50 #define	IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD	 1
51 #define	IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD	15
52 
53 /*
54  * Rate control state for a given node.
55  */
56 struct ieee80211_amrr_node {
57 	uint_t	amn_success;
58 	uint_t	amn_recovery;
59 	uint_t	amn_success_threshold;
60 	uint_t	amn_txcnt;
61 	uint_t	amn_retrycnt;
62 };
63 
64 void	ieee80211_amrr_node_init(struct ieee80211_amrr *,
65 	    struct ieee80211_amrr_node *);
66 void	ieee80211_amrr_choose(struct ieee80211_amrr *, struct ieee80211_node *,
67 	    struct ieee80211_amrr_node *);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif /* _NET80211_AMRR_H_ */
74