Deleted Added
sdiff udiff text old ( 218157 ) new ( 218240 )
full compact
1/*-
2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
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.c 218240 2011-02-03 20:30:17Z adrian $");
32
33/*
34 * Driver for the Atheros Wireless LAN controller.
35 *
36 * This software is derived from work of Atsushi Onoe; his contribution
37 * is greatly appreciated.
38 */
39

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

92#include <dev/ath/if_ath_debug.h>
93
94#ifdef ATH_TX99_DIAG
95#include <dev/ath/ath_tx99/ath_tx99.h>
96#endif
97
98#include <dev/ath/if_ath_misc.h>
99#include <dev/ath/if_ath_tx.h>
100#include <dev/ath/if_ath_tx_ht.h>
101
102/*
103 * Whether to use the 11n rate scenario functions or not
104 */
105static inline int
106ath_tx_is_11n(struct ath_softc *sc)
107{
108 return (sc->sc_ah->ah_magic == 0x20065416);

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

478 struct ath_txq *txq;
479 struct ieee80211_frame *wh;
480 u_int subtype, flags, ctsduration;
481 HAL_PKT_TYPE atype;
482 const HAL_RATE_TABLE *rt;
483 HAL_BOOL shortPreamble;
484 struct ath_node *an;
485 u_int pri;
486 uint8_t try[4], rate[4];
487
488 bzero(try, sizeof(try));
489 bzero(rate, sizeof(rate));
490
491 wh = mtod(m0, struct ieee80211_frame *);
492 iswep = wh->i_fc[1] & IEEE80211_FC1_WEP;
493 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
494 isfrag = m0->m_flags & M_FRAG;
495 hdrlen = ieee80211_anyhdrsize(wh);
496 /*
497 * Packet length must not include any
498 * pad bytes; deduct them here.

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

768 */
769 if (flags & HAL_TXDESC_INTREQ) {
770 txq->axq_intrcnt = 0;
771 } else if (++txq->axq_intrcnt >= sc->sc_txintrperiod) {
772 flags |= HAL_TXDESC_INTREQ;
773 txq->axq_intrcnt = 0;
774 }
775
776 if (ath_tx_is_11n(sc)) {
777 rate[0] = rix;
778 try[0] = try0;
779 }
780
781 /*
782 * Formulate first tx descriptor with tx controls.
783 */
784 /* XXX check return value? */
785 /* XXX is this ok to call for 11n descriptors? */
786 /* XXX or should it go through the first, next, last 11n calls? */
787 ath_hal_setuptxdesc(ah, ds
788 , pktlen /* packet length */
789 , hdrlen /* header length */
790 , atype /* Atheros packet type */
791 , ni->ni_txpower /* txpower */
792 , txrate, try0 /* series 0 rate/tries */
793 , keyix /* key cache index */
794 , sc->sc_txantenna /* antenna mode */

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

799 bf->bf_txflags = flags;
800 /*
801 * Setup the multi-rate retry state only when we're
802 * going to use it. This assumes ath_hal_setuptxdesc
803 * initializes the descriptors (so we don't have to)
804 * when the hardware supports multi-rate retry and
805 * we don't use it.
806 */
807 if (ismrr) {
808 if (ath_tx_is_11n(sc))
809 ath_rate_getxtxrates(sc, an, rix, rate, try);
810 else
811 ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix);
812 }
813
814 if (ath_tx_is_11n(sc)) {
815 ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, rate, try);
816 }
817
818 ath_tx_handoff(sc, txq, bf);
819 return 0;
820}
821
822static int
823ath_tx_raw_start(struct ath_softc *sc, struct ieee80211_node *ni,
824 struct ath_buf *bf, struct mbuf *m0,
825 const struct ieee80211_bpf_params *params)

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

832 int keyix, hdrlen, pktlen, try0, txantenna;
833 u_int8_t rix, cix, txrate, ctsrate, rate1, rate2, rate3;
834 struct ieee80211_frame *wh;
835 u_int flags, ctsduration;
836 HAL_PKT_TYPE atype;
837 const HAL_RATE_TABLE *rt;
838 struct ath_desc *ds;
839 u_int pri;
840 uint8_t try[4], rate[4];
841
842 bzero(try, sizeof(try));
843 bzero(rate, sizeof(rate));
844
845 wh = mtod(m0, struct ieee80211_frame *);
846 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
847 hdrlen = ieee80211_anyhdrsize(wh);
848 /*
849 * Packet length must not include any
850 * pad bytes; deduct them here.
851 */
852 /* XXX honor IEEE80211_BPF_DATAPAD */

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

944 , keyix /* key cache index */
945 , txantenna /* antenna mode */
946 , flags /* flags */
947 , ctsrate /* rts/cts rate */
948 , ctsduration /* rts/cts duration */
949 );
950 bf->bf_txflags = flags;
951
952 if (ath_tx_is_11n(sc)) {
953 rate[0] = ath_tx_findrix(sc, params->ibp_rate0);
954 try[0] = params->ibp_try0;
955
956 if (ismrr) {
957 /* Remember, rate[] is actually an array of rix's -adrian */
958 rate[0] = ath_tx_findrix(sc, params->ibp_rate0);
959 rate[1] = ath_tx_findrix(sc, params->ibp_rate1);
960 rate[2] = ath_tx_findrix(sc, params->ibp_rate2);
961 rate[3] = ath_tx_findrix(sc, params->ibp_rate3);
962
963 try[0] = params->ibp_try0;
964 try[1] = params->ibp_try1;
965 try[2] = params->ibp_try2;
966 try[3] = params->ibp_try3;
967 }
968 } else {
969 if (ismrr) {
970 rix = ath_tx_findrix(sc, params->ibp_rate1);
971 rate1 = rt->info[rix].rateCode;
972 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
973 rate1 |= rt->info[rix].shortPreamble;
974 if (params->ibp_try2) {
975 rix = ath_tx_findrix(sc, params->ibp_rate2);
976 rate2 = rt->info[rix].rateCode;
977 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
978 rate2 |= rt->info[rix].shortPreamble;
979 } else
980 rate2 = 0;
981 if (params->ibp_try3) {
982 rix = ath_tx_findrix(sc, params->ibp_rate3);
983 rate3 = rt->info[rix].rateCode;
984 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
985 rate3 |= rt->info[rix].shortPreamble;
986 } else
987 rate3 = 0;
988 ath_hal_setupxtxdesc(ah, ds
989 , rate1, params->ibp_try1 /* series 1 */
990 , rate2, params->ibp_try2 /* series 2 */
991 , rate3, params->ibp_try3 /* series 3 */
992 );
993 }
994 }
995
996 if (ath_tx_is_11n(sc)) {
997 /*
998 * notice that rix doesn't include any of the "magic" flags txrate
999 * does for communicating "other stuff" to the HAL.
1000 */
1001 ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, rate, try);
1002 }
1003
1004 /* NB: no buffered multicast in power save support */
1005 ath_tx_handoff(sc, sc->sc_ac2q[pri], bf);
1006 return 0;
1007}
1008
1009int
1010ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
1011 const struct ieee80211_bpf_params *params)

--- 60 unchanged lines hidden ---