xref: /freebsd/sys/dev/ath/ath_rate/amrr/amrr.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
105f1e03fSSam Leffler /*-
2*718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*718cf2ccSPedro F. Giffuni  *
405f1e03fSSam Leffler  * Copyright (c) 2004 INRIA
51f1d7810SSam Leffler  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
605f1e03fSSam Leffler  * All rights reserved.
705f1e03fSSam Leffler  *
805f1e03fSSam Leffler  * Redistribution and use in source and binary forms, with or without
905f1e03fSSam Leffler  * modification, are permitted provided that the following conditions
1005f1e03fSSam Leffler  * are met:
1105f1e03fSSam Leffler  * 1. Redistributions of source code must retain the above copyright
1205f1e03fSSam Leffler  *    notice, this list of conditions and the following disclaimer,
1305f1e03fSSam Leffler     without modification.
1405f1e03fSSam Leffler  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1505f1e03fSSam Leffler  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
1605f1e03fSSam Leffler  *    redistribution must be conditioned upon including a substantially
1705f1e03fSSam Leffler  *    similar Disclaimer requirement for further binary redistribution.
1805f1e03fSSam Leffler  * 3. Neither the names of the above-listed copyright holders nor the names
1905f1e03fSSam Leffler  *    of any contributors may be used to endorse or promote products derived
2005f1e03fSSam Leffler  *    from this software without specific prior written permission.
2105f1e03fSSam Leffler  *
2205f1e03fSSam Leffler  * Alternatively, this software may be distributed under the terms of the
2305f1e03fSSam Leffler  * GNU General Public License ("GPL") version 2 as published by the Free
2405f1e03fSSam Leffler  * Software Foundation.
2505f1e03fSSam Leffler  *
2605f1e03fSSam Leffler  * NO WARRANTY
2705f1e03fSSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2805f1e03fSSam Leffler  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2905f1e03fSSam Leffler  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
3005f1e03fSSam Leffler  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
3105f1e03fSSam Leffler  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
3205f1e03fSSam Leffler  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3305f1e03fSSam Leffler  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3405f1e03fSSam Leffler  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
3505f1e03fSSam Leffler  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3605f1e03fSSam Leffler  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3705f1e03fSSam Leffler  * THE POSSIBILITY OF SUCH DAMAGES.
3805f1e03fSSam Leffler  */
3905f1e03fSSam Leffler 
4005f1e03fSSam Leffler #ifndef _DEV_ATH_RATE_AMRR_H
4105f1e03fSSam Leffler #define _DEV_ATH_RATE_AMRR_H
4205f1e03fSSam Leffler 
4305f1e03fSSam Leffler /* per-device state */
4405f1e03fSSam Leffler struct amrr_softc {
4505f1e03fSSam Leffler 	struct ath_ratectrl arc;	/* base state */
4605f1e03fSSam Leffler };
4705f1e03fSSam Leffler 
4805f1e03fSSam Leffler /* per-node state */
4905f1e03fSSam Leffler struct amrr_node {
50b032f27cSSam Leffler 	int		amn_rix;	/* current rate index */
51b032f27cSSam Leffler 	int		amn_ticks;	/* time of last update */
52b032f27cSSam Leffler 	int		amn_interval;	/* update interval (ticks) */
5305f1e03fSSam Leffler   	/* AMRR statistics for this node */
5405f1e03fSSam Leffler   	u_int           amn_tx_try0_cnt;
5505f1e03fSSam Leffler   	u_int           amn_tx_try1_cnt;
5605f1e03fSSam Leffler   	u_int           amn_tx_try2_cnt;
5705f1e03fSSam Leffler   	u_int           amn_tx_try3_cnt;
5805f1e03fSSam Leffler   	u_int           amn_tx_failure_cnt;
5905f1e03fSSam Leffler         /* AMRR algorithm state for this node */
6005f1e03fSSam Leffler   	u_int           amn_success_threshold;
6105f1e03fSSam Leffler   	u_int           amn_success;
6205f1e03fSSam Leffler   	u_int           amn_recovery;
6305f1e03fSSam Leffler 	/* rate index et al. */
6405f1e03fSSam Leffler 	u_int8_t	amn_tx_rix0;	/* series 0 rate index */
6505f1e03fSSam Leffler 	u_int8_t	amn_tx_rate0;	/* series 0 h/w rate */
6605f1e03fSSam Leffler 	u_int8_t	amn_tx_rate1;	/* series 1 h/w rate */
6705f1e03fSSam Leffler 	u_int8_t	amn_tx_rate2;	/* series 2 h/w rate */
6805f1e03fSSam Leffler 	u_int8_t	amn_tx_rate3;	/* series 3 h/w rate */
6905f1e03fSSam Leffler 	u_int8_t	amn_tx_rate0sp;	/* series 0 short preamble h/w rate */
7005f1e03fSSam Leffler 	u_int8_t	amn_tx_rate1sp;	/* series 1 short preamble h/w rate */
7105f1e03fSSam Leffler 	u_int8_t	amn_tx_rate2sp;	/* series 2 short preamble h/w rate */
7205f1e03fSSam Leffler 	u_int8_t	amn_tx_rate3sp;	/* series 3 short preamble h/w rate */
7305f1e03fSSam Leffler 	u_int8_t	amn_tx_try0;	/* series 0 try count */
7405f1e03fSSam Leffler   	u_int           amn_tx_try1;    /* series 1 try count */
7505f1e03fSSam Leffler   	u_int           amn_tx_try2;    /* series 2 try count */
7605f1e03fSSam Leffler   	u_int           amn_tx_try3;    /* series 3 try count */
7705f1e03fSSam Leffler };
7805f1e03fSSam Leffler #define	ATH_NODE_AMRR(an)	((struct amrr_node *)&an[1])
7905f1e03fSSam Leffler #endif /* _DEV_ATH_RATE_AMRR_H */
80