if_ath_tx.c (218157) | if_ath_tx.c (218240) |
---|---|
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> | 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 218157 2011-02-01 07:50:26Z adrian $"); | 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> | 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> |
|
100 101/* 102 * Whether to use the 11n rate scenario functions or not 103 */ 104static inline int 105ath_tx_is_11n(struct ath_softc *sc) 106{ 107 return (sc->sc_ah->ah_magic == 0x20065416); --- 369 unchanged lines hidden (view full) --- 477 struct ath_txq *txq; 478 struct ieee80211_frame *wh; 479 u_int subtype, flags, ctsduration; 480 HAL_PKT_TYPE atype; 481 const HAL_RATE_TABLE *rt; 482 HAL_BOOL shortPreamble; 483 struct ath_node *an; 484 u_int pri; | 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]; |
|
485 | 487 |
488 bzero(try, sizeof(try)); 489 bzero(rate, sizeof(rate)); 490 |
|
486 wh = mtod(m0, struct ieee80211_frame *); 487 iswep = wh->i_fc[1] & IEEE80211_FC1_WEP; 488 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); 489 isfrag = m0->m_flags & M_FRAG; 490 hdrlen = ieee80211_anyhdrsize(wh); 491 /* 492 * Packet length must not include any 493 * pad bytes; deduct them here. --- 269 unchanged lines hidden (view full) --- 763 */ 764 if (flags & HAL_TXDESC_INTREQ) { 765 txq->axq_intrcnt = 0; 766 } else if (++txq->axq_intrcnt >= sc->sc_txintrperiod) { 767 flags |= HAL_TXDESC_INTREQ; 768 txq->axq_intrcnt = 0; 769 } 770 | 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 |
|
771 /* 772 * Formulate first tx descriptor with tx controls. 773 */ 774 /* XXX check return value? */ | 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? */ |
|
775 ath_hal_setuptxdesc(ah, ds 776 , pktlen /* packet length */ 777 , hdrlen /* header length */ 778 , atype /* Atheros packet type */ 779 , ni->ni_txpower /* txpower */ 780 , txrate, try0 /* series 0 rate/tries */ 781 , keyix /* key cache index */ 782 , sc->sc_txantenna /* antenna mode */ --- 4 unchanged lines hidden (view full) --- 787 bf->bf_txflags = flags; 788 /* 789 * Setup the multi-rate retry state only when we're 790 * going to use it. This assumes ath_hal_setuptxdesc 791 * initializes the descriptors (so we don't have to) 792 * when the hardware supports multi-rate retry and 793 * we don't use it. 794 */ | 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 */ |
795 if (ismrr) 796 ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix); | 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 } |
797 | 813 |
814 if (ath_tx_is_11n(sc)) { 815 ath_buf_set_rate(sc, ni, bf, pktlen, flags, ctsrate, rate, try); 816 } 817 |
|
798 ath_tx_handoff(sc, txq, bf); 799 return 0; 800} 801 802static int 803ath_tx_raw_start(struct ath_softc *sc, struct ieee80211_node *ni, 804 struct ath_buf *bf, struct mbuf *m0, 805 const struct ieee80211_bpf_params *params) --- 6 unchanged lines hidden (view full) --- 812 int keyix, hdrlen, pktlen, try0, txantenna; 813 u_int8_t rix, cix, txrate, ctsrate, rate1, rate2, rate3; 814 struct ieee80211_frame *wh; 815 u_int flags, ctsduration; 816 HAL_PKT_TYPE atype; 817 const HAL_RATE_TABLE *rt; 818 struct ath_desc *ds; 819 u_int pri; | 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]; |
|
820 | 841 |
842 bzero(try, sizeof(try)); 843 bzero(rate, sizeof(rate)); 844 |
|
821 wh = mtod(m0, struct ieee80211_frame *); 822 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); 823 hdrlen = ieee80211_anyhdrsize(wh); 824 /* 825 * Packet length must not include any 826 * pad bytes; deduct them here. 827 */ 828 /* XXX honor IEEE80211_BPF_DATAPAD */ --- 91 unchanged lines hidden (view full) --- 920 , keyix /* key cache index */ 921 , txantenna /* antenna mode */ 922 , flags /* flags */ 923 , ctsrate /* rts/cts rate */ 924 , ctsduration /* rts/cts duration */ 925 ); 926 bf->bf_txflags = flags; 927 | 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 |
928 if (ismrr) { 929 rix = ath_tx_findrix(sc, params->ibp_rate1); 930 rate1 = rt->info[rix].rateCode; 931 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) 932 rate1 |= rt->info[rix].shortPreamble; 933 if (params->ibp_try2) { 934 rix = ath_tx_findrix(sc, params->ibp_rate2); 935 rate2 = rt->info[rix].rateCode; | 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; |
936 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) | 972 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) |
937 rate2 |= rt->info[rix].shortPreamble; 938 } else 939 rate2 = 0; 940 if (params->ibp_try3) { 941 rix = ath_tx_findrix(sc, params->ibp_rate3); 942 rate3 = rt->info[rix].rateCode; 943 if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) 944 rate3 |= rt->info[rix].shortPreamble; 945 } else 946 rate3 = 0; 947 ath_hal_setupxtxdesc(ah, ds 948 , rate1, params->ibp_try1 /* series 1 */ 949 , rate2, params->ibp_try2 /* series 2 */ 950 , rate3, params->ibp_try3 /* series 3 */ 951 ); | 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 } |
952 } 953 | 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 |
|
954 /* NB: no buffered multicast in power save support */ 955 ath_tx_handoff(sc, sc->sc_ac2q[pri], bf); 956 return 0; 957} 958 959int 960ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, 961 const struct ieee80211_bpf_params *params) --- 60 unchanged lines hidden --- | 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 --- |