Deleted Added
sdiff udiff text old ( 227360 ) new ( 227364 )
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 227360 2011-11-08 21:25:36Z 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

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

72#include <net80211/ieee80211_var.h>
73#include <net80211/ieee80211_regdomain.h>
74#ifdef IEEE80211_SUPPORT_SUPERG
75#include <net80211/ieee80211_superg.h>
76#endif
77#ifdef IEEE80211_SUPPORT_TDMA
78#include <net80211/ieee80211_tdma.h>
79#endif
80
81#include <net/bpf.h>
82
83#ifdef INET
84#include <netinet/in.h>
85#include <netinet/if_ether.h>
86#endif
87

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

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);
109}
110
111void
112ath_txfrag_cleanup(struct ath_softc *sc,
113 ath_bufhead *frags, struct ieee80211_node *ni)
114{
115 struct ath_buf *bf, *next;
116
117 ATH_TXBUF_LOCK_ASSERT(sc);
118

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

224
225 return 0;
226}
227
228/*
229 * Chain together segments+descriptors for a non-11n frame.
230 */
231static void
232ath_tx_chaindesclist(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf)
233{
234 struct ath_hal *ah = sc->sc_ah;
235 struct ath_desc *ds, *ds0;
236 int i;
237
238 /*
239 * Fillin the remainder of the descriptor info.
240 */

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

254 DPRINTF(sc, ATH_DEBUG_XMIT,
255 "%s: %d: %08x %08x %08x %08x %08x %08x\n",
256 __func__, i, ds->ds_link, ds->ds_data,
257 ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1]);
258 bf->bf_lastds = ds;
259 }
260}
261
262static void
263ath_tx_handoff(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf)
264{
265 struct ath_hal *ah = sc->sc_ah;
266
267 /* Fill in the details in the descriptor list */
268 ath_tx_chaindesclist(sc, txq, bf);
269
270 /*
271 * Insert the frame on the outbound list and pass it on
272 * to the hardware. Multicast frames buffered for power
273 * save stations and transmit from the CAB queue are stored
274 * on a s/w only queue and loaded on to the CAB queue in
275 * the SWBA handler since frames only go out on DTIM and
276 * to avoid possible races.
277 */
278 ATH_TXQ_LOCK(txq);
279 KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0,
280 ("busy status 0x%x", bf->bf_flags));
281 if (txq->axq_qnum != ATH_TXQ_SWQ) {
282#ifdef IEEE80211_SUPPORT_TDMA
283 int qbusy;
284
285 ATH_TXQ_INSERT_TAIL(txq, bf, bf_list);
286 qbusy = ath_hal_txqenabled(ah, txq->axq_qnum);
287 if (txq->axq_link == NULL) {
288 /*
289 * Be careful writing the address to TXDP. If

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

349 txq->axq_qnum, txq->axq_link,
350 (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth);
351 }
352#endif /* IEEE80211_SUPPORT_TDMA */
353 if (bf->bf_state.bfs_aggr)
354 txq->axq_aggr_depth++;
355 txq->axq_link = &bf->bf_lastds->ds_link;
356 ath_hal_txstart(ah, txq->axq_qnum);
357 } else {
358 if (txq->axq_link != NULL) {
359 struct ath_buf *last = ATH_TXQ_LAST(txq, axq_q_s);
360 struct ieee80211_frame *wh;
361
362 /* mark previous frame */
363 wh = mtod(last->bf_m, struct ieee80211_frame *);
364 wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA;
365 bus_dmamap_sync(sc->sc_dmat, last->bf_dmamap,
366 BUS_DMASYNC_PREWRITE);
367
368 /* link descriptor */
369 *txq->axq_link = bf->bf_daddr;
370 }
371 ATH_TXQ_INSERT_TAIL(txq, bf, bf_list);
372 txq->axq_link = &bf->bf_desc[bf->bf_nseg - 1].ds_link;
373 }
374 ATH_TXQ_UNLOCK(txq);
375}
376
377static int
378ath_tx_tag_crypto(struct ath_softc *sc, struct ieee80211_node *ni,
379 struct mbuf *m0, int iswep, int isfrag, int *hdrlen, int *pktlen, int *keyix)
380{
381 if (iswep) {
382 const struct ieee80211_cipher *cip;
383 struct ieee80211_key *k;
384

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

422 } else
423 (*keyix) = HAL_TXKEYIX_INVALID;
424
425 return 1;
426}
427
428static uint8_t
429ath_tx_get_rtscts_rate(struct ath_hal *ah, const HAL_RATE_TABLE *rt,
430 int rix, int cix, int shortPreamble)
431{
432 uint8_t ctsrate;
433
434 /*
435 * CTS transmit rate is derived from the transmit rate
436 * by looking in the h/w rate table. We must also factor
437 * in whether or not a short preamble is to be used.
438 */
439 /* NB: cix is set above where RTS/CTS is enabled */
440 KASSERT(cix != 0xff, ("cix not setup"));
441 ctsrate = rt->info[cix].rateCode;
442
443 /* XXX this should only matter for legacy rates */
444 if (shortPreamble)
445 ctsrate |= rt->info[cix].shortPreamble;
446
447 return ctsrate;
448}
449
450
451/*
452 * Calculate the RTS/CTS duration for legacy frames.
453 */
454static int
455ath_tx_calc_ctsduration(struct ath_hal *ah, int rix, int cix,
456 int shortPreamble, int pktlen, const HAL_RATE_TABLE *rt,
457 int flags)
458{

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

488 rt, pktlen, rix, AH_FALSE);
489 if ((flags & HAL_TXDESC_NOACK) == 0) /* SIFS + ACK */
490 ctsduration += rt->info[rix].lpAckDuration;
491 }
492
493 return ctsduration;
494}
495
496int
497ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
498 struct mbuf *m0)
499{
500 struct ieee80211vap *vap = ni->ni_vap;
501 struct ath_vap *avp = ATH_VAP(vap);
502 struct ath_hal *ah = sc->sc_ah;
503 struct ifnet *ifp = sc->sc_ifp;
504 struct ieee80211com *ic = ifp->if_l2com;
505 const struct chanAccParams *cap = &ic->ic_wme.wme_chanParams;
506 int error, iswep, ismcast, isfrag, ismrr;
507 int keyix, hdrlen, pktlen, try0;
508 u_int8_t rix, txrate, ctsrate;
509 u_int8_t cix = 0xff; /* NB: silence compiler */
510 struct ath_desc *ds;
511 struct ath_txq *txq;
512 struct ieee80211_frame *wh;
513 u_int subtype, flags, ctsduration;
514 HAL_PKT_TYPE atype;
515 const HAL_RATE_TABLE *rt;
516 HAL_BOOL shortPreamble;
517 struct ath_node *an;
518 u_int pri;
519 uint8_t try[4], rate[4];
520
521 bzero(try, sizeof(try));
522 bzero(rate, sizeof(rate));
523
524 wh = mtod(m0, struct ieee80211_frame *);
525 iswep = wh->i_fc[1] & IEEE80211_FC1_WEP;
526 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
527 isfrag = m0->m_flags & M_FRAG;
528 hdrlen = ieee80211_anyhdrsize(wh);
529 /*
530 * Packet length must not include any
531 * pad bytes; deduct them here.
532 */
533 pktlen = m0->m_pkthdr.len - (hdrlen & 3);
534
535 /* Handle encryption twiddling if needed */
536 if (! ath_tx_tag_crypto(sc, ni, m0, iswep, isfrag, &hdrlen, &pktlen, &keyix)) {
537 ath_freetx(m0);
538 return EIO;
539 }
540
541 /* packet header may have moved, reset our local pointer */
542 wh = mtod(m0, struct ieee80211_frame *);
543
544 pktlen += IEEE80211_CRC_LEN;

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

624 } else if (m0->m_flags & M_EAPOL) {
625 /* XXX? maybe always use long preamble? */
626 rix = an->an_mgmtrix;
627 txrate = rt->info[rix].rateCode;
628 if (shortPreamble)
629 txrate |= rt->info[rix].shortPreamble;
630 try0 = ATH_TXMAXTRY; /* XXX?too many? */
631 } else {
632 ath_rate_findrate(sc, an, shortPreamble, pktlen,
633 &rix, &try0, &txrate);
634 sc->sc_txrix = rix; /* for LED blinking */
635 sc->sc_lastdatarix = rix; /* for fast frames */
636 if (try0 != ATH_TXMAXTRY)
637 ismrr = 1;
638 }
639 if (cap->cap_wmeParams[pri].wmep_noackPolicy)
640 flags |= HAL_TXDESC_NOACK;
641 break;
642 default:
643 if_printf(ifp, "bogus frame type 0x%x (%s)\n",
644 wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK, __func__);
645 /* XXX statistic */

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

