2 * Copyright (c) 2004 Sam Leffler, Errno Consulting
3 * Copyright (c) 2004 Video54 Technologies, Inc.
4 * Copyright (c) 2013 Qualcomm Atheros, Inc.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted (subject to the limitations in the
10 * disclaimer below) provided that the following conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the
20 * * Neither the name of Qualcomm Atheros nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * Alternatively, this software may be distributed under the terms of the
25 * GNU General Public License ("GPL") version 2 as published by the Free
26 * Software Foundation.
28 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
29 * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
30 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
31 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
32 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
34 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
37 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
39 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
40 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 #ifndef _ATH_RATECTRL_H_
43 #define _ATH_RATECTRL_H_
47 struct ath_node_target;
50 struct ieee80211com_target;
54 size_t arc_space; /* space required for per-node state */
57 #define ATH_RC_DS_FLAG 0x01
58 #define ATH_RC_CW40_FLAG 0x02
59 #define ATH_RC_HT40_SGI_FLAG 0x04
60 #define ATH_RC_HT_FLAG 0x08
61 #define ATH_RC_RTSCTS_FLAG 0x10
62 #define ATH_RC_TX_STBC_FLAG 0x20 /* TX STBC */
63 #define ATH_RC_RX_STBC_FLAG 0xC0 /* RX STBC ,2 bits */
64 #define ATH_RC_RX_STBC_FLAG_S 6
65 #define ATH_RC_WEP_TKIP_FLAG 0x100 /* WEP/TKIP encryption */
72 #define ATH_RC_PROBE_ALLOWED 0x00000001
73 #define ATH_RC_MINRATE_LASTRATE 0x00000002
75 struct ath_rc_series {
78 u_int8_t tx_chainmask;
80 a_uint32_t max4msframelen;
81 a_uint32_t txrateKbps;
85 * Attach/detach a rate control module.
87 struct ath_ratectrl *ath_rate_attach(struct ath_softc_tgt *);
90 * Return the transmit info for a data packet. If multi-rate state
91 * is to be setup then try0 should contain a value other than ATH_TXMATRY
92 * and ath_rate_setupxtxdesc will be called after deciding if the frame
93 * can be transmitted with multi-rate retry.
95 void ath_rate_findrate(struct ath_softc_tgt *sc,
96 struct ath_node_target *an,
97 a_int32_t shortPreamble,
103 struct ath_rc_series series[],
106 * Update rate control state for a packet associated with the
107 * supplied transmit descriptor. The routine is invoked both
108 * for packets that were successfully sent and for those that
109 * failed (consult the descriptor for details).
111 void ath_rate_tx_complete(struct ath_softc_tgt *, struct ath_node_target *,
112 struct ath_tx_desc *, struct ath_rc_series series[],
113 a_int32_t nframes, a_int32_t nbad);
116 void ath_rate_stateupdate(struct ath_softc_tgt *sc, struct ath_node_target *an,
117 enum ath_rc_cwmode cwmode);
120 void ath_tx_status_update_rate(struct ath_softc_tgt *sc,
121 struct ath_rc_series rcs[],
123 WMI_TXSTATUS_EVENT *txs);
125 #endif /* _ATH_RATECTRL_H_ */