Deleted Added
full compact
if_ath_tx_ht.c (233988) if_ath_tx_ht.c (236872)
1/*-
2 * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 14 unchanged lines hidden (view full) ---

23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 14 unchanged lines hidden (view full) ---

23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx_ht.c 233988 2012-04-07 05:46:00Z adrian $");
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx_ht.c 236872 2012-06-11 06:59:28Z adrian $");
32
33#include "opt_inet.h"
34#include "opt_ath.h"
35#include "opt_wlan.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sysctl.h>

--- 599 unchanged lines hidden (view full) ---

639 *
640 * So if you want to call this from an upper layer context (eg, to direct-
641 * dispatch aggregate frames to the hardware), please keep this in mind.
642 */
643ATH_AGGR_STATUS
644ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid,
645 ath_bufhead *bf_q)
646{
32
33#include "opt_inet.h"
34#include "opt_ath.h"
35#include "opt_wlan.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sysctl.h>

--- 599 unchanged lines hidden (view full) ---

639 *
640 * So if you want to call this from an upper layer context (eg, to direct-
641 * dispatch aggregate frames to the hardware), please keep this in mind.
642 */
643ATH_AGGR_STATUS
644ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid,
645 ath_bufhead *bf_q)
646{
647 struct ieee80211_node *ni = &an->an_node;
647 //struct ieee80211_node *ni = &an->an_node;
648 struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL;
649 int nframes = 0;
650 uint16_t aggr_limit = 0, al = 0, bpad = 0, al_delta, h_baw;
651 struct ieee80211_tx_ampdu *tap;
652 int status = ATH_AGGR_DONE;
653 int prev_frames = 0; /* XXX for AR5416 burst, not done here */
654 int prev_al = 0; /* XXX also for AR5416 burst */
655

--- 90 unchanged lines hidden (view full) ---

746 */
747 bf->bf_state.bfs_txflags &=
748 (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA);
749 bf->bf_state.bfs_txflags |=
750 bf_first->bf_state.bfs_txflags &
751 (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA);
752
753 /*
648 struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL;
649 int nframes = 0;
650 uint16_t aggr_limit = 0, al = 0, bpad = 0, al_delta, h_baw;
651 struct ieee80211_tx_ampdu *tap;
652 int status = ATH_AGGR_DONE;
653 int prev_frames = 0; /* XXX for AR5416 burst, not done here */
654 int prev_al = 0; /* XXX also for AR5416 burst */
655

--- 90 unchanged lines hidden (view full) ---

746 */
747 bf->bf_state.bfs_txflags &=
748 (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA);
749 bf->bf_state.bfs_txflags |=
750 bf_first->bf_state.bfs_txflags &
751 (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA);
752
753 /*
754 * TODO: If it's _before_ the BAW left edge, complain very
755 * loudly.
756 *
757 * This means something (else) has slid the left edge along
758 * before we got a chance to be TXed.
759 */
760
761 /*
762 * Check if we have space in the BAW for this frame before
763 * we add it.
764 *
765 * see ath_tx_xmit_aggr() for more info.
766 */
767 if (bf->bf_state.bfs_dobaw) {
768 ieee80211_seq seqno;
769
770 /*
771 * If the sequence number is allocated, use it.
772 * Otherwise, use the sequence number we WOULD
773 * allocate.
774 */
775 if (bf->bf_state.bfs_seqno_assigned)
776 seqno = SEQNO(bf->bf_state.bfs_seqno);
777 else
778 seqno = ni->ni_txseqs[bf->bf_state.bfs_tid];
779
780 /*
781 * Check whether either the currently allocated
782 * sequence number _OR_ the to-be allocated
783 * sequence number is inside the BAW.
784 */
785 if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd,
786 seqno)) {
787 status = ATH_AGGR_BAW_CLOSED;
788 break;
789 }
790
791 /* XXX check for bfs_need_seqno? */
792 if (! bf->bf_state.bfs_seqno_assigned) {
793 int seqno;
794 seqno = ath_tx_tid_seqno_assign(sc, ni, bf, bf->bf_m);
795 if (seqno < 0) {
796 device_printf(sc->sc_dev,
797 "%s: bf=%p, huh, seqno=-1?\n",
798 __func__,
799 bf);
800 /* XXX what can we even do here? */
801 }
802 /* Flush seqno update to RAM */
803 /*
804 * XXX This is required because the dmasetup
805 * XXX is done early rather than at dispatch
806 * XXX time. Ew, we should fix this!
807 */
808 bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap,
809 BUS_DMASYNC_PREWRITE);
810 }
811 }
812
813 /*
814 * If the packet has a sequence number, do not
815 * step outside of the block-ack window.
816 */
817 if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd,
818 SEQNO(bf->bf_state.bfs_seqno))) {
754 * If the packet has a sequence number, do not
755 * step outside of the block-ack window.
756 */
757 if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd,
758 SEQNO(bf->bf_state.bfs_seqno))) {
819 device_printf(sc->sc_dev,
820 "%s: bf=%p, seqno=%d, outside?!\n",
821 __func__, bf, SEQNO(bf->bf_state.bfs_seqno));
822 status = ATH_AGGR_BAW_CLOSED;
823 break;
824 }
825
826 /*
827 * this packet is part of an aggregate.
828 */
829 ATH_TXQ_REMOVE(tid, bf, bf_list);

--- 81 unchanged lines hidden ---
759 status = ATH_AGGR_BAW_CLOSED;
760 break;
761 }
762
763 /*
764 * this packet is part of an aggregate.
765 */
766 ATH_TXQ_REMOVE(tid, bf, bf_list);

--- 81 unchanged lines hidden ---