660 /*
661 * Calculate miscellaneous flags.
662 */
663 if (ismcast) {
664 flags |= HAL_TXDESC_NOACK; /* no ack on broad/multicast */
665 } else if (pktlen > vap->iv_rtsthreshold &&
666 (ni->ni_ath_flags & IEEE80211_NODE_FF) == 0) {
667 flags |= HAL_TXDESC_RTSENA; /* RTS based on frame length */
668 cix = rt->info[rix].controlRate;
669 sc->sc_stats.ast_tx_rts++;
670 }
671 if (flags & HAL_TXDESC_NOACK) /* NB: avoid double counting */
672 sc->sc_stats.ast_tx_noack++;
673#ifdef IEEE80211_SUPPORT_TDMA
674 if (sc->sc_tdma && (flags & HAL_TXDESC_NOACK) == 0) {
675 DPRINTF(sc, ATH_DEBUG_TDMA,
676 "%s: discard frame, ACK required w/ TDMA\n", __func__);

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

683 /*
684 * If 802.11g protection is enabled, determine whether
685 * to use RTS/CTS or just CTS. Note that this is only
686 * done for OFDM unicast frames.
687 */
688 if ((ic->ic_flags & IEEE80211_F_USEPROT) &&
689 rt->info[rix].phy == IEEE80211_T_OFDM &&
690 (flags & HAL_TXDESC_NOACK) == 0) {
691 /* XXX fragments must use CCK rates w/ protection */
692 if (ic->ic_protmode == IEEE80211_PROT_RTSCTS)
693 flags |= HAL_TXDESC_RTSENA;
694 else if (ic->ic_protmode == IEEE80211_PROT_CTSONLY)
695 flags |= HAL_TXDESC_CTSENA;
696 if (isfrag) {
697 /*
698 * For frags it would be desirable to use the
699 * highest CCK rate for RTS/CTS. But stations
700 * farther away may detect it at a lower CCK rate
701 * so use the configured protection rate instead
702 * (for now).
703 */
704 cix = rt->info[sc->sc_protrix].controlRate;
705 } else
706 cix = rt->info[sc->sc_protrix].controlRate;
707 sc->sc_stats.ast_tx_protect++;
708 }
709
710#if 0
711 /*
712 * If 11n protection is enabled and it's a HT frame,
713 * enable RTS.
714 *

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

756 */
757 ismrr = 0;
758 try0 = ATH_TXMGTTRY; /* XXX? */
759 }
760 *(u_int16_t *)wh->i_dur = htole16(dur);
761 }
762
763 /*
764 * Calculate RTS/CTS rate and duration if needed.
765 */
766 ctsduration = 0;
767 if (flags & (HAL_TXDESC_RTSENA|HAL_TXDESC_CTSENA)) {
768 ctsrate = ath_tx_get_rtscts_rate(ah, rt, rix, cix, shortPreamble);
769
770 /* The 11n chipsets do ctsduration calculations for you */
771 if (! ath_tx_is_11n(sc))
772 ctsduration = ath_tx_calc_ctsduration(ah, rix, cix, shortPreamble,
773 pktlen, rt, flags);
774 /*
775 * Must disable multi-rate retry when using RTS/CTS.
776 */
777 ismrr = 0;
778 try0 = ATH_TXMGTTRY; /* XXX */
779 } else
780 ctsrate = 0;
781
782 /*
783 * At this point we are committed to sending the frame
784 * and we don't need to look at m_nextpkt; clear it in
785 * case this frame is part of frag chain.
786 */
787 m0->m_nextpkt = NULL;
788

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

