Added BBP tuning
[ralink_drivers/rt2870_fbsd72.git] / rt2870_amrr.h
blobba9ab1a43d03d15cacb8fd3e0590b08caca4f262
2 /*-
3 * Copyright (c) 2009-2010 Alexander Egorenkov <egorenar@gmail.com>
4 * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #ifndef _RT2870_AMRR_H_
20 #define _RT2870_AMRR_H_
22 #define RT2870_AMRR_MIN_SUCCESS_THRESHOLD 1
23 #define RT2870_AMRR_MAX_SUCCESS_THRESHOLD 15
25 struct rt2870_amrr
27 unsigned int min_success_threshold;
28 unsigned int max_success_threshold;
30 int interval;
33 struct rt2870_amrr_node
35 struct rt2870_amrr *amrr;
37 int ticks;
39 unsigned int txcnt;
40 unsigned int success;
41 unsigned int success_threshold;
42 unsigned int recovery;
43 unsigned int retrycnt;
46 void rt2870_amrr_init(struct rt2870_amrr *amrr, struct ieee80211com *ic,
47 int min_success_threshold, int max_success_threshold, int msecs);
49 void rt2870_amrr_cleanup(struct rt2870_amrr *amrr);
51 void rt2870_amrr_node_init(struct rt2870_amrr *amrr,
52 struct rt2870_amrr_node *amrr_node, struct ieee80211_node *ni);
54 int rt2870_amrr_choose(struct ieee80211_node *ni,
55 struct rt2870_amrr_node *amrr_node);
57 static __inline void rt2870_amrr_tx_complete(struct rt2870_amrr_node *amrr_node,
58 int ok, int retries)
60 amrr_node->txcnt++;
62 if (ok)
63 amrr_node->success++;
65 amrr_node->retrycnt += retries;
68 static __inline void rt2870_amrr_tx_update(struct rt2870_amrr_node *amrr_node,
69 int txcnt, int success, int retrycnt)
71 amrr_node->txcnt = txcnt;
72 amrr_node->success = success;
73 amrr_node->retrycnt = retrycnt;
76 #endif /* #ifndef _RT2870_AMRR_H_ */