diff options
Diffstat (limited to 'drivers/net/wireless/ath9k/recv.c')
-rw-r--r-- | drivers/net/wireless/ath9k/recv.c | 81 |
1 files changed, 31 insertions, 50 deletions
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 2fe806175c01..6e13c638cc0b 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -184,7 +184,7 @@ static int ath_ampdu_input(struct ath_softc *sc, | |||
184 | tid = qc[0] & 0xf; | 184 | tid = qc[0] & 0xf; |
185 | } | 185 | } |
186 | 186 | ||
187 | if (sc->sc_opmode == ATH9K_M_STA) { | 187 | if (sc->sc_ah->ah_opmode == ATH9K_M_STA) { |
188 | /* Drop the frame not belonging to me. */ | 188 | /* Drop the frame not belonging to me. */ |
189 | if (memcmp(hdr->addr1, sc->sc_myaddr, ETH_ALEN)) { | 189 | if (memcmp(hdr->addr1, sc->sc_myaddr, ETH_ALEN)) { |
190 | dev_kfree_skb(skb); | 190 | dev_kfree_skb(skb); |
@@ -448,17 +448,16 @@ static int ath_rx_indicate(struct ath_softc *sc, | |||
448 | int type; | 448 | int type; |
449 | 449 | ||
450 | /* indicate frame to the stack, which will free the old skb. */ | 450 | /* indicate frame to the stack, which will free the old skb. */ |
451 | type = ath__rx_indicate(sc, skb, status, keyix); | 451 | type = _ath_rx_indicate(sc, skb, status, keyix); |
452 | 452 | ||
453 | /* allocate a new skb and queue it to for H/W processing */ | 453 | /* allocate a new skb and queue it to for H/W processing */ |
454 | nskb = ath_rxbuf_alloc(sc, sc->sc_rxbufsize); | 454 | nskb = ath_rxbuf_alloc(sc, sc->sc_rxbufsize); |
455 | if (nskb != NULL) { | 455 | if (nskb != NULL) { |
456 | bf->bf_mpdu = nskb; | 456 | bf->bf_mpdu = nskb; |
457 | bf->bf_buf_addr = ath_skb_map_single(sc, | 457 | bf->bf_buf_addr = pci_map_single(sc->pdev, nskb->data, |
458 | nskb, | 458 | skb_end_pointer(nskb) - nskb->head, |
459 | PCI_DMA_FROMDEVICE, | 459 | PCI_DMA_FROMDEVICE); |
460 | /* XXX: Remove get_dma_mem_context() */ | 460 | bf->bf_dmacontext = bf->bf_buf_addr; |
461 | get_dma_mem_context(bf, bf_dmacontext)); | ||
462 | ATH_RX_CONTEXT(nskb)->ctx_rxbuf = bf; | 461 | ATH_RX_CONTEXT(nskb)->ctx_rxbuf = bf; |
463 | 462 | ||
464 | /* queue the new wbuf to H/W */ | 463 | /* queue the new wbuf to H/W */ |
@@ -504,7 +503,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
504 | 503 | ||
505 | do { | 504 | do { |
506 | spin_lock_init(&sc->sc_rxflushlock); | 505 | spin_lock_init(&sc->sc_rxflushlock); |
507 | sc->sc_rxflush = 0; | 506 | sc->sc_flags &= ~SC_OP_RXFLUSH; |
508 | spin_lock_init(&sc->sc_rxbuflock); | 507 | spin_lock_init(&sc->sc_rxbuflock); |
509 | 508 | ||
510 | /* | 509 | /* |
@@ -541,9 +540,10 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
541 | } | 540 | } |
542 | 541 | ||
543 | bf->bf_mpdu = skb; | 542 | bf->bf_mpdu = skb; |
544 | bf->bf_buf_addr = | 543 | bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data, |
545 | ath_skb_map_single(sc, skb, PCI_DMA_FROMDEVICE, | 544 | skb_end_pointer(skb) - skb->head, |
546 | get_dma_mem_context(bf, bf_dmacontext)); | 545 | PCI_DMA_FROMDEVICE); |
546 | bf->bf_dmacontext = bf->bf_buf_addr; | ||
547 | ATH_RX_CONTEXT(skb)->ctx_rxbuf = bf; | 547 | ATH_RX_CONTEXT(skb)->ctx_rxbuf = bf; |
548 | } | 548 | } |
549 | sc->sc_rxlink = NULL; | 549 | sc->sc_rxlink = NULL; |
@@ -597,6 +597,7 @@ void ath_rx_cleanup(struct ath_softc *sc) | |||
597 | u32 ath_calcrxfilter(struct ath_softc *sc) | 597 | u32 ath_calcrxfilter(struct ath_softc *sc) |
598 | { | 598 | { |
599 | #define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR) | 599 | #define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR) |
600 | |||
600 | u32 rfilt; | 601 | u32 rfilt; |
601 | 602 | ||
602 | rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE) | 603 | rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE) |
@@ -604,25 +605,29 @@ u32 ath_calcrxfilter(struct ath_softc *sc) | |||
604 | | ATH9K_RX_FILTER_MCAST; | 605 | | ATH9K_RX_FILTER_MCAST; |
605 | 606 | ||
606 | /* If not a STA, enable processing of Probe Requests */ | 607 | /* If not a STA, enable processing of Probe Requests */ |
607 | if (sc->sc_opmode != ATH9K_M_STA) | 608 | if (sc->sc_ah->ah_opmode != ATH9K_M_STA) |
608 | rfilt |= ATH9K_RX_FILTER_PROBEREQ; | 609 | rfilt |= ATH9K_RX_FILTER_PROBEREQ; |
609 | 610 | ||
610 | /* Can't set HOSTAP into promiscous mode */ | 611 | /* Can't set HOSTAP into promiscous mode */ |
611 | if (sc->sc_opmode == ATH9K_M_MONITOR) { | 612 | if (((sc->sc_ah->ah_opmode != ATH9K_M_HOSTAP) && |
613 | (sc->rx_filter & FIF_PROMISC_IN_BSS)) || | ||
614 | (sc->sc_ah->ah_opmode == ATH9K_M_MONITOR)) { | ||
612 | rfilt |= ATH9K_RX_FILTER_PROM; | 615 | rfilt |= ATH9K_RX_FILTER_PROM; |
613 | /* ??? To prevent from sending ACK */ | 616 | /* ??? To prevent from sending ACK */ |
614 | rfilt &= ~ATH9K_RX_FILTER_UCAST; | 617 | rfilt &= ~ATH9K_RX_FILTER_UCAST; |
615 | } | 618 | } |
616 | 619 | ||
617 | if (sc->sc_opmode == ATH9K_M_STA || sc->sc_opmode == ATH9K_M_IBSS || | 620 | if (((sc->sc_ah->ah_opmode == ATH9K_M_STA) && |
618 | sc->sc_scanning) | 621 | (sc->rx_filter & FIF_BCN_PRBRESP_PROMISC)) || |
622 | (sc->sc_ah->ah_opmode == ATH9K_M_IBSS)) | ||
619 | rfilt |= ATH9K_RX_FILTER_BEACON; | 623 | rfilt |= ATH9K_RX_FILTER_BEACON; |
620 | 624 | ||
621 | /* If in HOSTAP mode, want to enable reception of PSPOLL frames | 625 | /* If in HOSTAP mode, want to enable reception of PSPOLL frames |
622 | & beacon frames */ | 626 | & beacon frames */ |
623 | if (sc->sc_opmode == ATH9K_M_HOSTAP) | 627 | if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) |
624 | rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); | 628 | rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); |
625 | return rfilt; | 629 | return rfilt; |
630 | |||
626 | #undef RX_FILTER_PRESERVE | 631 | #undef RX_FILTER_PRESERVE |
627 | } | 632 | } |
628 | 633 | ||
@@ -702,11 +707,11 @@ void ath_flushrecv(struct ath_softc *sc) | |||
702 | * progress (see references to sc_rxflush) | 707 | * progress (see references to sc_rxflush) |
703 | */ | 708 | */ |
704 | spin_lock_bh(&sc->sc_rxflushlock); | 709 | spin_lock_bh(&sc->sc_rxflushlock); |
705 | sc->sc_rxflush = 1; | 710 | sc->sc_flags |= SC_OP_RXFLUSH; |
706 | 711 | ||
707 | ath_rx_tasklet(sc, 1); | 712 | ath_rx_tasklet(sc, 1); |
708 | 713 | ||
709 | sc->sc_rxflush = 0; | 714 | sc->sc_flags &= ~SC_OP_RXFLUSH; |
710 | spin_unlock_bh(&sc->sc_rxflushlock); | 715 | spin_unlock_bh(&sc->sc_rxflushlock); |
711 | } | 716 | } |
712 | 717 | ||
@@ -719,7 +724,7 @@ int ath_rx_input(struct ath_softc *sc, | |||
719 | struct ath_recv_status *rx_status, | 724 | struct ath_recv_status *rx_status, |
720 | enum ATH_RX_TYPE *status) | 725 | enum ATH_RX_TYPE *status) |
721 | { | 726 | { |
722 | if (is_ampdu && sc->sc_rxaggr) { | 727 | if (is_ampdu && (sc->sc_flags & SC_OP_RXAGGR)) { |
723 | *status = ATH_RX_CONSUMED; | 728 | *status = ATH_RX_CONSUMED; |
724 | return ath_ampdu_input(sc, an, skb, rx_status); | 729 | return ath_ampdu_input(sc, an, skb, rx_status); |
725 | } else { | 730 | } else { |
@@ -750,7 +755,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
750 | 755 | ||
751 | do { | 756 | do { |
752 | /* If handling rx interrupt and flush is in progress => exit */ | 757 | /* If handling rx interrupt and flush is in progress => exit */ |
753 | if (sc->sc_rxflush && (flush == 0)) | 758 | if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0)) |
754 | break; | 759 | break; |
755 | 760 | ||
756 | spin_lock_bh(&sc->sc_rxbuflock); | 761 | spin_lock_bh(&sc->sc_rxbuflock); |
@@ -900,7 +905,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
900 | * Enable this if you want to see | 905 | * Enable this if you want to see |
901 | * error frames in Monitor mode. | 906 | * error frames in Monitor mode. |
902 | */ | 907 | */ |
903 | if (sc->sc_opmode != ATH9K_M_MONITOR) | 908 | if (sc->sc_ah->ah_opmode != ATH9K_M_MONITOR) |
904 | goto rx_next; | 909 | goto rx_next; |
905 | #endif | 910 | #endif |
906 | /* fall thru for monitor mode handling... */ | 911 | /* fall thru for monitor mode handling... */ |
@@ -945,7 +950,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
945 | * decryption and MIC failures. For monitor mode, | 950 | * decryption and MIC failures. For monitor mode, |
946 | * we also ignore the CRC error. | 951 | * we also ignore the CRC error. |
947 | */ | 952 | */ |
948 | if (sc->sc_opmode == ATH9K_M_MONITOR) { | 953 | if (sc->sc_ah->ah_opmode == ATH9K_M_MONITOR) { |
949 | if (ds->ds_rxstat.rs_status & | 954 | if (ds->ds_rxstat.rs_status & |
950 | ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | | 955 | ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | |
951 | ATH9K_RXERR_CRC)) | 956 | ATH9K_RXERR_CRC)) |
@@ -1089,7 +1094,7 @@ rx_next: | |||
1089 | "%s: Reset rx chain mask. " | 1094 | "%s: Reset rx chain mask. " |
1090 | "Do internal reset\n", __func__); | 1095 | "Do internal reset\n", __func__); |
1091 | ASSERT(flush == 0); | 1096 | ASSERT(flush == 0); |
1092 | ath_internal_reset(sc); | 1097 | ath_reset(sc, false); |
1093 | } | 1098 | } |
1094 | 1099 | ||
1095 | return 0; | 1100 | return 0; |
@@ -1127,7 +1132,7 @@ int ath_rx_aggr_start(struct ath_softc *sc, | |||
1127 | rxtid = &an->an_aggr.rx.tid[tid]; | 1132 | rxtid = &an->an_aggr.rx.tid[tid]; |
1128 | 1133 | ||
1129 | spin_lock_bh(&rxtid->tidlock); | 1134 | spin_lock_bh(&rxtid->tidlock); |
1130 | if (sc->sc_rxaggr) { | 1135 | if (sc->sc_flags & SC_OP_RXAGGR) { |
1131 | /* Allow aggregation reception | 1136 | /* Allow aggregation reception |
1132 | * Adjust rx BA window size. Peer might indicate a | 1137 | * Adjust rx BA window size. Peer might indicate a |
1133 | * zero buffer size for a _dont_care_ condition. | 1138 | * zero buffer size for a _dont_care_ condition. |
@@ -1227,7 +1232,7 @@ void ath_rx_aggr_teardown(struct ath_softc *sc, | |||
1227 | 1232 | ||
1228 | void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an) | 1233 | void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an) |
1229 | { | 1234 | { |
1230 | if (sc->sc_rxaggr) { | 1235 | if (sc->sc_flags & SC_OP_RXAGGR) { |
1231 | struct ath_arx_tid *rxtid; | 1236 | struct ath_arx_tid *rxtid; |
1232 | int tidno; | 1237 | int tidno; |
1233 | 1238 | ||
@@ -1259,7 +1264,7 @@ void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an) | |||
1259 | 1264 | ||
1260 | void ath_rx_node_cleanup(struct ath_softc *sc, struct ath_node *an) | 1265 | void ath_rx_node_cleanup(struct ath_softc *sc, struct ath_node *an) |
1261 | { | 1266 | { |
1262 | if (sc->sc_rxaggr) { | 1267 | if (sc->sc_flags & SC_OP_RXAGGR) { |
1263 | struct ath_arx_tid *rxtid; | 1268 | struct ath_arx_tid *rxtid; |
1264 | int tidno, i; | 1269 | int tidno, i; |
1265 | 1270 | ||
@@ -1292,27 +1297,3 @@ void ath_rx_node_free(struct ath_softc *sc, struct ath_node *an) | |||
1292 | { | 1297 | { |
1293 | ath_rx_node_cleanup(sc, an); | 1298 | ath_rx_node_cleanup(sc, an); |
1294 | } | 1299 | } |
1295 | |||
1296 | dma_addr_t ath_skb_map_single(struct ath_softc *sc, | ||
1297 | struct sk_buff *skb, | ||
1298 | int direction, | ||
1299 | dma_addr_t *pa) | ||
1300 | { | ||
1301 | /* | ||
1302 | * NB: do NOT use skb->len, which is 0 on initialization. | ||
1303 | * Use skb's entire data area instead. | ||
1304 | */ | ||
1305 | *pa = pci_map_single(sc->pdev, skb->data, | ||
1306 | skb_end_pointer(skb) - skb->head, direction); | ||
1307 | return *pa; | ||
1308 | } | ||
1309 | |||
1310 | void ath_skb_unmap_single(struct ath_softc *sc, | ||
1311 | struct sk_buff *skb, | ||
1312 | int direction, | ||
1313 | dma_addr_t *pa) | ||
1314 | { | ||
1315 | /* Unmap skb's entire data area */ | ||
1316 | pci_unmap_single(sc->pdev, *pa, | ||
1317 | skb_end_pointer(skb) - skb->head, direction); | ||
1318 | } | ||