801 sc->sc_tx_th.wt_flags |= IEEE80211_RADIOTAP_F_FRAG;
802 sc->sc_tx_th.wt_rate = sc->sc_hwmap[rix].ieeerate;
803 sc->sc_tx_th.wt_txpower = ni->ni_txpower;
804 sc->sc_tx_th.wt_antenna = sc->sc_txantenna;
805
806 ieee80211_radiotap_tx(vap, m0);
807 }
808
809 /*
810 * Determine if a tx interrupt should be generated for
811 * this descriptor. We take a tx interrupt to reap
812 * descriptors when the h/w hits an EOL condition or
813 * when the descriptor is specifically marked to generate
814 * an interrupt. We periodically mark descriptors in this
815 * way to insure timely replenishing of the supply needed
816 * for sending frames. Defering interrupts reduces system
817 * load and potentially allows more concurrent work to be
818 * done but if done to aggressively can cause senders to
819 * backup.
820 *
821 * NB: use >= to deal with sc_txintrperiod changing
822 * dynamically through sysctl.
823 */
824 if (flags & HAL_TXDESC_INTREQ) {
825 txq->axq_intrcnt = 0;
826 } else if (++txq->axq_intrcnt >= sc->sc_txintrperiod) {
827 flags |= HAL_TXDESC_INTREQ;
828 txq->axq_intrcnt = 0;
829 }
830
831 if (ath_tx_is_11n(sc)) {
832 rate[0] = rix;
833 try[0] = try0;
834 }
835
836 /*
837 * Formulate first tx descriptor with tx controls.
838 */
839 /* XXX check return value? */
840 /* XXX is this ok to call for 11n descriptors? */
841 /* XXX or should it go through the first, next, last 11n calls? */
842 ath_hal_setuptxdesc(ah, ds
843 , pktlen /* packet length */
844 , hdrlen /* header length */
845 , atype /* Atheros packet type */
846 , ni->ni_txpower /* txpower */
847 , txrate, try0 /* series 0 rate/tries */
848 , keyix /* key cache index */
849 , sc->sc_txantenna /* antenna mode */
850 , flags /* flags */
851 , ctsrate /* rts/cts rate */
852 , ctsduration /* rts/cts duration */
853 );
854 bf->bf_txflags = flags;
855 /*
856 * Setup the multi-rate retry state only when we're
857 * going to use it. This assumes ath_hal_setuptxdesc
858 * initializes the descriptors (so we don't have to)
859 * when the hardware supports multi-rate retry and
860 * we don't use it.
861 */
862 if (ismrr) {
863 if (ath_tx_is_11n(sc))
864 ath_rate_getxtxrates(sc, an, rix, rate, try);
865 else
866 ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix);
867 }
868
869 if (ath_tx_is_11n(sc)) {
870 ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, (atype == HAL_PKT_TYPE_PSPOLL), rate, try);
871 }
872
873 ath_tx_handoff(sc, txq, bf);
874 return 0;
875}
876
877static int
878ath_tx_raw_start(struct ath_softc *sc, struct ieee80211_node *ni,
879 struct ath_buf *bf, struct mbuf *m0,
880 const struct ieee80211_bpf_params *params)
881{
882 struct ifnet *ifp = sc->sc_ifp;
883 struct ieee80211com *ic = ifp->if_l2com;
884 struct ath_hal *ah = sc->sc_ah;
885 struct ieee80211vap *vap = ni->ni_vap;
886 int error, ismcast, ismrr;
887 int keyix, hdrlen, pktlen, try0, txantenna;
888 u_int8_t rix, cix, txrate, ctsrate, rate1, rate2, rate3;
889 struct ieee80211_frame *wh;
890 u_int flags, ctsduration;
891 HAL_PKT_TYPE atype;
892 const HAL_RATE_TABLE *rt;
893 struct ath_desc *ds;
894 u_int pri;
895 uint8_t try[4], rate[4];
896
897 bzero(try, sizeof(try));
898 bzero(rate, sizeof(rate));
899
900 wh = mtod(m0, struct ieee80211_frame *);
901 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
902 hdrlen = ieee80211_anyhdrsize(wh);
903 /*
904 * Packet length must not include any
905 * pad bytes; deduct them here.
906 */
907 /* XXX honor IEEE80211_BPF_DATAPAD */
908 pktlen = m0->m_pkthdr.len - (hdrlen & 3) + IEEE80211_CRC_LEN;
909
910 /* Handle encryption twiddling if needed */
911 if (! ath_tx_tag_crypto(sc, ni, m0, params->ibp_flags & IEEE80211_BPF_CRYPTO, 0, &hdrlen, &pktlen, &keyix)) {
912 ath_freetx(m0);
913 return EIO;
914 }
915 /* packet header may have moved, reset our local pointer */
916 wh = mtod(m0, struct ieee80211_frame *);
917
918 error = ath_tx_dmasetup(sc, bf, m0);
919 if (error != 0)
920 return error;
921 m0 = bf->bf_m; /* NB: may have changed */
922 wh = mtod(m0, struct ieee80211_frame *);
923 bf->bf_node = ni; /* NB: held reference */
924
925 flags = HAL_TXDESC_CLRDMASK; /* XXX needed for crypto errs */
926 flags |= HAL_TXDESC_INTREQ; /* force interrupt */
927 if (params->ibp_flags & IEEE80211_BPF_RTS)
928 flags |= HAL_TXDESC_RTSENA;
929 else if (params->ibp_flags & IEEE80211_BPF_CTS)
930 flags |= HAL_TXDESC_CTSENA;
931 /* XXX leave ismcast to injector? */
932 if ((params->ibp_flags & IEEE80211_BPF_NOACK) || ismcast)
933 flags |= HAL_TXDESC_NOACK;
934
935 rt = sc->sc_currates;
936 KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
937 rix = ath_tx_findrix(sc, params->ibp_rate0);
938 txrate = rt->info[rix].rateCode;
939 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
940 txrate |= rt->info[rix].shortPreamble;
941 sc->sc_txrix = rix;
942 try0 = params->ibp_try0;
943 ismrr = (params->ibp_try1 != 0);
944 txantenna = params->ibp_pri >> 2;
945 if (txantenna == 0) /* XXX? */
946 txantenna = sc->sc_txantenna;
947
948 ctsduration = 0;
949 if (flags & (HAL_TXDESC_RTSENA|HAL_TXDESC_CTSENA)) {
950 cix = ath_tx_findrix(sc, params->ibp_ctsrate);
951 ctsrate = ath_tx_get_rtscts_rate(ah, rt, rix, cix, params->ibp_flags & IEEE80211_BPF_SHORTPRE);
952 /* The 11n chipsets do ctsduration calculations for you */
953 if (! ath_tx_is_11n(sc))
954 ctsduration = ath_tx_calc_ctsduration(ah, rix, cix,
955 params->ibp_flags & IEEE80211_BPF_SHORTPRE, pktlen,
956 rt, flags);
957 /*
958 * Must disable multi-rate retry when using RTS/CTS.
959 */
960 ismrr = 0; /* XXX */
961 } else
962 ctsrate = 0;
963
964 pri = params->ibp_pri & 3;
965 /*
966 * NB: we mark all packets as type PSPOLL so the h/w won't
967 * set the sequence number, duration, etc.
968 */
969 atype = HAL_PKT_TYPE_PSPOLL;
970
971 if (IFF_DUMPPKTS(sc, ATH_DEBUG_XMIT))
972 ieee80211_dump_pkt(ic, mtod(m0, caddr_t), m0->m_len,

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

988 ieee80211_radiotap_tx(vap, m0);
989 }
990
991 /*
992 * Formulate first tx descriptor with tx controls.
993 */
994 ds = bf->bf_desc;
995 /* XXX check return value? */
996 ath_hal_setuptxdesc(ah, ds
997 , pktlen /* packet length */
998 , hdrlen /* header length */
999 , atype /* Atheros packet type */
1000 , params->ibp_power /* txpower */
1001 , txrate, try0 /* series 0 rate/tries */
1002 , keyix /* key cache index */
1003 , txantenna /* antenna mode */
1004 , flags /* flags */
1005 , ctsrate /* rts/cts rate */
1006 , ctsduration /* rts/cts duration */
1007 );
1008 bf->bf_txflags = flags;
1009
1010 if (ath_tx_is_11n(sc)) {
1011 rate[0] = ath_tx_findrix(sc, params->ibp_rate0);
1012 try[0] = params->ibp_try0;
1013
1014 if (ismrr) {
1015 /* Remember, rate[] is actually an array of rix's -adrian */
1016 rate[0] = ath_tx_findrix(sc, params->ibp_rate0);
1017 rate[1] = ath_tx_findrix(sc, params->ibp_rate1);
1018 rate[2] = ath_tx_findrix(sc, params->ibp_rate2);
1019 rate[3] = ath_tx_findrix(sc, params->ibp_rate3);
1020
1021 try[0] = params->ibp_try0;
1022 try[1] = params->ibp_try1;
1023 try[2] = params->ibp_try2;
1024 try[3] = params->ibp_try3;
1025 }
1026 } else {
1027 if (ismrr) {
1028 rix = ath_tx_findrix(sc, params->ibp_rate1);
1029 rate1 = rt->info[rix].rateCode;
1030 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
1031 rate1 |= rt->info[rix].shortPreamble;
1032 if (params->ibp_try2) {
1033 rix = ath_tx_findrix(sc, params->ibp_rate2);
1034 rate2 = rt->info[rix].rateCode;
1035 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
1036 rate2 |= rt->info[rix].shortPreamble;
1037 } else
1038 rate2 = 0;
1039 if (params->ibp_try3) {
1040 rix = ath_tx_findrix(sc, params->ibp_rate3);
1041 rate3 = rt->info[rix].rateCode;
1042 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
1043 rate3 |= rt->info[rix].shortPreamble;
1044 } else
1045 rate3 = 0;
1046 ath_hal_setupxtxdesc(ah, ds
1047 , rate1, params->ibp_try1 /* series 1 */
1048 , rate2, params->ibp_try2 /* series 2 */
1049 , rate3, params->ibp_try3 /* series 3 */
1050 );
1051 }
1052 }
1053
1054 if (ath_tx_is_11n(sc)) {
1055 /*
1056 * notice that rix doesn't include any of the "magic" flags txrate
1057 * does for communicating "other stuff" to the HAL.
1058 */
1059 ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, (atype == HAL_PKT_TYPE_PSPOLL), rate, try);
1060 }
1061
1062 /* NB: no buffered multicast in power save support */
1063 ath_tx_handoff(sc, sc->sc_ac2q[pri], bf);
1064 return 0;
1065}
1066
1067int
1068ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
1069 const struct ieee80211_bpf_params *params)
1070{
1071 struct ieee80211com *ic = ni->ni_ic;
1072 struct ifnet *ifp = ic->ic_ifp;
1073 struct ath_softc *sc = ifp->if_softc;
1074 struct ath_buf *bf;

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

1122 TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list);
1123 ATH_TXBUF_UNLOCK(sc);
1124bad:
1125 ifp->if_oerrors++;
1126 sc->sc_stats.ast_tx_raw_fail++;
1127 ieee80211_free_node(ni);
1128 return error;
1129}