aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-01-30 03:59:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-09 15:03:44 -0500
commitc89424df441ea8d794682b9c5620d8e8b0315438 (patch)
tree1638bf3e6e8bf0bace48f99ac9884df71683fad4 /drivers/net
parent3900898c7a3d563d14a1288f483f8a589bd38299 (diff)
ath9k: Handle mac80211's RC flags for MCS rates
mac80211 notifies the RC algorithm if RTS/CTS and short preamble are needed. The RC flags for MCS rates are currently not handled by mac80211, and ath9k's RC doesn't set the flags either. Fix this. Also, set the rts_cts_rate_idx inside the RC algorithm. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath9k/core.h8
-rw-r--r--drivers/net/wireless/ath9k/mac.c3
-rw-r--r--drivers/net/wireless/ath9k/rc.c82
-rw-r--r--drivers/net/wireless/ath9k/xmit.c135
4 files changed, 111 insertions, 117 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 9a7bb1b5cd51..8683fc8ddb3c 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -233,7 +233,6 @@ struct ath_buf_state {
233#define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT) 233#define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT)
234#define bf_isretried(bf) (bf->bf_state.bf_type & BUF_RETRY) 234#define bf_isretried(bf) (bf->bf_state.bf_type & BUF_RETRY)
235#define bf_isxretried(bf) (bf->bf_state.bf_type & BUF_XRETRY) 235#define bf_isxretried(bf) (bf->bf_state.bf_type & BUF_XRETRY)
236#define bf_isshpreamble(bf) (bf->bf_state.bf_type & BUF_SHORT_PREAMBLE)
237#define bf_isbar(bf) (bf->bf_state.bf_type & BUF_BAR) 236#define bf_isbar(bf) (bf->bf_state.bf_type & BUF_BAR)
238#define bf_ispspoll(bf) (bf->bf_state.bf_type & BUF_PSPOLL) 237#define bf_ispspoll(bf) (bf->bf_state.bf_type & BUF_PSPOLL)
239#define bf_isaggrburst(bf) (bf->bf_state.bf_type & BUF_AGGR_BURST) 238#define bf_isaggrburst(bf) (bf->bf_state.bf_type & BUF_AGGR_BURST)
@@ -658,12 +657,6 @@ struct ath_rfkill {
658#define ATH_RSSI_DUMMY_MARKER 0x127 657#define ATH_RSSI_DUMMY_MARKER 0x127
659#define ATH_RATE_DUMMY_MARKER 0 658#define ATH_RATE_DUMMY_MARKER 0
660 659
661enum PROT_MODE {
662 PROT_M_NONE = 0,
663 PROT_M_RTSCTS,
664 PROT_M_CTSONLY
665};
666
667#define SC_OP_INVALID BIT(0) 660#define SC_OP_INVALID BIT(0)
668#define SC_OP_BEACONS BIT(1) 661#define SC_OP_BEACONS BIT(1)
669#define SC_OP_RXAGGR BIT(2) 662#define SC_OP_RXAGGR BIT(2)
@@ -715,7 +708,6 @@ struct ath_softc {
715 u8 sc_splitmic; 708 u8 sc_splitmic;
716 atomic_t ps_usecount; 709 atomic_t ps_usecount;
717 enum ath9k_int sc_imask; 710 enum ath9k_int sc_imask;
718 enum PROT_MODE sc_protmode;
719 enum ath9k_ht_extprotspacing sc_ht_extprotspacing; 711 enum ath9k_ht_extprotspacing sc_ht_extprotspacing;
720 enum ath9k_ht_macmode tx_chan_width; 712 enum ath9k_ht_macmode tx_chan_width;
721 713
diff --git a/drivers/net/wireless/ath9k/mac.c b/drivers/net/wireless/ath9k/mac.c
index ef832a5ebbd8..2427c44a8c35 100644
--- a/drivers/net/wireless/ath9k/mac.c
+++ b/drivers/net/wireless/ath9k/mac.c
@@ -344,9 +344,6 @@ void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
344 struct ar5416_desc *last_ads = AR5416DESC(lastds); 344 struct ar5416_desc *last_ads = AR5416DESC(lastds);
345 u32 ds_ctl0; 345 u32 ds_ctl0;
346 346
347 (void) nseries;
348 (void) rtsctsDuration;
349
350 if (flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA)) { 347 if (flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA)) {
351 ds_ctl0 = ads->ds_ctl0; 348 ds_ctl0 = ads->ds_ctl0;
352 349
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 8bc7bb50c7fc..a8c4f9757eb1 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -747,14 +747,17 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
747 return rate; 747 return rate;
748} 748}
749 749
750static void ath_rc_rate_set_series(struct ath_rate_table *rate_table , 750static void ath_rc_rate_set_series(struct ath_rate_table *rate_table,
751 struct ieee80211_tx_rate *rate, 751 struct ieee80211_tx_rate *rate,
752 struct ieee80211_tx_rate_control *txrc,
752 u8 tries, u8 rix, int rtsctsenable) 753 u8 tries, u8 rix, int rtsctsenable)
753{ 754{
754 rate->count = tries; 755 rate->count = tries;
755 rate->idx = rix; 756 rate->idx = rix;
756 757
757 if (rtsctsenable) 758 if (txrc->short_preamble)
759 rate->flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE;
760 if (txrc->rts || rtsctsenable)
758 rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS; 761 rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS;
759 if (WLAN_RC_PHY_40(rate_table->info[rix].phy)) 762 if (WLAN_RC_PHY_40(rate_table->info[rix].phy))
760 rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; 763 rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
@@ -764,6 +767,43 @@ static void ath_rc_rate_set_series(struct ath_rate_table *rate_table ,
764 rate->flags |= IEEE80211_TX_RC_MCS; 767 rate->flags |= IEEE80211_TX_RC_MCS;
765} 768}
766 769
770static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
771 struct ath_rate_table *rate_table,
772 struct ieee80211_tx_info *tx_info)
773{
774 struct ieee80211_tx_rate *rates = tx_info->control.rates;
775 int i = 0, rix = 0, cix, enable_g_protection = 0;
776
777 /* get the cix for the lowest valid rix */
778 for (i = 3; i >= 0; i--) {
779 if (rates[i].count && (rates[i].idx >= 0)) {
780 rix = rates[i].idx;
781 break;
782 }
783 }
784 cix = rate_table->info[rix].ctrl_rate;
785
786 /* All protection frames are transmited at 2Mb/s for 802.11g,
787 * otherwise we transmit them at 1Mb/s */
788 if (sc->hw->conf.channel->band == IEEE80211_BAND_2GHZ &&
789 !conf_is_ht(&sc->hw->conf))
790 enable_g_protection = 1;
791
792 /*
793 * If 802.11g protection is enabled, determine whether to use RTS/CTS or
794 * just CTS. Note that this is only done for OFDM/HT unicast frames.
795 */
796 if ((sc->sc_flags & SC_OP_PROTECT_ENABLE) &&
797 !(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
798 (rate_table->info[rix].phy == WLAN_RC_PHY_OFDM ||
799 WLAN_RC_PHY_HT(rate_table->info[rix].phy))) {
800 rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT;
801 cix = rate_table->info[enable_g_protection].ctrl_rate;
802 }
803
804 tx_info->control.rts_cts_rate_idx = cix;
805}
806
767static u8 ath_rc_rate_getidx(struct ath_softc *sc, 807static u8 ath_rc_rate_getidx(struct ath_softc *sc,
768 struct ath_rate_priv *ath_rc_priv, 808 struct ath_rate_priv *ath_rc_priv,
769 struct ath_rate_table *rate_table, 809 struct ath_rate_table *rate_table,
@@ -801,6 +841,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
801 struct sk_buff *skb = txrc->skb; 841 struct sk_buff *skb = txrc->skb;
802 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 842 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
803 struct ieee80211_tx_rate *rates = tx_info->control.rates; 843 struct ieee80211_tx_rate *rates = tx_info->control.rates;
844 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
845 __le16 fc = hdr->frame_control;
804 u8 try_per_rate = 0, i = 0, rix, nrix; 846 u8 try_per_rate = 0, i = 0, rix, nrix;
805 int is_probe = 0; 847 int is_probe = 0;
806 848
@@ -811,7 +853,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
811 if (is_probe) { 853 if (is_probe) {
812 /* set one try for probe rates. For the 854 /* set one try for probe rates. For the
813 * probes don't enable rts */ 855 * probes don't enable rts */
814 ath_rc_rate_set_series(rate_table, &rates[i++], 856 ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
815 1, nrix, 0); 857 1, nrix, 0);
816 858
817 try_per_rate = (ATH_11N_TXMAXTRY/4); 859 try_per_rate = (ATH_11N_TXMAXTRY/4);
@@ -820,12 +862,12 @@ static void ath_rc_ratefind(struct ath_softc *sc,
820 */ 862 */
821 nrix = ath_rc_rate_getidx(sc, ath_rc_priv, 863 nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
822 rate_table, nrix, 1, 0); 864 rate_table, nrix, 1, 0);
823 ath_rc_rate_set_series(rate_table, &rates[i++], 865 ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
824 try_per_rate, nrix, 0); 866 try_per_rate, nrix, 0);
825 } else { 867 } else {
826 try_per_rate = (ATH_11N_TXMAXTRY/4); 868 try_per_rate = (ATH_11N_TXMAXTRY/4);
827 /* Set the choosen rate. No RTS for first series entry. */ 869 /* Set the choosen rate. No RTS for first series entry. */
828 ath_rc_rate_set_series(rate_table, &rates[i++], 870 ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
829 try_per_rate, nrix, 0); 871 try_per_rate, nrix, 0);
830 } 872 }
831 873
@@ -841,7 +883,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
841 nrix = ath_rc_rate_getidx(sc, ath_rc_priv, 883 nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
842 rate_table, nrix, 1, min_rate); 884 rate_table, nrix, 1, min_rate);
843 /* All other rates in the series have RTS enabled */ 885 /* All other rates in the series have RTS enabled */
844 ath_rc_rate_set_series(rate_table, &rates[i], 886 ath_rc_rate_set_series(rate_table, &rates[i], txrc,
845 try_num, nrix, 1); 887 try_num, nrix, 1);
846 } 888 }
847 889
@@ -871,6 +913,24 @@ static void ath_rc_ratefind(struct ath_softc *sc,
871 rates[3].flags = rates[2].flags; 913 rates[3].flags = rates[2].flags;
872 } 914 }
873 } 915 }
916
917 /*
918 * Force hardware to use computed duration for next
919 * fragment by disabling multi-rate retry, which
920 * updates duration based on the multi-rate duration table.
921 *
922 * FIXME: Fix duration
923 */
924 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
925 (ieee80211_has_morefrags(fc) ||
926 (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG))) {
927 rates[1].count = rates[2].count = rates[3].count = 0;
928 rates[1].idx = rates[2].idx = rates[3].idx = 0;
929 rates[0].count = ATH_TXMAXTRY;
930 }
931
932 /* Setup RTS/CTS */
933 ath_rc_rate_set_rtscts(sc, rate_table, tx_info);
874} 934}
875 935
876static bool ath_rc_update_per(struct ath_softc *sc, 936static bool ath_rc_update_per(struct ath_softc *sc,
@@ -1385,16 +1445,16 @@ static void ath_rc_init(struct ath_softc *sc,
1385 if (!rateset->rs_nrates) { 1445 if (!rateset->rs_nrates) {
1386 /* No working rate, just initialize valid rates */ 1446 /* No working rate, just initialize valid rates */
1387 hi = ath_rc_init_validrates(ath_rc_priv, rate_table, 1447 hi = ath_rc_init_validrates(ath_rc_priv, rate_table,
1388 ath_rc_priv->ht_cap); 1448 ath_rc_priv->ht_cap);
1389 } else { 1449 } else {
1390 /* Use intersection of working rates and valid rates */ 1450 /* Use intersection of working rates and valid rates */
1391 hi = ath_rc_setvalid_rates(ath_rc_priv, rate_table, 1451 hi = ath_rc_setvalid_rates(ath_rc_priv, rate_table,
1392 rateset, ath_rc_priv->ht_cap); 1452 rateset, ath_rc_priv->ht_cap);
1393 if (ath_rc_priv->ht_cap & WLAN_RC_HT_FLAG) { 1453 if (ath_rc_priv->ht_cap & WLAN_RC_HT_FLAG) {
1394 hthi = ath_rc_setvalid_htrates(ath_rc_priv, 1454 hthi = ath_rc_setvalid_htrates(ath_rc_priv,
1395 rate_table, 1455 rate_table,
1396 ht_mcs, 1456 ht_mcs,
1397 ath_rc_priv->ht_cap); 1457 ath_rc_priv->ht_cap);
1398 } 1458 }
1399 hi = A_MAX(hi, hthi); 1459 hi = A_MAX(hi, hthi);
1400 } 1460 }
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index d483f3c13501..e14bceaef125 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -1386,8 +1386,6 @@ static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb,
1386 1386
1387 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) 1387 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
1388 flags |= ATH9K_TXDESC_NOACK; 1388 flags |= ATH9K_TXDESC_NOACK;
1389 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
1390 flags |= ATH9K_TXDESC_RTSENA;
1391 1389
1392 return flags; 1390 return flags;
1393} 1391}
@@ -1433,137 +1431,86 @@ static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, struct ath_buf *bf,
1433 1431
1434static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) 1432static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
1435{ 1433{
1436 struct ath_hal *ah = sc->sc_ah; 1434 struct ath_rate_table *rt = sc->cur_rate_table;
1437 struct ath_rate_table *rt;
1438 struct ath_desc *ds = bf->bf_desc;
1439 struct ath_desc *lastds = bf->bf_lastbf->bf_desc;
1440 struct ath9k_11n_rate_series series[4]; 1435 struct ath9k_11n_rate_series series[4];
1441 struct sk_buff *skb; 1436 struct sk_buff *skb;
1442 struct ieee80211_tx_info *tx_info; 1437 struct ieee80211_tx_info *tx_info;
1443 struct ieee80211_tx_rate *rates; 1438 struct ieee80211_tx_rate *rates;
1444 struct ieee80211_hdr *hdr; 1439 int i, flags = 0;
1445 struct ieee80211_hw *hw = sc->hw; 1440 u8 rix = 0, ctsrate = 0;
1446 int i, flags, rtsctsena = 0, enable_g_protection = 0;
1447 u32 ctsduration = 0;
1448 u8 rix = 0, cix, ctsrate = 0;
1449 __le16 fc;
1450 1441
1451 memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4); 1442 memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
1452 1443
1453 skb = (struct sk_buff *)bf->bf_mpdu; 1444 skb = (struct sk_buff *)bf->bf_mpdu;
1454 hdr = (struct ieee80211_hdr *)skb->data;
1455 fc = hdr->frame_control;
1456 tx_info = IEEE80211_SKB_CB(skb); 1445 tx_info = IEEE80211_SKB_CB(skb);
1457 rates = tx_info->control.rates; 1446 rates = tx_info->control.rates;
1458 1447
1459 if (ieee80211_has_morefrags(fc) ||
1460 (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) {
1461 rates[1].count = rates[2].count = rates[3].count = 0;
1462 rates[1].idx = rates[2].idx = rates[3].idx = 0;
1463 rates[0].count = ATH_TXMAXTRY;
1464 }
1465
1466 /* get the cix for the lowest valid rix */
1467 rt = sc->cur_rate_table;
1468 for (i = 3; i >= 0; i--) {
1469 if (rates[i].count && (rates[i].idx >= 0)) {
1470 rix = rates[i].idx;
1471 break;
1472 }
1473 }
1474
1475 flags = (bf->bf_flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA));
1476 cix = rt->info[rix].ctrl_rate;
1477
1478 /* All protection frames are transmited at 2Mb/s for 802.11g,
1479 * otherwise we transmit them at 1Mb/s */
1480 if (hw->conf.channel->band == IEEE80211_BAND_2GHZ &&
1481 !conf_is_ht(&hw->conf))
1482 enable_g_protection = 1;
1483
1484 /* 1448 /*
1485 * If 802.11g protection is enabled, determine whether to use RTS/CTS or 1449 * We check if Short Preamble is needed for the CTS rate by
1486 * just CTS. Note that this is only done for OFDM/HT unicast frames. 1450 * checking the BSS's global flag.
1451 * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
1487 */ 1452 */
1488 if (sc->sc_protmode != PROT_M_NONE && !(bf->bf_flags & ATH9K_TXDESC_NOACK) 1453 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
1489 && (rt->info[rix].phy == WLAN_RC_PHY_OFDM || 1454 ctsrate = rt->info[tx_info->control.rts_cts_rate_idx].ratecode |
1490 WLAN_RC_PHY_HT(rt->info[rix].phy))) { 1455 rt->info[tx_info->control.rts_cts_rate_idx].short_preamble;
1491 if (sc->sc_protmode == PROT_M_RTSCTS) 1456 else
1492 flags = ATH9K_TXDESC_RTSENA; 1457 ctsrate = rt->info[tx_info->control.rts_cts_rate_idx].ratecode;
1493 else if (sc->sc_protmode == PROT_M_CTSONLY)
1494 flags = ATH9K_TXDESC_CTSENA;
1495
1496 cix = rt->info[enable_g_protection].ctrl_rate;
1497 rtsctsena = 1;
1498 }
1499 1458
1500 /* For 11n, the default behavior is to enable RTS for hw retried frames. 1459 /*
1501 * We enable the global flag here and let rate series flags determine 1460 * ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive.
1502 * which rates will actually use RTS. 1461 * Check the first rate in the series to decide whether RTS/CTS
1462 * or CTS-to-self has to be used.
1503 */ 1463 */
1504 if ((ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) && bf_isdata(bf)) { 1464 if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
1505 /* 802.11g protection not needed, use our default behavior */ 1465 flags = ATH9K_TXDESC_CTSENA;
1506 if (!rtsctsena) 1466 else if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
1507 flags = ATH9K_TXDESC_RTSENA; 1467 flags = ATH9K_TXDESC_RTSENA;
1508 }
1509 1468
1510 /* Set protection if aggregate protection on */ 1469 /* FIXME: Handle aggregation protection */
1511 if (sc->sc_config.ath_aggr_prot && 1470 if (sc->sc_config.ath_aggr_prot &&
1512 (!bf_isaggr(bf) || (bf_isaggr(bf) && bf->bf_al < 8192))) { 1471 (!bf_isaggr(bf) || (bf_isaggr(bf) && bf->bf_al < 8192))) {
1513 flags = ATH9K_TXDESC_RTSENA; 1472 flags = ATH9K_TXDESC_RTSENA;
1514 cix = rt->info[enable_g_protection].ctrl_rate;
1515 rtsctsena = 1;
1516 } 1473 }
1517 1474
1518 /* For AR5416 - RTS cannot be followed by a frame larger than 8K */ 1475 /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
1519 if (bf_isaggr(bf) && (bf->bf_al > ah->ah_caps.rts_aggr_limit)) 1476 if (bf_isaggr(bf) && (bf->bf_al > sc->sc_ah->ah_caps.rts_aggr_limit))
1520 flags &= ~(ATH9K_TXDESC_RTSENA); 1477 flags &= ~(ATH9K_TXDESC_RTSENA);
1521 1478
1522 /*
1523 * CTS transmit rate is derived from the transmit rate by looking in the
1524 * h/w rate table. We must also factor in whether or not a short
1525 * preamble is to be used. NB: cix is set above where RTS/CTS is enabled
1526 */
1527 ctsrate = rt->info[cix].ratecode |
1528 (bf_isshpreamble(bf) ? rt->info[cix].short_preamble : 0);
1529
1530 for (i = 0; i < 4; i++) { 1479 for (i = 0; i < 4; i++) {
1531 if (!rates[i].count || (rates[i].idx < 0)) 1480 if (!rates[i].count || (rates[i].idx < 0))
1532 continue; 1481 continue;
1533 1482
1534 rix = rates[i].idx; 1483 rix = rates[i].idx;
1535
1536 series[i].Rate = rt->info[rix].ratecode |
1537 (bf_isshpreamble(bf) ? rt->info[rix].short_preamble : 0);
1538
1539 series[i].Tries = rates[i].count; 1484 series[i].Tries = rates[i].count;
1485 series[i].ChSel = sc->sc_tx_chainmask;
1540 1486
1541 series[i].RateFlags = ( 1487 if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
1542 (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) ? 1488 series[i].Rate = rt->info[rix].ratecode |
1543 ATH9K_RATESERIES_RTS_CTS : 0) | 1489 rt->info[rix].short_preamble;
1544 ((rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 1490 else
1545 ATH9K_RATESERIES_2040 : 0) | 1491 series[i].Rate = rt->info[rix].ratecode;
1546 ((rates[i].flags & IEEE80211_TX_RC_SHORT_GI) ? 1492
1547 ATH9K_RATESERIES_HALFGI : 0); 1493 if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)
1494 series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
1495 if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
1496 series[i].RateFlags |= ATH9K_RATESERIES_2040;
1497 if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI)
1498 series[i].RateFlags |= ATH9K_RATESERIES_HALFGI;
1548 1499
1549 series[i].PktDuration = ath_pkt_duration(sc, rix, bf, 1500 series[i].PktDuration = ath_pkt_duration(sc, rix, bf,
1550 (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) != 0, 1501 (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) != 0,
1551 (rates[i].flags & IEEE80211_TX_RC_SHORT_GI), 1502 (rates[i].flags & IEEE80211_TX_RC_SHORT_GI),
1552 bf_isshpreamble(bf)); 1503 (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE));
1553
1554 series[i].ChSel = sc->sc_tx_chainmask;
1555
1556 if (rtsctsena)
1557 series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
1558 } 1504 }
1559 1505
1560 /* set dur_update_en for l-sig computation except for PS-Poll frames */ 1506 /* set dur_update_en for l-sig computation except for PS-Poll frames */
1561 ath9k_hw_set11n_ratescenario(ah, ds, lastds, !bf_ispspoll(bf), 1507 ath9k_hw_set11n_ratescenario(sc->sc_ah, bf->bf_desc,
1562 ctsrate, ctsduration, 1508 bf->bf_lastbf->bf_desc,
1563 series, 4, flags); 1509 !bf_ispspoll(bf), ctsrate,
1510 0, series, 4, flags);
1564 1511
1565 if (sc->sc_config.ath_aggr_prot && flags) 1512 if (sc->sc_config.ath_aggr_prot && flags)
1566 ath9k_hw_set11n_burstduration(ah, ds, 8192); 1513 ath9k_hw_set11n_burstduration(sc->sc_ah, bf->bf_desc, 8192);
1567} 1514}
1568 1515
1569static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf, 1516static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf,
@@ -1593,8 +1540,6 @@ static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf,
1593 bf->bf_state.bf_type |= BUF_BAR; 1540 bf->bf_state.bf_type |= BUF_BAR;
1594 if (ieee80211_is_pspoll(fc)) 1541 if (ieee80211_is_pspoll(fc))
1595 bf->bf_state.bf_type |= BUF_PSPOLL; 1542 bf->bf_state.bf_type |= BUF_PSPOLL;
1596 if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
1597 bf->bf_state.bf_type |= BUF_SHORT_PREAMBLE;
1598 if ((conf_is_ht(&sc->hw->conf) && !is_pae(skb) && 1543 if ((conf_is_ht(&sc->hw->conf) && !is_pae(skb) &&
1599 (tx_info->flags & IEEE80211_TX_CTL_AMPDU))) 1544 (tx_info->flags & IEEE80211_TX_CTL_AMPDU)))
1600 bf->bf_state.bf_type |= BUF_HT; 1545 bf->bf_state.bf_type |= BUF_HT;