diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2008-10-29 00:45:16 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-10 15:14:56 -0500 |
commit | 102e0572d330e6cdb89a8f8fbd3999e3c67a1f9e (patch) | |
tree | be8df3f62c3f506ea8cec1e5285b810b5f8461d8 | |
parent | 43453b3392c1ecfdd1471383ad42ba926533a722 (diff) |
ath9k: Ensure ath_node is not NULL when updating tx chainmask
Also, random indentation and whitespace cleanup.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/rc.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/recv.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/xmit.c | 57 |
4 files changed, 28 insertions, 40 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 839db2312ca5..0a0eb7ce0f5f 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -489,8 +489,7 @@ int _ath_rx_indicate(struct ath_softc *sc, | |||
489 | return 0; | 489 | return 0; |
490 | } | 490 | } |
491 | 491 | ||
492 | int ath_rx_subframe(struct ath_node *an, | 492 | int ath_rx_subframe(struct ath_node *an, struct sk_buff *skb, |
493 | struct sk_buff *skb, | ||
494 | struct ath_recv_status *status) | 493 | struct ath_recv_status *status) |
495 | { | 494 | { |
496 | struct ath_softc *sc = an->an_sc; | 495 | struct ath_softc *sc = an->an_sc; |
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c index 1305873b2a09..02931a111f1a 100644 --- a/drivers/net/wireless/ath9k/rc.c +++ b/drivers/net/wireless/ath9k/rc.c | |||
@@ -816,7 +816,7 @@ void ath_rate_detach(struct ath_rate_softc *asc) | |||
816 | } | 816 | } |
817 | 817 | ||
818 | u8 ath_rate_findrateix(struct ath_softc *sc, | 818 | u8 ath_rate_findrateix(struct ath_softc *sc, |
819 | u8 dot11rate) | 819 | u8 dot11rate) |
820 | { | 820 | { |
821 | const struct ath_rate_table *ratetable; | 821 | const struct ath_rate_table *ratetable; |
822 | struct ath_rate_softc *rsc = sc->sc_rc; | 822 | struct ath_rate_softc *rsc = sc->sc_rc; |
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 27d6a981a106..80f26b4c4e06 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -356,8 +356,8 @@ static void ath_rx_timer(unsigned long data) | |||
356 | 356 | ||
357 | /* Free all pending sub-frames in the re-ordering buffer */ | 357 | /* Free all pending sub-frames in the re-ordering buffer */ |
358 | 358 | ||
359 | static void ath_rx_flush_tid(struct ath_softc *sc, | 359 | static void ath_rx_flush_tid(struct ath_softc *sc, struct ath_arx_tid *rxtid, |
360 | struct ath_arx_tid *rxtid, int drop) | 360 | int drop) |
361 | { | 361 | { |
362 | struct ath_rxbuf *rxbuf; | 362 | struct ath_rxbuf *rxbuf; |
363 | unsigned long flag; | 363 | unsigned long flag; |
@@ -1218,7 +1218,7 @@ void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an) | |||
1218 | * (needs to be allocated when addba is received) | 1218 | * (needs to be allocated when addba is received) |
1219 | */ | 1219 | */ |
1220 | 1220 | ||
1221 | rxtid->rxbuf = NULL; | 1221 | rxtid->rxbuf = NULL; |
1222 | setup_timer(&rxtid->timer, ath_rx_timer, | 1222 | setup_timer(&rxtid->timer, ath_rx_timer, |
1223 | (unsigned long)rxtid); | 1223 | (unsigned long)rxtid); |
1224 | spin_lock_init(&rxtid->tidlock); | 1224 | spin_lock_init(&rxtid->tidlock); |
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c index 4e7108a179fb..bd902468868f 100644 --- a/drivers/net/wireless/ath9k/xmit.c +++ b/drivers/net/wireless/ath9k/xmit.c | |||
@@ -65,11 +65,12 @@ static u32 bits_per_symbol[][2] = { | |||
65 | * NB: must be called with txq lock held | 65 | * NB: must be called with txq lock held |
66 | */ | 66 | */ |
67 | 67 | ||
68 | static void ath_tx_txqaddbuf(struct ath_softc *sc, | 68 | static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, |
69 | struct ath_txq *txq, struct list_head *head) | 69 | struct list_head *head) |
70 | { | 70 | { |
71 | struct ath_hal *ah = sc->sc_ah; | 71 | struct ath_hal *ah = sc->sc_ah; |
72 | struct ath_buf *bf; | 72 | struct ath_buf *bf; |
73 | |||
73 | /* | 74 | /* |
74 | * Insert the frame on the outbound list and | 75 | * Insert the frame on the outbound list and |
75 | * pass it on to the hardware. | 76 | * pass it on to the hardware. |
@@ -360,6 +361,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, | |||
360 | if (bf_isxretried(bf)) | 361 | if (bf_isxretried(bf)) |
361 | tx_status.flags |= ATH_TX_XRETRY; | 362 | tx_status.flags |= ATH_TX_XRETRY; |
362 | } | 363 | } |
364 | |||
363 | /* Unmap this frame */ | 365 | /* Unmap this frame */ |
364 | pci_unmap_single(sc->pdev, | 366 | pci_unmap_single(sc->pdev, |
365 | bf->bf_dmacontext, | 367 | bf->bf_dmacontext, |
@@ -497,8 +499,8 @@ static void ath_tx_set_retry(struct ath_softc *sc, struct ath_buf *bf) | |||
497 | 499 | ||
498 | /* Update block ack window */ | 500 | /* Update block ack window */ |
499 | 501 | ||
500 | static void ath_tx_update_baw(struct ath_softc *sc, | 502 | static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, |
501 | struct ath_atx_tid *tid, int seqno) | 503 | int seqno) |
502 | { | 504 | { |
503 | int index, cindex; | 505 | int index, cindex; |
504 | 506 | ||
@@ -522,12 +524,8 @@ static void ath_tx_update_baw(struct ath_softc *sc, | |||
522 | * half_gi - to use 4us v/s 3.6 us for symbol time | 524 | * half_gi - to use 4us v/s 3.6 us for symbol time |
523 | */ | 525 | */ |
524 | 526 | ||
525 | static u32 ath_pkt_duration(struct ath_softc *sc, | 527 | static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, struct ath_buf *bf, |
526 | u8 rix, | 528 | int width, int half_gi, bool shortPreamble) |
527 | struct ath_buf *bf, | ||
528 | int width, | ||
529 | int half_gi, | ||
530 | bool shortPreamble) | ||
531 | { | 529 | { |
532 | const struct ath9k_rate_table *rt = sc->sc_currates; | 530 | const struct ath9k_rate_table *rt = sc->sc_currates; |
533 | u32 nbits, nsymbits, duration, nsymbols; | 531 | u32 nbits, nsymbits, duration, nsymbols; |
@@ -541,11 +539,8 @@ static u32 ath_pkt_duration(struct ath_softc *sc, | |||
541 | * for legacy rates, use old function to compute packet duration | 539 | * for legacy rates, use old function to compute packet duration |
542 | */ | 540 | */ |
543 | if (!IS_HT_RATE(rc)) | 541 | if (!IS_HT_RATE(rc)) |
544 | return ath9k_hw_computetxtime(sc->sc_ah, | 542 | return ath9k_hw_computetxtime(sc->sc_ah, rt, pktlen, rix, |
545 | rt, | 543 | shortPreamble); |
546 | pktlen, | ||
547 | rix, | ||
548 | shortPreamble); | ||
549 | /* | 544 | /* |
550 | * find number of symbols: PLCP + data | 545 | * find number of symbols: PLCP + data |
551 | */ | 546 | */ |
@@ -563,6 +558,7 @@ static u32 ath_pkt_duration(struct ath_softc *sc, | |||
563 | */ | 558 | */ |
564 | streams = HT_RC_2_STREAMS(rc); | 559 | streams = HT_RC_2_STREAMS(rc); |
565 | duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams); | 560 | duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams); |
561 | |||
566 | return duration; | 562 | return duration; |
567 | } | 563 | } |
568 | 564 | ||
@@ -578,7 +574,6 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) | |||
578 | int i, flags, rtsctsena = 0; | 574 | int i, flags, rtsctsena = 0; |
579 | u32 ctsduration = 0; | 575 | u32 ctsduration = 0; |
580 | u8 rix = 0, cix, ctsrate = 0; | 576 | u8 rix = 0, cix, ctsrate = 0; |
581 | u32 aggr_limit_with_rts = ah->ah_caps.rts_aggr_limit; | ||
582 | struct ath_node *an = NULL; | 577 | struct ath_node *an = NULL; |
583 | struct sk_buff *skb; | 578 | struct sk_buff *skb; |
584 | struct ieee80211_tx_info *tx_info; | 579 | struct ieee80211_tx_info *tx_info; |
@@ -646,7 +641,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) | |||
646 | /* | 641 | /* |
647 | * For AR5416 - RTS cannot be followed by a frame larger than 8K. | 642 | * For AR5416 - RTS cannot be followed by a frame larger than 8K. |
648 | */ | 643 | */ |
649 | if (bf_isaggr(bf) && (bf->bf_al > aggr_limit_with_rts)) { | 644 | if (bf_isaggr(bf) && (bf->bf_al > ah->ah_caps.rts_aggr_limit)) { |
650 | /* | 645 | /* |
651 | * Ensure that in the case of SM Dynamic power save | 646 | * Ensure that in the case of SM Dynamic power save |
652 | * while we are bursting the second aggregate the | 647 | * while we are bursting the second aggregate the |
@@ -659,8 +654,8 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) | |||
659 | * CTS transmit rate is derived from the transmit rate | 654 | * CTS transmit rate is derived from the transmit rate |
660 | * by looking in the h/w rate table. We must also factor | 655 | * by looking in the h/w rate table. We must also factor |
661 | * in whether or not a short preamble is to be used. | 656 | * in whether or not a short preamble is to be used. |
657 | * NB: cix is set above where RTS/CTS is enabled | ||
662 | */ | 658 | */ |
663 | /* NB: cix is set above where RTS/CTS is enabled */ | ||
664 | BUG_ON(cix == 0xff); | 659 | BUG_ON(cix == 0xff); |
665 | ctsrate = rt->info[cix].rateCode | | 660 | ctsrate = rt->info[cix].rateCode | |
666 | (bf_isshpreamble(bf) ? rt->info[cix].shortPreamble : 0); | 661 | (bf_isshpreamble(bf) ? rt->info[cix].shortPreamble : 0); |
@@ -689,15 +684,13 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) | |||
689 | ((bf->bf_rcs[i].flags & ATH_RC_SGI_FLAG) ? | 684 | ((bf->bf_rcs[i].flags & ATH_RC_SGI_FLAG) ? |
690 | ATH9K_RATESERIES_HALFGI : 0); | 685 | ATH9K_RATESERIES_HALFGI : 0); |
691 | 686 | ||
692 | series[i].PktDuration = ath_pkt_duration( | 687 | series[i].PktDuration = ath_pkt_duration(sc, rix, bf, |
693 | sc, rix, bf, | 688 | (bf->bf_rcs[i].flags & ATH_RC_CW40_FLAG) != 0, |
694 | (bf->bf_rcs[i].flags & ATH_RC_CW40_FLAG) != 0, | 689 | (bf->bf_rcs[i].flags & ATH_RC_SGI_FLAG), |
695 | (bf->bf_rcs[i].flags & ATH_RC_SGI_FLAG), | 690 | bf_isshpreamble(bf)); |
696 | bf_isshpreamble(bf)); | ||
697 | 691 | ||
698 | if (bf_isht(bf)) | 692 | if (bf_isht(bf) && an) |
699 | series[i].ChSel = | 693 | series[i].ChSel = ath_chainmask_sel_logic(sc, an); |
700 | ath_chainmask_sel_logic(sc, an); | ||
701 | else | 694 | else |
702 | series[i].ChSel = sc->sc_tx_chainmask; | 695 | series[i].ChSel = sc->sc_tx_chainmask; |
703 | 696 | ||
@@ -748,6 +741,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf) | |||
748 | ctsrate, | 741 | ctsrate, |
749 | ctsduration, | 742 | ctsduration, |
750 | series, 4, flags); | 743 | series, 4, flags); |
744 | |||
751 | if (sc->sc_config.ath_aggr_prot && flags) | 745 | if (sc->sc_config.ath_aggr_prot && flags) |
752 | ath9k_hw_set11n_burstduration(ah, ds, 8192); | 746 | ath9k_hw_set11n_burstduration(ah, ds, 8192); |
753 | } | 747 | } |
@@ -1238,26 +1232,21 @@ static void ath_tx_stopdma(struct ath_softc *sc, struct ath_txq *txq) | |||
1238 | static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx) | 1232 | static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx) |
1239 | { | 1233 | { |
1240 | struct ath_hal *ah = sc->sc_ah; | 1234 | struct ath_hal *ah = sc->sc_ah; |
1241 | int i; | 1235 | int i, status, npend = 0; |
1242 | int npend = 0; | ||
1243 | 1236 | ||
1244 | /* XXX return value */ | ||
1245 | if (!(sc->sc_flags & SC_OP_INVALID)) { | 1237 | if (!(sc->sc_flags & SC_OP_INVALID)) { |
1246 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { | 1238 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { |
1247 | if (ATH_TXQ_SETUP(sc, i)) { | 1239 | if (ATH_TXQ_SETUP(sc, i)) { |
1248 | ath_tx_stopdma(sc, &sc->sc_txq[i]); | 1240 | ath_tx_stopdma(sc, &sc->sc_txq[i]); |
1249 | |||
1250 | /* The TxDMA may not really be stopped. | 1241 | /* The TxDMA may not really be stopped. |
1251 | * Double check the hal tx pending count */ | 1242 | * Double check the hal tx pending count */ |
1252 | npend += ath9k_hw_numtxpending(ah, | 1243 | npend += ath9k_hw_numtxpending(ah, |
1253 | sc->sc_txq[i].axq_qnum); | 1244 | sc->sc_txq[i].axq_qnum); |
1254 | } | 1245 | } |
1255 | } | 1246 | } |
1256 | } | 1247 | } |
1257 | 1248 | ||
1258 | if (npend) { | 1249 | if (npend) { |
1259 | int status; | ||
1260 | |||
1261 | /* TxDMA not stopped, reset the hal */ | 1250 | /* TxDMA not stopped, reset the hal */ |
1262 | DPRINTF(sc, ATH_DBG_XMIT, | 1251 | DPRINTF(sc, ATH_DBG_XMIT, |
1263 | "%s: Unable to stop TxDMA. Reset HAL!\n", __func__); | 1252 | "%s: Unable to stop TxDMA. Reset HAL!\n", __func__); |
@@ -1360,6 +1349,7 @@ static int ath_tx_send_ampdu(struct ath_softc *sc, | |||
1360 | bf->bf_lastbf = bf->bf_lastfrm; /* one single frame */ | 1349 | bf->bf_lastbf = bf->bf_lastfrm; /* one single frame */ |
1361 | ath_buf_set_rate(sc, bf); | 1350 | ath_buf_set_rate(sc, bf); |
1362 | ath_tx_txqaddbuf(sc, txctl->txq, bf_head); | 1351 | ath_tx_txqaddbuf(sc, txctl->txq, bf_head); |
1352 | |||
1363 | return 0; | 1353 | return 0; |
1364 | } | 1354 | } |
1365 | 1355 | ||
@@ -1380,7 +1370,6 @@ static u32 ath_lookup_rate(struct ath_softc *sc, | |||
1380 | u16 aggr_limit, legacy = 0, maxampdu; | 1370 | u16 aggr_limit, legacy = 0, maxampdu; |
1381 | int i; | 1371 | int i; |
1382 | 1372 | ||
1383 | |||
1384 | skb = (struct sk_buff *)bf->bf_mpdu; | 1373 | skb = (struct sk_buff *)bf->bf_mpdu; |
1385 | tx_info = IEEE80211_SKB_CB(skb); | 1374 | tx_info = IEEE80211_SKB_CB(skb); |
1386 | tx_info_priv = (struct ath_tx_info_priv *) | 1375 | tx_info_priv = (struct ath_tx_info_priv *) |