if_ath_tx.h revision 241170
145095Ssos/*- 255333Ssos * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 345095Ssos * All rights reserved. 445095Ssos * 545095Ssos * Redistribution and use in source and binary forms, with or without 645095Ssos * modification, are permitted provided that the following conditions 745095Ssos * are met: 845095Ssos * 1. Redistributions of source code must retain the above copyright 945095Ssos * notice, this list of conditions and the following disclaimer, 1045095Ssos * without modification. 1145095Ssos * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1245095Ssos * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 1345095Ssos * redistribution must be conditioned upon including a substantially 1445095Ssos * similar Disclaimer requirement for further binary redistribution. 1545095Ssos * 1645095Ssos * NO WARRANTY 1745095Ssos * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1845095Ssos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1945095Ssos * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 2045095Ssos * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 2145095Ssos * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 2245095Ssos * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2345095Ssos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2445095Ssos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 2545095Ssos * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2645095Ssos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 2745095Ssos * THE POSSIBILITY OF SUCH DAMAGES. 2850477Speter * 2945095Ssos * $FreeBSD: head/sys/dev/ath/if_ath_tx.h 241170 2012-10-03 23:23:45Z adrian $ 3045095Ssos */ 3145150Ssos#ifndef __IF_ATH_TX_H__ 3245095Ssos#define __IF_ATH_TX_H__ 3345095Ssos 3445095Ssos/* 3545095Ssos * some general macros 3645798Ssos */ 3754270Ssos#define INCR(_l, _sz) (_l) ++; (_l) &= ((_sz) - 1) 3854270Ssos/* 3951520Ssos * return block-ack bitmap index given sequence and starting sequence 4045095Ssos */ 4147272Ssos#define ATH_BA_INDEX(_st, _seq) (((_seq) - (_st)) & (IEEE80211_SEQ_RANGE - 1)) 4245095Ssos 4347272Ssos#define WME_BA_BMP_SIZE 64 4445095Ssos#define WME_MAX_BA WME_BA_BMP_SIZE 4554270Ssos 4645095Ssos/* 4756754Ssos * How 'busy' to try and keep the hardware txq 4856754Ssos */ 4952067Ssos#define ATH_AGGR_MIN_QDEPTH 2 5055333Ssos 5152067Ssos/* 5252067Ssos * Watermark for scheduling TIDs in order to maximise aggregation. 5352067Ssos * 5445720Speter * If hwq_depth is greater than this, don't schedule the TID 5545720Speter * for packet scheduling - the hardware is already busy servicing 5651520Ssos * this TID. 5745720Speter * 5845720Speter * If hwq_depth is less than this, schedule the TID for packet 5956744Ssos * scheduling in the completion handler. 6045095Ssos */ 6145095Ssos#define ATH_AGGR_SCHED_HIGH 4 6245095Ssos#define ATH_AGGR_SCHED_LOW 2 6357325Ssos 6456558Ssos/* 6555333Ssos * return whether a bit at index _n in bitmap _bm is set 6645095Ssos * _sz is the size of the bitmap 6756744Ssos */ 6856744Ssos#define ATH_BA_ISSET(_bm, _n) (((_n) < (WME_BA_BMP_SIZE)) && \ 6956744Ssos ((_bm)[(_n) >> 5] & (1 << ((_n) & 31)))) 7045095Ssos 7156744Ssos 7245095Ssos/* extracting the seqno from buffer seqno */ 7352067Ssos#define SEQNO(_a) ((_a) >> IEEE80211_SEQ_SEQ_SHIFT) 7452067Ssos 7552067Ssos/* 7652067Ssos * Whether the current sequence number is within the 7752067Ssos * BAW. 7856558Ssos */ 7956744Ssos#define BAW_WITHIN(_start, _bawsz, _seqno) \ 8052067Ssos ((((_seqno) - (_start)) & 4095) < (_bawsz)) 8152067Ssos 8252067Ssosextern void ath_freetx(struct mbuf *m); 8356558Ssosextern void ath_tx_node_flush(struct ath_softc *sc, struct ath_node *an); 8456558Ssosextern void ath_tx_txq_drain(struct ath_softc *sc, struct ath_txq *txq); 8545095Ssosextern void ath_txfrag_cleanup(struct ath_softc *sc, ath_bufhead *frags, 8656558Ssos struct ieee80211_node *ni); 8756744Ssosextern int ath_txfrag_setup(struct ath_softc *sc, ath_bufhead *frags, 8856558Ssos struct mbuf *m0, struct ieee80211_node *ni); 8956558Ssosextern int ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, 9056558Ssos struct ath_buf *bf, struct mbuf *m0); 9156558Ssosextern int ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, 9256744Ssos const struct ieee80211_bpf_params *params); 9356558Ssos 9456558Ssos/* software queue stuff */ 9545095Ssosextern void ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, 9645095Ssos struct ath_txq *txq, struct ath_buf *bf); 9755333Ssosextern void ath_tx_tid_init(struct ath_softc *sc, struct ath_node *an); 9845095Ssosextern void ath_tx_tid_hw_queue_aggr(struct ath_softc *sc, struct ath_node *an, 9957391Ssos struct ath_tid *tid); 10057391Ssosextern void ath_tx_tid_hw_queue_norm(struct ath_softc *sc, struct ath_node *an, 10157391Ssos struct ath_tid *tid); 10257391Ssosextern void ath_txq_sched(struct ath_softc *sc, struct ath_txq *txq); 10357391Ssosextern void ath_tx_normal_comp(struct ath_softc *sc, struct ath_buf *bf, 10457391Ssos int fail); 10557391Ssosextern void ath_tx_aggr_comp(struct ath_softc *sc, struct ath_buf *bf, 10657391Ssos int fail); 10757391Ssosextern void ath_tx_addto_baw(struct ath_softc *sc, struct ath_node *an, 10857391Ssos struct ath_tid *tid, struct ath_buf *bf); 10957391Ssosextern struct ieee80211_tx_ampdu * ath_tx_get_tx_tid(struct ath_node *an, 11057391Ssos int tid); 11157391Ssos 11257391Ssos/* TX addba handling */ 11357391Ssosextern int ath_addba_request(struct ieee80211_node *ni, 11457391Ssos struct ieee80211_tx_ampdu *tap, int dialogtoken, 11557391Ssos int baparamset, int batimeout); 11657391Ssosextern int ath_addba_response(struct ieee80211_node *ni, 11757391Ssos struct ieee80211_tx_ampdu *tap, int dialogtoken, 11857391Ssos int code, int batimeout); 11957391Ssosextern void ath_addba_stop(struct ieee80211_node *ni, 12057391Ssos struct ieee80211_tx_ampdu *tap); 12157391Ssosextern void ath_bar_response(struct ieee80211_node *ni, 12257391Ssos struct ieee80211_tx_ampdu *tap, int status); 12357391Ssosextern void ath_addba_response_timeout(struct ieee80211_node *ni, 12457391Ssos struct ieee80211_tx_ampdu *tap); 12557391Ssos 12645095Ssos/* 12756138Ssos * AP mode power save handling (of stations) 12856138Ssos */ 12945095Ssosextern void ath_tx_node_sleep(struct ath_softc *sc, struct ath_node *an); 13051520Ssosextern void ath_tx_node_wakeup(struct ath_softc *sc, struct ath_node *an); 13145095Ssos 13245095Ssos/* 13353029Ssos * Setup path 13451520Ssos */ 13556558Ssos#define ath_txdma_setup(_sc) \ 13656558Ssos (_sc)->sc_tx.xmit_setup(_sc) 13756558Ssos#define ath_txdma_teardown(_sc) \ 13856558Ssos (_sc)->sc_tx.xmit_teardown(_sc) 13953681Ssos#define ath_txq_restart_dma(_sc, _txq) \ 14053681Ssos (_sc)->sc_tx.xmit_dma_restart((_sc), (_txq)) 14153681Ssos#define ath_tx_handoff(_sc, _txq, _bf) \ 14257325Ssos (_sc)->sc_tx.xmit_handoff((_sc), (_txq), (_bf)) 14357325Ssos#define ath_draintxq(_sc, _rtype) \ 14453681Ssos (_sc)->sc_tx.xmit_drain((_sc), (_rtype)) 14556558Ssos 14656744Ssosextern void ath_xmit_setup_legacy(struct ath_softc *sc); 14753681Ssos 14845095Ssos#endif 14945095Ssos