xref: /netbsd-src/sys/dev/ic/athrate-amrr.h (revision fd8cfc5edb3ad8dade159e425635a85153a56292)
1*fd8cfc5eSxtraeme /*	$NetBSD: athrate-amrr.h,v 1.2 2006/02/05 06:03:26 xtraeme Exp $ */
2*fd8cfc5eSxtraeme 
3d1f00611Sdyoung /*-
4d1f00611Sdyoung  * Copyright (c) 2004 INRIA
5d1f00611Sdyoung  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
6d1f00611Sdyoung  * All rights reserved.
7d1f00611Sdyoung  *
8d1f00611Sdyoung  * Redistribution and use in source and binary forms, with or without
9d1f00611Sdyoung  * modification, are permitted provided that the following conditions
10d1f00611Sdyoung  * are met:
11d1f00611Sdyoung  * 1. Redistributions of source code must retain the above copyright
12d1f00611Sdyoung  *    notice, this list of conditions and the following disclaimer,
13d1f00611Sdyoung     without modification.
14d1f00611Sdyoung  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
15d1f00611Sdyoung  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
16d1f00611Sdyoung  *    redistribution must be conditioned upon including a substantially
17d1f00611Sdyoung  *    similar Disclaimer requirement for further binary redistribution.
18d1f00611Sdyoung  * 3. Neither the names of the above-listed copyright holders nor the names
19d1f00611Sdyoung  *    of any contributors may be used to endorse or promote products derived
20d1f00611Sdyoung  *    from this software without specific prior written permission.
21d1f00611Sdyoung  *
22d1f00611Sdyoung  * Alternatively, this software may be distributed under the terms of the
23d1f00611Sdyoung  * GNU General Public License ("GPL") version 2 as published by the Free
24d1f00611Sdyoung  * Software Foundation.
25d1f00611Sdyoung  *
26d1f00611Sdyoung  * NO WARRANTY
27d1f00611Sdyoung  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28d1f00611Sdyoung  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29d1f00611Sdyoung  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
30d1f00611Sdyoung  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
31d1f00611Sdyoung  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
32d1f00611Sdyoung  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33d1f00611Sdyoung  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34d1f00611Sdyoung  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
35d1f00611Sdyoung  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36d1f00611Sdyoung  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
37d1f00611Sdyoung  * THE POSSIBILITY OF SUCH DAMAGES.
38d1f00611Sdyoung  *
39d1f00611Sdyoung  * $FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.h,v 1.2 2004/12/31 22:41:45 sam Exp $
40d1f00611Sdyoung  */
41d1f00611Sdyoung 
42d1f00611Sdyoung #ifndef _DEV_ATH_RATE_AMRR_H
43d1f00611Sdyoung #define _DEV_ATH_RATE_AMRR_H
44d1f00611Sdyoung 
45d1f00611Sdyoung /* per-device state */
46d1f00611Sdyoung struct amrr_softc {
47d1f00611Sdyoung 	struct ath_ratectrl arc;	/* base state */
48d1f00611Sdyoung 	struct callout timer;		/* periodic timer */
49d1f00611Sdyoung };
50d1f00611Sdyoung 
51d1f00611Sdyoung /* per-node state */
52d1f00611Sdyoung struct amrr_node {
53d1f00611Sdyoung   	/* AMRR statistics for this node */
54d1f00611Sdyoung   	u_int           amn_tx_try0_cnt;
55d1f00611Sdyoung   	u_int           amn_tx_try1_cnt;
56d1f00611Sdyoung   	u_int           amn_tx_try2_cnt;
57d1f00611Sdyoung   	u_int           amn_tx_try3_cnt;
58d1f00611Sdyoung   	u_int           amn_tx_failure_cnt;
59d1f00611Sdyoung         /* AMRR algorithm state for this node */
60d1f00611Sdyoung   	u_int           amn_success_threshold;
61d1f00611Sdyoung   	u_int           amn_success;
62d1f00611Sdyoung   	u_int           amn_recovery;
63d1f00611Sdyoung 	/* rate index et al. */
64d1f00611Sdyoung 	u_int8_t	amn_tx_rix0;	/* series 0 rate index */
65d1f00611Sdyoung 	u_int8_t	amn_tx_rate0;	/* series 0 h/w rate */
66d1f00611Sdyoung 	u_int8_t	amn_tx_rate1;	/* series 1 h/w rate */
67d1f00611Sdyoung 	u_int8_t	amn_tx_rate2;	/* series 2 h/w rate */
68d1f00611Sdyoung 	u_int8_t	amn_tx_rate3;	/* series 3 h/w rate */
69d1f00611Sdyoung 	u_int8_t	amn_tx_rate0sp;	/* series 0 short preamble h/w rate */
70d1f00611Sdyoung 	u_int8_t	amn_tx_rate1sp;	/* series 1 short preamble h/w rate */
71d1f00611Sdyoung 	u_int8_t	amn_tx_rate2sp;	/* series 2 short preamble h/w rate */
72d1f00611Sdyoung 	u_int8_t	amn_tx_rate3sp;	/* series 3 short preamble h/w rate */
73d1f00611Sdyoung 	u_int8_t	amn_tx_try0;	/* series 0 try count */
74d1f00611Sdyoung   	u_int           amn_tx_try1;    /* series 1 try count */
75d1f00611Sdyoung   	u_int           amn_tx_try2;    /* series 2 try count */
76d1f00611Sdyoung   	u_int           amn_tx_try3;    /* series 3 try count */
77d1f00611Sdyoung };
78d1f00611Sdyoung #define	ATH_NODE_AMRR(an)	((struct amrr_node *)&an[1])
79d1f00611Sdyoung #endif /* _DEV_ATH_RATE_AMRR_H */
80