diff options
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmsmac')
17 files changed, 1289 insertions, 1525 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/Makefile b/drivers/net/wireless/brcm80211/brcmsmac/Makefile index e227c4c68ef9..d3d4151c3eda 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/Makefile +++ b/drivers/net/wireless/brcm80211/brcmsmac/Makefile | |||
@@ -40,7 +40,8 @@ BRCMSMAC_OFILES := \ | |||
40 | phy/phytbl_n.o \ | 40 | phy/phytbl_n.o \ |
41 | phy/phy_qmath.o \ | 41 | phy/phy_qmath.o \ |
42 | dma.o \ | 42 | dma.o \ |
43 | brcms_trace_events.o | 43 | brcms_trace_events.o \ |
44 | debug.o | ||
44 | 45 | ||
45 | MODULEPFX := brcmsmac | 46 | MODULEPFX := brcmsmac |
46 | 47 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c index b89f1272b93f..de96290f5ccd 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | |||
@@ -692,7 +692,7 @@ void ai_pci_up(struct si_pub *sih) | |||
692 | sii = container_of(sih, struct si_info, pub); | 692 | sii = container_of(sih, struct si_info, pub); |
693 | 693 | ||
694 | if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | 694 | if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) |
695 | bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true); | 695 | bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], true); |
696 | } | 696 | } |
697 | 697 | ||
698 | /* Unconfigure and/or apply various WARs when going down */ | 698 | /* Unconfigure and/or apply various WARs when going down */ |
@@ -703,7 +703,7 @@ void ai_pci_down(struct si_pub *sih) | |||
703 | sii = container_of(sih, struct si_info, pub); | 703 | sii = container_of(sih, struct si_info, pub); |
704 | 704 | ||
705 | if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) | 705 | if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) |
706 | bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false); | 706 | bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], false); |
707 | } | 707 | } |
708 | 708 | ||
709 | /* Enable BT-COEX & Ex-PA for 4313 */ | 709 | /* Enable BT-COEX & Ex-PA for 4313 */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c index be5bcfb9153b..1de94f30564f 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include "antsel.h" | 21 | #include "antsel.h" |
22 | #include "main.h" | 22 | #include "main.h" |
23 | #include "ampdu.h" | 23 | #include "ampdu.h" |
24 | #include "debug.h" | ||
25 | #include "brcms_trace_events.h" | ||
24 | 26 | ||
25 | /* max number of mpdus in an ampdu */ | 27 | /* max number of mpdus in an ampdu */ |
26 | #define AMPDU_MAX_MPDU 32 | 28 | #define AMPDU_MAX_MPDU 32 |
@@ -40,8 +42,6 @@ | |||
40 | #define AMPDU_DEF_RETRY_LIMIT 5 | 42 | #define AMPDU_DEF_RETRY_LIMIT 5 |
41 | /* default tx retry limit at reg rate */ | 43 | /* default tx retry limit at reg rate */ |
42 | #define AMPDU_DEF_RR_RETRY_LIMIT 2 | 44 | #define AMPDU_DEF_RR_RETRY_LIMIT 2 |
43 | /* default weight of ampdu in txfifo */ | ||
44 | #define AMPDU_DEF_TXPKT_WEIGHT 2 | ||
45 | /* default ffpld reserved bytes */ | 45 | /* default ffpld reserved bytes */ |
46 | #define AMPDU_DEF_FFPLD_RSVD 2048 | 46 | #define AMPDU_DEF_FFPLD_RSVD 2048 |
47 | /* # of inis to be freed on detach */ | 47 | /* # of inis to be freed on detach */ |
@@ -114,7 +114,6 @@ struct brcms_fifo_info { | |||
114 | * mpdu_density: min mpdu spacing (0-7) ==> 2^(x-1)/8 usec | 114 | * mpdu_density: min mpdu spacing (0-7) ==> 2^(x-1)/8 usec |
115 | * max_pdu: max pdus allowed in ampdu | 115 | * max_pdu: max pdus allowed in ampdu |
116 | * dur: max duration of an ampdu (in msec) | 116 | * dur: max duration of an ampdu (in msec) |
117 | * txpkt_weight: weight of ampdu in txfifo; reduces rate lag | ||
118 | * rx_factor: maximum rx ampdu factor (0-3) ==> 2^(13+x) bytes | 117 | * rx_factor: maximum rx ampdu factor (0-3) ==> 2^(13+x) bytes |
119 | * ffpld_rsvd: number of bytes to reserve for preload | 118 | * ffpld_rsvd: number of bytes to reserve for preload |
120 | * max_txlen: max size of ampdu per mcs, bw and sgi | 119 | * max_txlen: max size of ampdu per mcs, bw and sgi |
@@ -136,7 +135,6 @@ struct ampdu_info { | |||
136 | u8 mpdu_density; | 135 | u8 mpdu_density; |
137 | s8 max_pdu; | 136 | s8 max_pdu; |
138 | u8 dur; | 137 | u8 dur; |
139 | u8 txpkt_weight; | ||
140 | u8 rx_factor; | 138 | u8 rx_factor; |
141 | u32 ffpld_rsvd; | 139 | u32 ffpld_rsvd; |
142 | u32 max_txlen[MCS_TABLE_SIZE][2][2]; | 140 | u32 max_txlen[MCS_TABLE_SIZE][2][2]; |
@@ -183,18 +181,19 @@ static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu) | |||
183 | static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on) | 181 | static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on) |
184 | { | 182 | { |
185 | struct brcms_c_info *wlc = ampdu->wlc; | 183 | struct brcms_c_info *wlc = ampdu->wlc; |
184 | struct bcma_device *core = wlc->hw->d11core; | ||
186 | 185 | ||
187 | wlc->pub->_ampdu = false; | 186 | wlc->pub->_ampdu = false; |
188 | 187 | ||
189 | if (on) { | 188 | if (on) { |
190 | if (!(wlc->pub->_n_enab & SUPPORT_11N)) { | 189 | if (!(wlc->pub->_n_enab & SUPPORT_11N)) { |
191 | wiphy_err(ampdu->wlc->wiphy, "wl%d: driver not " | 190 | brcms_err(core, "wl%d: driver not nmode enabled\n", |
192 | "nmode enabled\n", wlc->pub->unit); | 191 | wlc->pub->unit); |
193 | return -ENOTSUPP; | 192 | return -ENOTSUPP; |
194 | } | 193 | } |
195 | if (!brcms_c_ampdu_cap(ampdu)) { | 194 | if (!brcms_c_ampdu_cap(ampdu)) { |
196 | wiphy_err(ampdu->wlc->wiphy, "wl%d: device not " | 195 | brcms_err(core, "wl%d: device not ampdu capable\n", |
197 | "ampdu capable\n", wlc->pub->unit); | 196 | wlc->pub->unit); |
198 | return -ENOTSUPP; | 197 | return -ENOTSUPP; |
199 | } | 198 | } |
200 | wlc->pub->_ampdu = on; | 199 | wlc->pub->_ampdu = on; |
@@ -247,7 +246,6 @@ struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc) | |||
247 | ampdu->mpdu_density = AMPDU_DEF_MPDU_DENSITY; | 246 | ampdu->mpdu_density = AMPDU_DEF_MPDU_DENSITY; |
248 | ampdu->max_pdu = AUTO; | 247 | ampdu->max_pdu = AUTO; |
249 | ampdu->dur = AMPDU_MAX_DUR; | 248 | ampdu->dur = AMPDU_MAX_DUR; |
250 | ampdu->txpkt_weight = AMPDU_DEF_TXPKT_WEIGHT; | ||
251 | 249 | ||
252 | ampdu->ffpld_rsvd = AMPDU_DEF_FFPLD_RSVD; | 250 | ampdu->ffpld_rsvd = AMPDU_DEF_FFPLD_RSVD; |
253 | /* | 251 | /* |
@@ -374,7 +372,8 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid) | |||
374 | offsetof(struct macstat, txfunfl[fid])); | 372 | offsetof(struct macstat, txfunfl[fid])); |
375 | new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl); | 373 | new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl); |
376 | if (new_txunfl == 0) { | 374 | if (new_txunfl == 0) { |
377 | BCMMSG(wlc->wiphy, "TX status FRAG set but no tx underflows\n"); | 375 | brcms_dbg_ht(wlc->hw->d11core, |
376 | "TX status FRAG set but no tx underflows\n"); | ||
378 | return -1; | 377 | return -1; |
379 | } | 378 | } |
380 | fifo->prev_txfunfl = cur_txunfl; | 379 | fifo->prev_txfunfl = cur_txunfl; |
@@ -396,8 +395,8 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid) | |||
396 | if (fifo->accum_txfunfl < 10) | 395 | if (fifo->accum_txfunfl < 10) |
397 | return 0; | 396 | return 0; |
398 | 397 | ||
399 | BCMMSG(wlc->wiphy, "ampdu_count %d tx_underflows %d\n", | 398 | brcms_dbg_ht(wlc->hw->d11core, "ampdu_count %d tx_underflows %d\n", |
400 | current_ampdu_cnt, fifo->accum_txfunfl); | 399 | current_ampdu_cnt, fifo->accum_txfunfl); |
401 | 400 | ||
402 | /* | 401 | /* |
403 | compute the current ratio of tx unfl per ampdu. | 402 | compute the current ratio of tx unfl per ampdu. |
@@ -450,9 +449,10 @@ static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid) | |||
450 | (max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size)) | 449 | (max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size)) |
451 | / (max_mpdu * FFPLD_MPDU_SIZE)) * 100; | 450 | / (max_mpdu * FFPLD_MPDU_SIZE)) * 100; |
452 | 451 | ||
453 | BCMMSG(wlc->wiphy, "DMA estimated transfer rate %d; " | 452 | brcms_dbg_ht(wlc->hw->d11core, |
454 | "pre-load size %d\n", | 453 | "DMA estimated transfer rate %d; " |
455 | fifo->dmaxferrate, fifo->ampdu_pld_size); | 454 | "pre-load size %d\n", |
455 | fifo->dmaxferrate, fifo->ampdu_pld_size); | ||
456 | } else { | 456 | } else { |
457 | 457 | ||
458 | /* decrease ampdu size */ | 458 | /* decrease ampdu size */ |
@@ -486,7 +486,7 @@ brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, | |||
486 | scb_ampdu = &scb->scb_ampdu; | 486 | scb_ampdu = &scb->scb_ampdu; |
487 | 487 | ||
488 | if (!ampdu->ini_enable[tid]) { | 488 | if (!ampdu->ini_enable[tid]) { |
489 | wiphy_err(ampdu->wlc->wiphy, "%s: Rejecting tid %d\n", | 489 | brcms_err(wlc->hw->d11core, "%s: Rejecting tid %d\n", |
490 | __func__, tid); | 490 | __func__, tid); |
491 | return; | 491 | return; |
492 | } | 492 | } |
@@ -498,378 +498,324 @@ brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, | |||
498 | scb_ampdu->max_rx_ampdu_bytes = max_rx_ampdu_bytes; | 498 | scb_ampdu->max_rx_ampdu_bytes = max_rx_ampdu_bytes; |
499 | } | 499 | } |
500 | 500 | ||
501 | int | 501 | void brcms_c_ampdu_reset_session(struct brcms_ampdu_session *session, |
502 | brcms_c_sendampdu(struct ampdu_info *ampdu, struct brcms_txq_info *qi, | 502 | struct brcms_c_info *wlc) |
503 | struct sk_buff **pdu, int prec) | ||
504 | { | 503 | { |
505 | struct brcms_c_info *wlc; | 504 | session->wlc = wlc; |
506 | struct sk_buff *p, *pkt[AMPDU_MAX_MPDU]; | 505 | skb_queue_head_init(&session->skb_list); |
507 | u8 tid, ndelim; | 506 | session->max_ampdu_len = 0; /* determined from first MPDU */ |
508 | int err = 0; | 507 | session->max_ampdu_frames = 0; /* determined from first MPDU */ |
509 | u8 preamble_type = BRCMS_GF_PREAMBLE; | 508 | session->ampdu_len = 0; |
510 | u8 fbr_preamble_type = BRCMS_GF_PREAMBLE; | 509 | session->dma_len = 0; |
511 | u8 rts_preamble_type = BRCMS_LONG_PREAMBLE; | 510 | } |
512 | u8 rts_fbr_preamble_type = BRCMS_LONG_PREAMBLE; | ||
513 | 511 | ||
514 | bool rr = true, fbr = false; | 512 | /* |
515 | uint i, count = 0, fifo, seg_cnt = 0; | 513 | * Preps the given packet for AMPDU based on the session data. If the |
516 | u16 plen, len, seq = 0, mcl, mch, index, frameid, dma_len = 0; | 514 | * frame cannot be accomodated in the current session, -ENOSPC is |
517 | u32 ampdu_len, max_ampdu_bytes = 0; | 515 | * returned. |
518 | struct d11txh *txh = NULL; | 516 | */ |
517 | int brcms_c_ampdu_add_frame(struct brcms_ampdu_session *session, | ||
518 | struct sk_buff *p) | ||
519 | { | ||
520 | struct brcms_c_info *wlc = session->wlc; | ||
521 | struct ampdu_info *ampdu = wlc->ampdu; | ||
522 | struct scb *scb = &wlc->pri_scb; | ||
523 | struct scb_ampdu *scb_ampdu = &scb->scb_ampdu; | ||
524 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p); | ||
525 | struct ieee80211_tx_rate *txrate = tx_info->status.rates; | ||
526 | struct d11txh *txh = (struct d11txh *)p->data; | ||
527 | unsigned ampdu_frames; | ||
528 | u8 ndelim, tid; | ||
519 | u8 *plcp; | 529 | u8 *plcp; |
520 | struct ieee80211_hdr *h; | 530 | uint len; |
521 | struct scb *scb; | 531 | u16 mcl; |
522 | struct scb_ampdu *scb_ampdu; | ||
523 | struct scb_ampdu_tid_ini *ini; | ||
524 | u8 mcs = 0; | ||
525 | bool use_rts = false, use_cts = false; | ||
526 | u32 rspec = 0, rspec_fallback = 0; | ||
527 | u32 rts_rspec = 0, rts_rspec_fallback = 0; | ||
528 | u16 mimo_ctlchbw = PHY_TXC1_BW_20MHZ; | ||
529 | struct ieee80211_rts *rts; | ||
530 | u8 rr_retry_limit; | ||
531 | struct brcms_fifo_info *f; | ||
532 | bool fbr_iscck; | 532 | bool fbr_iscck; |
533 | struct ieee80211_tx_info *tx_info; | 533 | bool rr; |
534 | u16 qlen; | ||
535 | struct wiphy *wiphy; | ||
536 | |||
537 | wlc = ampdu->wlc; | ||
538 | wiphy = wlc->wiphy; | ||
539 | p = *pdu; | ||
540 | |||
541 | tid = (u8) (p->priority); | ||
542 | 534 | ||
543 | f = ampdu->fifo_tb + prio2fifo[tid]; | 535 | ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; |
536 | plcp = (u8 *)(txh + 1); | ||
537 | fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x03); | ||
538 | len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) : | ||
539 | BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); | ||
540 | len = roundup(len, 4) + (ndelim + 1) * AMPDU_DELIMITER_LEN; | ||
544 | 541 | ||
545 | scb = &wlc->pri_scb; | 542 | ampdu_frames = skb_queue_len(&session->skb_list); |
546 | scb_ampdu = &scb->scb_ampdu; | 543 | if (ampdu_frames != 0) { |
547 | ini = &scb_ampdu->ini[tid]; | 544 | struct sk_buff *first; |
548 | 545 | ||
549 | /* Let pressure continue to build ... */ | 546 | if (ampdu_frames + 1 > session->max_ampdu_frames || |
550 | qlen = pktq_plen(&qi->q, prec); | 547 | session->ampdu_len + len > session->max_ampdu_len) |
551 | if (ini->tx_in_transit > 0 && | 548 | return -ENOSPC; |
552 | qlen < min(scb_ampdu->max_pdu, ini->ba_wsize)) | ||
553 | /* Collect multiple MPDU's to be sent in the next AMPDU */ | ||
554 | return -EBUSY; | ||
555 | 549 | ||
556 | /* at this point we intend to transmit an AMPDU */ | 550 | /* |
557 | rr_retry_limit = ampdu->rr_retry_limit_tid[tid]; | 551 | * We aren't really out of space if the new frame is of |
558 | ampdu_len = 0; | 552 | * a different priority, but we want the same behaviour |
559 | dma_len = 0; | 553 | * so return -ENOSPC anyway. |
560 | while (p) { | 554 | * |
561 | struct ieee80211_tx_rate *txrate; | 555 | * XXX: The old AMPDU code did this, but is it really |
562 | 556 | * necessary? | |
563 | tx_info = IEEE80211_SKB_CB(p); | 557 | */ |
564 | txrate = tx_info->status.rates; | 558 | first = skb_peek(&session->skb_list); |
559 | if (p->priority != first->priority) | ||
560 | return -ENOSPC; | ||
561 | } | ||
565 | 562 | ||
566 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { | 563 | /* |
567 | err = brcms_c_prep_pdu(wlc, p, &fifo); | 564 | * Now that we're sure this frame can be accomodated, update the |
568 | } else { | 565 | * session information. |
569 | wiphy_err(wiphy, "%s: AMPDU flag is off!\n", __func__); | 566 | */ |
570 | *pdu = NULL; | 567 | session->ampdu_len += len; |
571 | err = 0; | 568 | session->dma_len += p->len; |
572 | break; | ||
573 | } | ||
574 | 569 | ||
575 | if (err) { | 570 | tid = (u8)p->priority; |
576 | if (err == -EBUSY) { | ||
577 | wiphy_err(wiphy, "wl%d: sendampdu: " | ||
578 | "prep_xdu retry; seq 0x%x\n", | ||
579 | wlc->pub->unit, seq); | ||
580 | *pdu = p; | ||
581 | break; | ||
582 | } | ||
583 | 571 | ||
584 | /* error in the packet; reject it */ | 572 | /* Handle retry limits */ |
585 | wiphy_err(wiphy, "wl%d: sendampdu: prep_xdu " | 573 | if (txrate[0].count <= ampdu->rr_retry_limit_tid[tid]) { |
586 | "rejected; seq 0x%x\n", wlc->pub->unit, seq); | 574 | txrate[0].count++; |
587 | *pdu = NULL; | 575 | rr = true; |
588 | break; | 576 | } else { |
589 | } | 577 | txrate[1].count++; |
578 | rr = false; | ||
579 | } | ||
590 | 580 | ||
591 | /* pkt is good to be aggregated */ | 581 | if (ampdu_frames == 0) { |
592 | txh = (struct d11txh *) p->data; | 582 | u8 plcp0, plcp3, is40, sgi, mcs; |
593 | plcp = (u8 *) (txh + 1); | 583 | uint fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK; |
594 | h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN); | 584 | struct brcms_fifo_info *f = &du->fifo_tb[fifo]; |
595 | seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT; | ||
596 | index = TX_SEQ_TO_INDEX(seq); | ||
597 | 585 | ||
598 | /* check mcl fields and test whether it can be agg'd */ | 586 | if (rr) { |
599 | mcl = le16_to_cpu(txh->MacTxControlLow); | 587 | plcp0 = plcp[0]; |
600 | mcl &= ~TXC_AMPDU_MASK; | 588 | plcp3 = plcp[3]; |
601 | fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x3); | ||
602 | txh->PreloadSize = 0; /* always default to 0 */ | ||
603 | |||
604 | /* Handle retry limits */ | ||
605 | if (txrate[0].count <= rr_retry_limit) { | ||
606 | txrate[0].count++; | ||
607 | rr = true; | ||
608 | fbr = false; | ||
609 | } else { | 589 | } else { |
610 | fbr = true; | 590 | plcp0 = txh->FragPLCPFallback[0]; |
611 | rr = false; | 591 | plcp3 = txh->FragPLCPFallback[3]; |
612 | txrate[1].count++; | ||
613 | } | ||
614 | |||
615 | /* extract the length info */ | ||
616 | len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) | ||
617 | : BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); | ||
618 | |||
619 | /* retrieve null delimiter count */ | ||
620 | ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; | ||
621 | seg_cnt += 1; | ||
622 | 592 | ||
623 | BCMMSG(wlc->wiphy, "wl%d: mpdu %d plcp_len %d\n", | ||
624 | wlc->pub->unit, count, len); | ||
625 | |||
626 | /* | ||
627 | * aggregateable mpdu. For ucode/hw agg, | ||
628 | * test whether need to break or change the epoch | ||
629 | */ | ||
630 | if (count == 0) { | ||
631 | mcl |= (TXC_AMPDU_FIRST << TXC_AMPDU_SHIFT); | ||
632 | /* refill the bits since might be a retx mpdu */ | ||
633 | mcl |= TXC_STARTMSDU; | ||
634 | rts = (struct ieee80211_rts *)&txh->rts_frame; | ||
635 | |||
636 | if (ieee80211_is_rts(rts->frame_control)) { | ||
637 | mcl |= TXC_SENDRTS; | ||
638 | use_rts = true; | ||
639 | } | ||
640 | if (ieee80211_is_cts(rts->frame_control)) { | ||
641 | mcl |= TXC_SENDCTS; | ||
642 | use_cts = true; | ||
643 | } | ||
644 | } else { | ||
645 | mcl |= (TXC_AMPDU_MIDDLE << TXC_AMPDU_SHIFT); | ||
646 | mcl &= ~(TXC_STARTMSDU | TXC_SENDRTS | TXC_SENDCTS); | ||
647 | } | 593 | } |
648 | 594 | ||
649 | len = roundup(len, 4); | 595 | /* Limit AMPDU size based on MCS */ |
650 | ampdu_len += (len + (ndelim + 1) * AMPDU_DELIMITER_LEN); | 596 | is40 = (plcp0 & MIMO_PLCP_40MHZ) ? 1 : 0; |
597 | sgi = plcp3_issgi(plcp3) ? 1 : 0; | ||
598 | mcs = plcp0 & ~MIMO_PLCP_40MHZ; | ||
599 | session->max_ampdu_len = min(scb_ampdu->max_rx_ampdu_bytes, | ||
600 | ampdu->max_txlen[mcs][is40][sgi]); | ||
651 | 601 | ||
652 | dma_len += (u16) p->len; | 602 | session->max_ampdu_frames = scb_ampdu->max_pdu; |
603 | if (mcs_2_rate(mcs, true, false) >= f->dmaxferrate) { | ||
604 | session->max_ampdu_frames = | ||
605 | min_t(u16, f->mcs2ampdu_table[mcs], | ||
606 | session->max_ampdu_frames); | ||
607 | } | ||
608 | } | ||
653 | 609 | ||
654 | BCMMSG(wlc->wiphy, "wl%d: ampdu_len %d" | 610 | /* |
655 | " seg_cnt %d null delim %d\n", | 611 | * Treat all frames as "middle" frames of AMPDU here. First and |
656 | wlc->pub->unit, ampdu_len, seg_cnt, ndelim); | 612 | * last frames must be fixed up after all MPDUs have been prepped. |
613 | */ | ||
614 | mcl = le16_to_cpu(txh->MacTxControlLow); | ||
615 | mcl &= ~TXC_AMPDU_MASK; | ||
616 | mcl |= (TXC_AMPDU_MIDDLE << TXC_AMPDU_SHIFT); | ||
617 | mcl &= ~(TXC_STARTMSDU | TXC_SENDRTS | TXC_SENDCTS); | ||
618 | txh->MacTxControlLow = cpu_to_le16(mcl); | ||
619 | txh->PreloadSize = 0; /* always default to 0 */ | ||
657 | 620 | ||
658 | txh->MacTxControlLow = cpu_to_le16(mcl); | 621 | skb_queue_tail(&session->skb_list, p); |
659 | 622 | ||
660 | /* this packet is added */ | 623 | return 0; |
661 | pkt[count++] = p; | 624 | } |
662 | 625 | ||
663 | /* patch the first MPDU */ | 626 | void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session) |
664 | if (count == 1) { | 627 | { |
665 | u8 plcp0, plcp3, is40, sgi; | 628 | struct brcms_c_info *wlc = session->wlc; |
629 | struct ampdu_info *ampdu = wlc->ampdu; | ||
630 | struct sk_buff *first, *last; | ||
631 | struct d11txh *txh; | ||
632 | struct ieee80211_tx_info *tx_info; | ||
633 | struct ieee80211_tx_rate *txrate; | ||
634 | u8 ndelim; | ||
635 | u8 *plcp; | ||
636 | uint len; | ||
637 | uint fifo; | ||
638 | struct brcms_fifo_info *f; | ||
639 | u16 mcl; | ||
640 | bool fbr; | ||
641 | bool fbr_iscck; | ||
642 | struct ieee80211_rts *rts; | ||
643 | bool use_rts = false, use_cts = false; | ||
644 | u16 dma_len = session->dma_len; | ||
645 | u16 mimo_ctlchbw = PHY_TXC1_BW_20MHZ; | ||
646 | u32 rspec = 0, rspec_fallback = 0; | ||
647 | u32 rts_rspec = 0, rts_rspec_fallback = 0; | ||
648 | u8 plcp0, plcp3, is40, sgi, mcs; | ||
649 | u16 mch; | ||
650 | u8 preamble_type = BRCMS_GF_PREAMBLE; | ||
651 | u8 fbr_preamble_type = BRCMS_GF_PREAMBLE; | ||
652 | u8 rts_preamble_type = BRCMS_LONG_PREAMBLE; | ||
653 | u8 rts_fbr_preamble_type = BRCMS_LONG_PREAMBLE; | ||
666 | 654 | ||
667 | if (rr) { | 655 | if (skb_queue_empty(&session->skb_list)) |
668 | plcp0 = plcp[0]; | 656 | return; |
669 | plcp3 = plcp[3]; | ||
670 | } else { | ||
671 | plcp0 = txh->FragPLCPFallback[0]; | ||
672 | plcp3 = txh->FragPLCPFallback[3]; | ||
673 | 657 | ||
674 | } | 658 | first = skb_peek(&session->skb_list); |
675 | is40 = (plcp0 & MIMO_PLCP_40MHZ) ? 1 : 0; | 659 | last = skb_peek_tail(&session->skb_list); |
676 | sgi = plcp3_issgi(plcp3) ? 1 : 0; | 660 | |
677 | mcs = plcp0 & ~MIMO_PLCP_40MHZ; | 661 | /* Need to fix up last MPDU first to adjust AMPDU length */ |
678 | max_ampdu_bytes = | 662 | txh = (struct d11txh *)last->data; |
679 | min(scb_ampdu->max_rx_ampdu_bytes, | 663 | fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK; |
680 | ampdu->max_txlen[mcs][is40][sgi]); | 664 | f = &du->fifo_tb[fifo]; |
681 | 665 | ||
682 | if (is40) | 666 | mcl = le16_to_cpu(txh->MacTxControlLow); |
683 | mimo_ctlchbw = | 667 | mcl &= ~TXC_AMPDU_MASK; |
684 | CHSPEC_SB_UPPER(wlc_phy_chanspec_get( | 668 | mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT); |
685 | wlc->band->pi)) | 669 | txh->MacTxControlLow = cpu_to_le16(mcl); |
686 | ? PHY_TXC1_BW_20MHZ_UP : PHY_TXC1_BW_20MHZ; | 670 | |
687 | 671 | /* remove the null delimiter after last mpdu */ | |
688 | /* rebuild the rspec and rspec_fallback */ | 672 | ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; |
689 | rspec = RSPEC_MIMORATE; | 673 | txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] = 0; |
690 | rspec |= plcp[0] & ~MIMO_PLCP_40MHZ; | 674 | session->ampdu_len -= ndelim * AMPDU_DELIMITER_LEN; |
691 | if (plcp[0] & MIMO_PLCP_40MHZ) | 675 | |
692 | rspec |= (PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT); | 676 | /* remove the pad len from last mpdu */ |
693 | 677 | fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0); | |
694 | if (fbr_iscck) /* CCK */ | 678 | len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) : |
695 | rspec_fallback = cck_rspec(cck_phy2mac_rate | 679 | BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); |
696 | (txh->FragPLCPFallback[0])); | 680 | session->ampdu_len -= roundup(len, 4) - len; |
697 | else { /* MIMO */ | 681 | |
698 | rspec_fallback = RSPEC_MIMORATE; | 682 | /* Now fix up the first MPDU */ |
699 | rspec_fallback |= | 683 | tx_info = IEEE80211_SKB_CB(first); |
700 | txh->FragPLCPFallback[0] & ~MIMO_PLCP_40MHZ; | 684 | txrate = tx_info->status.rates; |
701 | if (txh->FragPLCPFallback[0] & MIMO_PLCP_40MHZ) | 685 | txh = (struct d11txh *)first->data; |
702 | rspec_fallback |= | 686 | plcp = (u8 *)(txh + 1); |
703 | (PHY_TXC1_BW_40MHZ << | 687 | rts = (struct ieee80211_rts *)&txh->rts_frame; |
704 | RSPEC_BW_SHIFT); | 688 | |
705 | } | 689 | mcl = le16_to_cpu(txh->MacTxControlLow); |
690 | /* If only one MPDU leave it marked as last */ | ||
691 | if (first != last) { | ||
692 | mcl &= ~TXC_AMPDU_MASK; | ||
693 | mcl |= (TXC_AMPDU_FIRST << TXC_AMPDU_SHIFT); | ||
694 | } | ||
695 | mcl |= TXC_STARTMSDU; | ||
696 | if (ieee80211_is_rts(rts->frame_control)) { | ||
697 | mcl |= TXC_SENDRTS; | ||
698 | use_rts = true; | ||
699 | } | ||
700 | if (ieee80211_is_cts(rts->frame_control)) { | ||
701 | mcl |= TXC_SENDCTS; | ||
702 | use_cts = true; | ||
703 | } | ||
704 | txh->MacTxControlLow = cpu_to_le16(mcl); | ||
706 | 705 | ||
707 | if (use_rts || use_cts) { | 706 | fbr = txrate[1].count > 0; |
708 | rts_rspec = | 707 | if (!fbr) { |
709 | brcms_c_rspec_to_rts_rspec(wlc, | 708 | plcp0 = plcp[0]; |
710 | rspec, false, mimo_ctlchbw); | 709 | plcp3 = plcp[3]; |
711 | rts_rspec_fallback = | 710 | } else { |
712 | brcms_c_rspec_to_rts_rspec(wlc, | 711 | plcp0 = txh->FragPLCPFallback[0]; |
713 | rspec_fallback, false, mimo_ctlchbw); | 712 | plcp3 = txh->FragPLCPFallback[3]; |
714 | } | 713 | } |
715 | } | 714 | is40 = (plcp0 & MIMO_PLCP_40MHZ) ? 1 : 0; |
715 | sgi = plcp3_issgi(plcp3) ? 1 : 0; | ||
716 | mcs = plcp0 & ~MIMO_PLCP_40MHZ; | ||
717 | |||
718 | if (is40) { | ||
719 | if (CHSPEC_SB_UPPER(wlc_phy_chanspec_get(wlc->band->pi))) | ||
720 | mimo_ctlchbw = PHY_TXC1_BW_20MHZ_UP; | ||
721 | else | ||
722 | mimo_ctlchbw = PHY_TXC1_BW_20MHZ; | ||
723 | } | ||
716 | 724 | ||
717 | /* if (first mpdu for host agg) */ | 725 | /* rebuild the rspec and rspec_fallback */ |
718 | /* test whether to add more */ | 726 | rspec = RSPEC_MIMORATE; |
719 | if ((mcs_2_rate(mcs, true, false) >= f->dmaxferrate) && | 727 | rspec |= plcp[0] & ~MIMO_PLCP_40MHZ; |
720 | (count == f->mcs2ampdu_table[mcs])) { | 728 | if (plcp[0] & MIMO_PLCP_40MHZ) |
721 | BCMMSG(wlc->wiphy, "wl%d: PR 37644: stopping" | 729 | rspec |= (PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT); |
722 | " ampdu at %d for mcs %d\n", | ||
723 | wlc->pub->unit, count, mcs); | ||
724 | break; | ||
725 | } | ||
726 | 730 | ||
727 | if (count == scb_ampdu->max_pdu) | 731 | fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x03); |
728 | break; | 732 | if (fbr_iscck) { |
733 | rspec_fallback = | ||
734 | cck_rspec(cck_phy2mac_rate(txh->FragPLCPFallback[0])); | ||
735 | } else { | ||
736 | rspec_fallback = RSPEC_MIMORATE; | ||
737 | rspec_fallback |= txh->FragPLCPFallback[0] & ~MIMO_PLCP_40MHZ; | ||
738 | if (txh->FragPLCPFallback[0] & MIMO_PLCP_40MHZ) | ||
739 | rspec_fallback |= PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT; | ||
740 | } | ||
729 | 741 | ||
730 | /* | 742 | if (use_rts || use_cts) { |
731 | * check to see if the next pkt is | 743 | rts_rspec = |
732 | * a candidate for aggregation | 744 | brcms_c_rspec_to_rts_rspec(wlc, rspec, |
733 | */ | 745 | false, mimo_ctlchbw); |
734 | p = pktq_ppeek(&qi->q, prec); | 746 | rts_rspec_fallback = |
735 | if (p) { | 747 | brcms_c_rspec_to_rts_rspec(wlc, rspec_fallback, |
736 | tx_info = IEEE80211_SKB_CB(p); | 748 | false, mimo_ctlchbw); |
737 | if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && | 749 | } |
738 | ((u8) (p->priority) == tid)) { | ||
739 | plen = p->len + AMPDU_MAX_MPDU_OVERHEAD; | ||
740 | plen = max(scb_ampdu->min_len, plen); | ||
741 | 750 | ||
742 | if ((plen + ampdu_len) > max_ampdu_bytes) { | 751 | BRCMS_SET_MIMO_PLCP_LEN(plcp, session->ampdu_len); |
743 | p = NULL; | 752 | /* mark plcp to indicate ampdu */ |
744 | continue; | 753 | BRCMS_SET_MIMO_PLCP_AMPDU(plcp); |
745 | } | ||
746 | 754 | ||
747 | /* | 755 | /* reset the mixed mode header durations */ |
748 | * check if there are enough | 756 | if (txh->MModeLen) { |
749 | * descriptors available | 757 | u16 mmodelen = brcms_c_calc_lsig_len(wlc, rspec, |
750 | */ | 758 | session->ampdu_len); |
751 | if (*wlc->core->txavail[fifo] <= seg_cnt + 1) { | 759 | txh->MModeLen = cpu_to_le16(mmodelen); |
752 | wiphy_err(wiphy, "%s: No fifo space " | 760 | preamble_type = BRCMS_MM_PREAMBLE; |
753 | "!!\n", __func__); | 761 | } |
754 | p = NULL; | 762 | if (txh->MModeFbrLen) { |
755 | continue; | 763 | u16 mmfbrlen = brcms_c_calc_lsig_len(wlc, rspec_fallback, |
756 | } | 764 | session->ampdu_len); |
757 | /* next packet fit for aggregation so dequeue */ | 765 | txh->MModeFbrLen = cpu_to_le16(mmfbrlen); |
758 | p = brcmu_pktq_pdeq(&qi->q, prec); | 766 | fbr_preamble_type = BRCMS_MM_PREAMBLE; |
759 | } else { | 767 | } |
760 | p = NULL; | ||
761 | } | ||
762 | } | ||
763 | } /* end while(p) */ | ||
764 | 768 | ||
765 | ini->tx_in_transit += count; | 769 | /* set the preload length */ |
770 | if (mcs_2_rate(mcs, true, false) >= f->dmaxferrate) { | ||
771 | dma_len = min(dma_len, f->ampdu_pld_size); | ||
772 | txh->PreloadSize = cpu_to_le16(dma_len); | ||
773 | } else { | ||
774 | txh->PreloadSize = 0; | ||
775 | } | ||
766 | 776 | ||
767 | if (count) { | 777 | mch = le16_to_cpu(txh->MacTxControlHigh); |
768 | /* patch up the last txh */ | ||
769 | txh = (struct d11txh *) pkt[count - 1]->data; | ||
770 | mcl = le16_to_cpu(txh->MacTxControlLow); | ||
771 | mcl &= ~TXC_AMPDU_MASK; | ||
772 | mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT); | ||
773 | txh->MacTxControlLow = cpu_to_le16(mcl); | ||
774 | |||
775 | /* remove the null delimiter after last mpdu */ | ||
776 | ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; | ||
777 | txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] = 0; | ||
778 | ampdu_len -= ndelim * AMPDU_DELIMITER_LEN; | ||
779 | |||
780 | /* remove the pad len from last mpdu */ | ||
781 | fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0); | ||
782 | len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) | ||
783 | : BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); | ||
784 | ampdu_len -= roundup(len, 4) - len; | ||
785 | |||
786 | /* patch up the first txh & plcp */ | ||
787 | txh = (struct d11txh *) pkt[0]->data; | ||
788 | plcp = (u8 *) (txh + 1); | ||
789 | 778 | ||
790 | BRCMS_SET_MIMO_PLCP_LEN(plcp, ampdu_len); | 779 | /* update RTS dur fields */ |
791 | /* mark plcp to indicate ampdu */ | 780 | if (use_rts || use_cts) { |
792 | BRCMS_SET_MIMO_PLCP_AMPDU(plcp); | 781 | u16 durid; |
782 | if ((mch & TXC_PREAMBLE_RTS_MAIN_SHORT) == | ||
783 | TXC_PREAMBLE_RTS_MAIN_SHORT) | ||
784 | rts_preamble_type = BRCMS_SHORT_PREAMBLE; | ||
793 | 785 | ||
794 | /* reset the mixed mode header durations */ | 786 | if ((mch & TXC_PREAMBLE_RTS_FB_SHORT) == |
795 | if (txh->MModeLen) { | 787 | TXC_PREAMBLE_RTS_FB_SHORT) |
796 | u16 mmodelen = | 788 | rts_fbr_preamble_type = BRCMS_SHORT_PREAMBLE; |
797 | brcms_c_calc_lsig_len(wlc, rspec, ampdu_len); | ||
798 | txh->MModeLen = cpu_to_le16(mmodelen); | ||
799 | preamble_type = BRCMS_MM_PREAMBLE; | ||
800 | } | ||
801 | if (txh->MModeFbrLen) { | ||
802 | u16 mmfbrlen = | ||
803 | brcms_c_calc_lsig_len(wlc, rspec_fallback, | ||
804 | ampdu_len); | ||
805 | txh->MModeFbrLen = cpu_to_le16(mmfbrlen); | ||
806 | fbr_preamble_type = BRCMS_MM_PREAMBLE; | ||
807 | } | ||
808 | 789 | ||
809 | /* set the preload length */ | 790 | durid = brcms_c_compute_rtscts_dur(wlc, use_cts, rts_rspec, |
810 | if (mcs_2_rate(mcs, true, false) >= f->dmaxferrate) { | ||
811 | dma_len = min(dma_len, f->ampdu_pld_size); | ||
812 | txh->PreloadSize = cpu_to_le16(dma_len); | ||
813 | } else | ||
814 | txh->PreloadSize = 0; | ||
815 | |||
816 | mch = le16_to_cpu(txh->MacTxControlHigh); | ||
817 | |||
818 | /* update RTS dur fields */ | ||
819 | if (use_rts || use_cts) { | ||
820 | u16 durid; | ||
821 | rts = (struct ieee80211_rts *)&txh->rts_frame; | ||
822 | if ((mch & TXC_PREAMBLE_RTS_MAIN_SHORT) == | ||
823 | TXC_PREAMBLE_RTS_MAIN_SHORT) | ||
824 | rts_preamble_type = BRCMS_SHORT_PREAMBLE; | ||
825 | |||
826 | if ((mch & TXC_PREAMBLE_RTS_FB_SHORT) == | ||
827 | TXC_PREAMBLE_RTS_FB_SHORT) | ||
828 | rts_fbr_preamble_type = BRCMS_SHORT_PREAMBLE; | ||
829 | |||
830 | durid = | ||
831 | brcms_c_compute_rtscts_dur(wlc, use_cts, rts_rspec, | ||
832 | rspec, rts_preamble_type, | 791 | rspec, rts_preamble_type, |
833 | preamble_type, ampdu_len, | 792 | preamble_type, |
834 | true); | 793 | session->ampdu_len, true); |
835 | rts->duration = cpu_to_le16(durid); | 794 | rts->duration = cpu_to_le16(durid); |
836 | durid = brcms_c_compute_rtscts_dur(wlc, use_cts, | 795 | durid = brcms_c_compute_rtscts_dur(wlc, use_cts, |
837 | rts_rspec_fallback, | 796 | rts_rspec_fallback, |
838 | rspec_fallback, | 797 | rspec_fallback, |
839 | rts_fbr_preamble_type, | 798 | rts_fbr_preamble_type, |
840 | fbr_preamble_type, | 799 | fbr_preamble_type, |
841 | ampdu_len, true); | 800 | session->ampdu_len, true); |
842 | txh->RTSDurFallback = cpu_to_le16(durid); | 801 | txh->RTSDurFallback = cpu_to_le16(durid); |
843 | /* set TxFesTimeNormal */ | 802 | /* set TxFesTimeNormal */ |
844 | txh->TxFesTimeNormal = rts->duration; | 803 | txh->TxFesTimeNormal = rts->duration; |
845 | /* set fallback rate version of TxFesTimeNormal */ | 804 | /* set fallback rate version of TxFesTimeNormal */ |
846 | txh->TxFesTimeFallback = txh->RTSDurFallback; | 805 | txh->TxFesTimeFallback = txh->RTSDurFallback; |
847 | } | 806 | } |
848 | |||
849 | /* set flag and plcp for fallback rate */ | ||
850 | if (fbr) { | ||
851 | mch |= TXC_AMPDU_FBR; | ||
852 | txh->MacTxControlHigh = cpu_to_le16(mch); | ||
853 | BRCMS_SET_MIMO_PLCP_AMPDU(plcp); | ||
854 | BRCMS_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback); | ||
855 | } | ||
856 | |||
857 | BCMMSG(wlc->wiphy, "wl%d: count %d ampdu_len %d\n", | ||
858 | wlc->pub->unit, count, ampdu_len); | ||
859 | |||
860 | /* inform rate_sel if it this is a rate probe pkt */ | ||
861 | frameid = le16_to_cpu(txh->TxFrameID); | ||
862 | if (frameid & TXFID_RATE_PROBE_MASK) | ||
863 | wiphy_err(wiphy, "%s: XXX what to do with " | ||
864 | "TXFID_RATE_PROBE_MASK!?\n", __func__); | ||
865 | |||
866 | for (i = 0; i < count; i++) | ||
867 | brcms_c_txfifo(wlc, fifo, pkt[i], i == (count - 1), | ||
868 | ampdu->txpkt_weight); | ||
869 | 807 | ||
808 | /* set flag and plcp for fallback rate */ | ||
809 | if (fbr) { | ||
810 | mch |= TXC_AMPDU_FBR; | ||
811 | txh->MacTxControlHigh = cpu_to_le16(mch); | ||
812 | BRCMS_SET_MIMO_PLCP_AMPDU(plcp); | ||
813 | BRCMS_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback); | ||
870 | } | 814 | } |
871 | /* endif (count) */ | 815 | |
872 | return err; | 816 | brcms_dbg_ht(wlc->hw->d11core, "wl%d: count %d ampdu_len %d\n", |
817 | wlc->pub->unit, skb_queue_len(&session->skb_list), | ||
818 | session->ampdu_len); | ||
873 | } | 819 | } |
874 | 820 | ||
875 | static void | 821 | static void |
@@ -909,7 +855,6 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
909 | u8 antselid = 0; | 855 | u8 antselid = 0; |
910 | u8 retry_limit, rr_retry_limit; | 856 | u8 retry_limit, rr_retry_limit; |
911 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p); | 857 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p); |
912 | struct wiphy *wiphy = wlc->wiphy; | ||
913 | 858 | ||
914 | #ifdef DEBUG | 859 | #ifdef DEBUG |
915 | u8 hole[AMPDU_MAX_MPDU]; | 860 | u8 hole[AMPDU_MAX_MPDU]; |
@@ -955,13 +900,14 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
955 | if (supr_status) { | 900 | if (supr_status) { |
956 | update_rate = false; | 901 | update_rate = false; |
957 | if (supr_status == TX_STATUS_SUPR_BADCH) { | 902 | if (supr_status == TX_STATUS_SUPR_BADCH) { |
958 | wiphy_err(wiphy, | 903 | brcms_err(wlc->hw->d11core, |
959 | "%s: Pkt tx suppressed, illegal channel possibly %d\n", | 904 | "%s: Pkt tx suppressed, illegal channel possibly %d\n", |
960 | __func__, CHSPEC_CHANNEL( | 905 | __func__, CHSPEC_CHANNEL( |
961 | wlc->default_bss->chanspec)); | 906 | wlc->default_bss->chanspec)); |
962 | } else { | 907 | } else { |
963 | if (supr_status != TX_STATUS_SUPR_FRAG) | 908 | if (supr_status != TX_STATUS_SUPR_FRAG) |
964 | wiphy_err(wiphy, "%s: supr_status 0x%x\n", | 909 | brcms_err(wlc->hw->d11core, |
910 | "%s: supr_status 0x%x\n", | ||
965 | __func__, supr_status); | 911 | __func__, supr_status); |
966 | } | 912 | } |
967 | /* no need to retry for badch; will fail again */ | 913 | /* no need to retry for badch; will fail again */ |
@@ -977,20 +923,14 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
977 | * if there were underflows, but pre-loading | 923 | * if there were underflows, but pre-loading |
978 | * is not active, notify rate adaptation. | 924 | * is not active, notify rate adaptation. |
979 | */ | 925 | */ |
980 | if (brcms_c_ffpld_check_txfunfl(wlc, | 926 | if (brcms_c_ffpld_check_txfunfl(wlc, queue) > 0) |
981 | prio2fifo[tid]) > 0) | ||
982 | tx_error = true; | 927 | tx_error = true; |
983 | } | 928 | } |
984 | } else if (txs->phyerr) { | 929 | } else if (txs->phyerr) { |
985 | update_rate = false; | 930 | update_rate = false; |
986 | wiphy_err(wiphy, "%s: ampdu tx phy error (0x%x)\n", | 931 | brcms_err(wlc->hw->d11core, |
932 | "%s: ampdu tx phy error (0x%x)\n", | ||
987 | __func__, txs->phyerr); | 933 | __func__, txs->phyerr); |
988 | |||
989 | if (brcm_msg_level & LOG_ERROR_VAL) { | ||
990 | brcmu_prpkt("txpkt (AMPDU)", p); | ||
991 | brcms_c_print_txdesc((struct d11txh *) p->data); | ||
992 | } | ||
993 | brcms_c_print_txstatus(txs); | ||
994 | } | 934 | } |
995 | } | 935 | } |
996 | 936 | ||
@@ -1003,6 +943,8 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
1003 | h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN); | 943 | h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN); |
1004 | seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT; | 944 | seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT; |
1005 | 945 | ||
946 | trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, sizeof(*txh)); | ||
947 | |||
1006 | if (tot_mpdu == 0) { | 948 | if (tot_mpdu == 0) { |
1007 | mcs = plcp[0] & MIMO_PLCP_MCS_MASK; | 949 | mcs = plcp[0] & MIMO_PLCP_MCS_MASK; |
1008 | mimoantsel = le16_to_cpu(txh->ABI_MimoAntSel); | 950 | mimoantsel = le16_to_cpu(txh->ABI_MimoAntSel); |
@@ -1012,10 +954,10 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
1012 | ack_recd = false; | 954 | ack_recd = false; |
1013 | if (ba_recd) { | 955 | if (ba_recd) { |
1014 | bindex = MODSUB_POW2(seq, start_seq, SEQNUM_MAX); | 956 | bindex = MODSUB_POW2(seq, start_seq, SEQNUM_MAX); |
1015 | BCMMSG(wiphy, | 957 | brcms_dbg_ht(wlc->hw->d11core, |
1016 | "tid %d seq %d, start_seq %d, bindex %d set %d, index %d\n", | 958 | "tid %d seq %d, start_seq %d, bindex %d set %d, index %d\n", |
1017 | tid, seq, start_seq, bindex, | 959 | tid, seq, start_seq, bindex, |
1018 | isset(bitmap, bindex), index); | 960 | isset(bitmap, bindex), index); |
1019 | /* if acked then clear bit and free packet */ | 961 | /* if acked then clear bit and free packet */ |
1020 | if ((bindex < AMPDU_TX_BA_MAX_WSIZE) | 962 | if ((bindex < AMPDU_TX_BA_MAX_WSIZE) |
1021 | && isset(bitmap, bindex)) { | 963 | && isset(bitmap, bindex)) { |
@@ -1046,14 +988,16 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
1046 | /* either retransmit or send bar if ack not recd */ | 988 | /* either retransmit or send bar if ack not recd */ |
1047 | if (!ack_recd) { | 989 | if (!ack_recd) { |
1048 | if (retry && (ini->txretry[index] < (int)retry_limit)) { | 990 | if (retry && (ini->txretry[index] < (int)retry_limit)) { |
991 | int ret; | ||
1049 | ini->txretry[index]++; | 992 | ini->txretry[index]++; |
1050 | ini->tx_in_transit--; | 993 | ini->tx_in_transit--; |
994 | ret = brcms_c_txfifo(wlc, queue, p); | ||
1051 | /* | 995 | /* |
1052 | * Use high prededence for retransmit to | 996 | * We shouldn't be out of space in the DMA |
1053 | * give some punch | 997 | * ring here since we're reinserting a frame |
998 | * that was just pulled out. | ||
1054 | */ | 999 | */ |
1055 | brcms_c_txq_enq(wlc, scb, p, | 1000 | WARN_ONCE(ret, "queue %d out of txds\n", queue); |
1056 | BRCMS_PRIO_TO_HI_PREC(tid)); | ||
1057 | } else { | 1001 | } else { |
1058 | /* Retry timeout */ | 1002 | /* Retry timeout */ |
1059 | ini->tx_in_transit--; | 1003 | ini->tx_in_transit--; |
@@ -1064,9 +1008,9 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
1064 | IEEE80211_TX_STAT_AMPDU_NO_BACK; | 1008 | IEEE80211_TX_STAT_AMPDU_NO_BACK; |
1065 | skb_pull(p, D11_PHY_HDR_LEN); | 1009 | skb_pull(p, D11_PHY_HDR_LEN); |
1066 | skb_pull(p, D11_TXH_LEN); | 1010 | skb_pull(p, D11_TXH_LEN); |
1067 | BCMMSG(wiphy, | 1011 | brcms_dbg_ht(wlc->hw->d11core, |
1068 | "BA Timeout, seq %d, in_transit %d\n", | 1012 | "BA Timeout, seq %d, in_transit %d\n", |
1069 | seq, ini->tx_in_transit); | 1013 | seq, ini->tx_in_transit); |
1070 | ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, | 1014 | ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, |
1071 | p); | 1015 | p); |
1072 | } | 1016 | } |
@@ -1080,12 +1024,9 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, | |||
1080 | 1024 | ||
1081 | p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); | 1025 | p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); |
1082 | } | 1026 | } |
1083 | brcms_c_send_q(wlc); | ||
1084 | 1027 | ||
1085 | /* update rate state */ | 1028 | /* update rate state */ |
1086 | antselid = brcms_c_antsel_antsel2id(wlc->asi, mimoantsel); | 1029 | antselid = brcms_c_antsel_antsel2id(wlc->asi, mimoantsel); |
1087 | |||
1088 | brcms_c_txfifo_complete(wlc, queue, ampdu->txpkt_weight); | ||
1089 | } | 1030 | } |
1090 | 1031 | ||
1091 | void | 1032 | void |
@@ -1133,6 +1074,8 @@ brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, | |||
1133 | while (p) { | 1074 | while (p) { |
1134 | tx_info = IEEE80211_SKB_CB(p); | 1075 | tx_info = IEEE80211_SKB_CB(p); |
1135 | txh = (struct d11txh *) p->data; | 1076 | txh = (struct d11txh *) p->data; |
1077 | trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, | ||
1078 | sizeof(*txh)); | ||
1136 | mcl = le16_to_cpu(txh->MacTxControlLow); | 1079 | mcl = le16_to_cpu(txh->MacTxControlLow); |
1137 | brcmu_pkt_buf_free_skb(p); | 1080 | brcmu_pkt_buf_free_skb(p); |
1138 | /* break out if last packet of ampdu */ | 1081 | /* break out if last packet of ampdu */ |
@@ -1142,7 +1085,6 @@ brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, | |||
1142 | p = dma_getnexttxp(wlc->hw->di[queue], | 1085 | p = dma_getnexttxp(wlc->hw->di[queue], |
1143 | DMA_RANGE_TRANSMITTED); | 1086 | DMA_RANGE_TRANSMITTED); |
1144 | } | 1087 | } |
1145 | brcms_c_txfifo_complete(wlc, queue, ampdu->txpkt_weight); | ||
1146 | } | 1088 | } |
1147 | } | 1089 | } |
1148 | 1090 | ||
@@ -1182,23 +1124,6 @@ void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu) | |||
1182 | } | 1124 | } |
1183 | 1125 | ||
1184 | /* | 1126 | /* |
1185 | * callback function that helps flushing ampdu packets from a priority queue | ||
1186 | */ | ||
1187 | static bool cb_del_ampdu_pkt(struct sk_buff *mpdu, void *arg_a) | ||
1188 | { | ||
1189 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(mpdu); | ||
1190 | struct cb_del_ampdu_pars *ampdu_pars = | ||
1191 | (struct cb_del_ampdu_pars *)arg_a; | ||
1192 | bool rc; | ||
1193 | |||
1194 | rc = tx_info->flags & IEEE80211_TX_CTL_AMPDU ? true : false; | ||
1195 | rc = rc && (tx_info->rate_driver_data[0] == NULL || ampdu_pars->sta == NULL || | ||
1196 | tx_info->rate_driver_data[0] == ampdu_pars->sta); | ||
1197 | rc = rc && ((u8)(mpdu->priority) == ampdu_pars->tid); | ||
1198 | return rc; | ||
1199 | } | ||
1200 | |||
1201 | /* | ||
1202 | * callback function that helps invalidating ampdu packets in a DMA queue | 1127 | * callback function that helps invalidating ampdu packets in a DMA queue |
1203 | */ | 1128 | */ |
1204 | static void dma_cb_fn_ampdu(void *txi, void *arg_a) | 1129 | static void dma_cb_fn_ampdu(void *txi, void *arg_a) |
@@ -1218,15 +1143,5 @@ static void dma_cb_fn_ampdu(void *txi, void *arg_a) | |||
1218 | void brcms_c_ampdu_flush(struct brcms_c_info *wlc, | 1143 | void brcms_c_ampdu_flush(struct brcms_c_info *wlc, |
1219 | struct ieee80211_sta *sta, u16 tid) | 1144 | struct ieee80211_sta *sta, u16 tid) |
1220 | { | 1145 | { |
1221 | struct brcms_txq_info *qi = wlc->pkt_queue; | ||
1222 | struct pktq *pq = &qi->q; | ||
1223 | int prec; | ||
1224 | struct cb_del_ampdu_pars ampdu_pars; | ||
1225 | |||
1226 | ampdu_pars.sta = sta; | ||
1227 | ampdu_pars.tid = tid; | ||
1228 | for (prec = 0; prec < pq->num_prec; prec++) | ||
1229 | brcmu_pktq_pflush(pq, prec, true, cb_del_ampdu_pkt, | ||
1230 | (void *)&du_pars); | ||
1231 | brcms_c_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu); | 1146 | brcms_c_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu); |
1232 | } | 1147 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h index 421f4ba7c63c..73d01e586109 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h | |||
@@ -17,11 +17,34 @@ | |||
17 | #ifndef _BRCM_AMPDU_H_ | 17 | #ifndef _BRCM_AMPDU_H_ |
18 | #define _BRCM_AMPDU_H_ | 18 | #define _BRCM_AMPDU_H_ |
19 | 19 | ||
20 | /* | ||
21 | * Data structure representing an in-progress session for accumulating | ||
22 | * frames for AMPDU. | ||
23 | * | ||
24 | * wlc: pointer to common driver data | ||
25 | * skb_list: queue of skb's for AMPDU | ||
26 | * max_ampdu_len: maximum length for this AMPDU | ||
27 | * max_ampdu_frames: maximum number of frames for this AMPDU | ||
28 | * ampdu_len: total number of bytes accumulated for this AMPDU | ||
29 | * dma_len: DMA length of this AMPDU | ||
30 | */ | ||
31 | struct brcms_ampdu_session { | ||
32 | struct brcms_c_info *wlc; | ||
33 | struct sk_buff_head skb_list; | ||
34 | unsigned max_ampdu_len; | ||
35 | u16 max_ampdu_frames; | ||
36 | u16 ampdu_len; | ||
37 | u16 dma_len; | ||
38 | }; | ||
39 | |||
40 | extern void brcms_c_ampdu_reset_session(struct brcms_ampdu_session *session, | ||
41 | struct brcms_c_info *wlc); | ||
42 | extern int brcms_c_ampdu_add_frame(struct brcms_ampdu_session *session, | ||
43 | struct sk_buff *p); | ||
44 | extern void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session); | ||
45 | |||
20 | extern struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc); | 46 | extern struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc); |
21 | extern void brcms_c_ampdu_detach(struct ampdu_info *ampdu); | 47 | extern void brcms_c_ampdu_detach(struct ampdu_info *ampdu); |
22 | extern int brcms_c_sendampdu(struct ampdu_info *ampdu, | ||
23 | struct brcms_txq_info *qi, | ||
24 | struct sk_buff **aggp, int prec); | ||
25 | extern void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, | 48 | extern void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, |
26 | struct sk_buff *p, struct tx_status *txs); | 49 | struct sk_buff *p, struct tx_status *txs); |
27 | extern void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc); | 50 | extern void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/antsel.c b/drivers/net/wireless/brcm80211/brcmsmac/antsel.c index 55e12c327911..54c616919590 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/antsel.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/antsel.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "main.h" | 21 | #include "main.h" |
22 | #include "phy_shim.h" | 22 | #include "phy_shim.h" |
23 | #include "antsel.h" | 23 | #include "antsel.h" |
24 | #include "debug.h" | ||
24 | 25 | ||
25 | #define ANT_SELCFG_AUTO 0x80 /* bit indicates antenna sel AUTO */ | 26 | #define ANT_SELCFG_AUTO 0x80 /* bit indicates antenna sel AUTO */ |
26 | #define ANT_SELCFG_MASK 0x33 /* antenna configuration mask */ | 27 | #define ANT_SELCFG_MASK 0x33 /* antenna configuration mask */ |
@@ -137,7 +138,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) | |||
137 | asi->antsel_avail = false; | 138 | asi->antsel_avail = false; |
138 | } else { | 139 | } else { |
139 | asi->antsel_avail = false; | 140 | asi->antsel_avail = false; |
140 | wiphy_err(wlc->wiphy, "antsel_attach: 2o3 " | 141 | brcms_err(wlc->hw->d11core, |
142 | "antsel_attach: 2o3 " | ||
141 | "board cfg invalid\n"); | 143 | "board cfg invalid\n"); |
142 | } | 144 | } |
143 | 145 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h b/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h index 27dd73eef56d..871781e6a713 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h | |||
@@ -14,22 +14,29 @@ | |||
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #undef TRACE_SYSTEM | ||
18 | #define TRACE_SYSTEM brcmsmac | ||
19 | |||
20 | #if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ) | 17 | #if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ) |
21 | 18 | ||
22 | #define __TRACE_BRCMSMAC_H | 19 | #define __TRACE_BRCMSMAC_H |
23 | 20 | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/device.h> | ||
24 | #include <linux/tracepoint.h> | 23 | #include <linux/tracepoint.h> |
25 | #include "mac80211_if.h" | 24 | #include "mac80211_if.h" |
26 | 25 | ||
27 | #ifndef CONFIG_BRCMDBG | 26 | #ifndef CONFIG_BRCM_TRACING |
28 | #undef TRACE_EVENT | 27 | #undef TRACE_EVENT |
29 | #define TRACE_EVENT(name, proto, ...) \ | 28 | #define TRACE_EVENT(name, proto, ...) \ |
30 | static inline void trace_ ## name(proto) {} | 29 | static inline void trace_ ## name(proto) {} |
30 | #undef DECLARE_EVENT_CLASS | ||
31 | #define DECLARE_EVENT_CLASS(...) | ||
32 | #undef DEFINE_EVENT | ||
33 | #define DEFINE_EVENT(evt_class, name, proto, ...) \ | ||
34 | static inline void trace_ ## name(proto) {} | ||
31 | #endif | 35 | #endif |
32 | 36 | ||
37 | #undef TRACE_SYSTEM | ||
38 | #define TRACE_SYSTEM brcmsmac | ||
39 | |||
33 | /* | 40 | /* |
34 | * We define a tracepoint, its arguments, its printk format and its | 41 | * We define a tracepoint, its arguments, its printk format and its |
35 | * 'fast binary record' layout. | 42 | * 'fast binary record' layout. |
@@ -78,9 +85,165 @@ TRACE_EVENT(brcms_dpc, | |||
78 | ) | 85 | ) |
79 | ); | 86 | ); |
80 | 87 | ||
88 | TRACE_EVENT(brcms_macintstatus, | ||
89 | TP_PROTO(const struct device *dev, int in_isr, u32 macintstatus, | ||
90 | u32 mask), | ||
91 | TP_ARGS(dev, in_isr, macintstatus, mask), | ||
92 | TP_STRUCT__entry( | ||
93 | __string(dev, dev_name(dev)) | ||
94 | __field(int, in_isr) | ||
95 | __field(u32, macintstatus) | ||
96 | __field(u32, mask) | ||
97 | ), | ||
98 | TP_fast_assign( | ||
99 | __assign_str(dev, dev_name(dev)); | ||
100 | __entry->in_isr = in_isr; | ||
101 | __entry->macintstatus = macintstatus; | ||
102 | __entry->mask = mask; | ||
103 | ), | ||
104 | TP_printk("[%s] in_isr=%d macintstatus=%#x mask=%#x", __get_str(dev), | ||
105 | __entry->in_isr, __entry->macintstatus, __entry->mask) | ||
106 | ); | ||
107 | |||
108 | #undef TRACE_SYSTEM | ||
109 | #define TRACE_SYSTEM brcmsmac_tx | ||
110 | |||
111 | TRACE_EVENT(brcms_txdesc, | ||
112 | TP_PROTO(const struct device *dev, | ||
113 | void *txh, size_t txh_len), | ||
114 | TP_ARGS(dev, txh, txh_len), | ||
115 | TP_STRUCT__entry( | ||
116 | __string(dev, dev_name(dev)) | ||
117 | __dynamic_array(u8, txh, txh_len) | ||
118 | ), | ||
119 | TP_fast_assign( | ||
120 | __assign_str(dev, dev_name(dev)); | ||
121 | memcpy(__get_dynamic_array(txh), txh, txh_len); | ||
122 | ), | ||
123 | TP_printk("[%s] txdesc", __get_str(dev)) | ||
124 | ); | ||
125 | |||
126 | TRACE_EVENT(brcms_txstatus, | ||
127 | TP_PROTO(const struct device *dev, u16 framelen, u16 frameid, | ||
128 | u16 status, u16 lasttxtime, u16 sequence, u16 phyerr, | ||
129 | u16 ackphyrxsh), | ||
130 | TP_ARGS(dev, framelen, frameid, status, lasttxtime, sequence, phyerr, | ||
131 | ackphyrxsh), | ||
132 | TP_STRUCT__entry( | ||
133 | __string(dev, dev_name(dev)) | ||
134 | __field(u16, framelen) | ||
135 | __field(u16, frameid) | ||
136 | __field(u16, status) | ||
137 | __field(u16, lasttxtime) | ||
138 | __field(u16, sequence) | ||
139 | __field(u16, phyerr) | ||
140 | __field(u16, ackphyrxsh) | ||
141 | ), | ||
142 | TP_fast_assign( | ||
143 | __assign_str(dev, dev_name(dev)); | ||
144 | __entry->framelen = framelen; | ||
145 | __entry->frameid = frameid; | ||
146 | __entry->status = status; | ||
147 | __entry->lasttxtime = lasttxtime; | ||
148 | __entry->sequence = sequence; | ||
149 | __entry->phyerr = phyerr; | ||
150 | __entry->ackphyrxsh = ackphyrxsh; | ||
151 | ), | ||
152 | TP_printk("[%s] FrameId %#04x TxStatus %#04x LastTxTime %#04x " | ||
153 | "Seq %#04x PHYTxStatus %#04x RxAck %#04x", | ||
154 | __get_str(dev), __entry->frameid, __entry->status, | ||
155 | __entry->lasttxtime, __entry->sequence, __entry->phyerr, | ||
156 | __entry->ackphyrxsh) | ||
157 | ); | ||
158 | |||
159 | TRACE_EVENT(brcms_ampdu_session, | ||
160 | TP_PROTO(const struct device *dev, unsigned max_ampdu_len, | ||
161 | u16 max_ampdu_frames, u16 ampdu_len, u16 ampdu_frames, | ||
162 | u16 dma_len), | ||
163 | TP_ARGS(dev, max_ampdu_len, max_ampdu_frames, ampdu_len, ampdu_frames, | ||
164 | dma_len), | ||
165 | TP_STRUCT__entry( | ||
166 | __string(dev, dev_name(dev)) | ||
167 | __field(unsigned, max_ampdu_len) | ||
168 | __field(u16, max_ampdu_frames) | ||
169 | __field(u16, ampdu_len) | ||
170 | __field(u16, ampdu_frames) | ||
171 | __field(u16, dma_len) | ||
172 | ), | ||
173 | TP_fast_assign( | ||
174 | __assign_str(dev, dev_name(dev)); | ||
175 | __entry->max_ampdu_len = max_ampdu_len; | ||
176 | __entry->max_ampdu_frames = max_ampdu_frames; | ||
177 | __entry->ampdu_len = ampdu_len; | ||
178 | __entry->ampdu_frames = ampdu_frames; | ||
179 | __entry->dma_len = dma_len; | ||
180 | ), | ||
181 | TP_printk("[%s] ampdu session max_len=%u max_frames=%u len=%u frames=%u dma_len=%u", | ||
182 | __get_str(dev), __entry->max_ampdu_len, | ||
183 | __entry->max_ampdu_frames, __entry->ampdu_len, | ||
184 | __entry->ampdu_frames, __entry->dma_len) | ||
185 | ); | ||
186 | |||
187 | #undef TRACE_SYSTEM | ||
188 | #define TRACE_SYSTEM brcmsmac_msg | ||
189 | |||
190 | #define MAX_MSG_LEN 100 | ||
191 | |||
192 | DECLARE_EVENT_CLASS(brcms_msg_event, | ||
193 | TP_PROTO(struct va_format *vaf), | ||
194 | TP_ARGS(vaf), | ||
195 | TP_STRUCT__entry( | ||
196 | __dynamic_array(char, msg, MAX_MSG_LEN) | ||
197 | ), | ||
198 | TP_fast_assign( | ||
199 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | ||
200 | MAX_MSG_LEN, vaf->fmt, | ||
201 | *vaf->va) >= MAX_MSG_LEN); | ||
202 | ), | ||
203 | TP_printk("%s", __get_str(msg)) | ||
204 | ); | ||
205 | |||
206 | DEFINE_EVENT(brcms_msg_event, brcms_info, | ||
207 | TP_PROTO(struct va_format *vaf), | ||
208 | TP_ARGS(vaf) | ||
209 | ); | ||
210 | |||
211 | DEFINE_EVENT(brcms_msg_event, brcms_warn, | ||
212 | TP_PROTO(struct va_format *vaf), | ||
213 | TP_ARGS(vaf) | ||
214 | ); | ||
215 | |||
216 | DEFINE_EVENT(brcms_msg_event, brcms_err, | ||
217 | TP_PROTO(struct va_format *vaf), | ||
218 | TP_ARGS(vaf) | ||
219 | ); | ||
220 | |||
221 | DEFINE_EVENT(brcms_msg_event, brcms_crit, | ||
222 | TP_PROTO(struct va_format *vaf), | ||
223 | TP_ARGS(vaf) | ||
224 | ); | ||
225 | |||
226 | TRACE_EVENT(brcms_dbg, | ||
227 | TP_PROTO(u32 level, const char *func, struct va_format *vaf), | ||
228 | TP_ARGS(level, func, vaf), | ||
229 | TP_STRUCT__entry( | ||
230 | __field(u32, level) | ||
231 | __string(func, func) | ||
232 | __dynamic_array(char, msg, MAX_MSG_LEN) | ||
233 | ), | ||
234 | TP_fast_assign( | ||
235 | __entry->level = level; | ||
236 | __assign_str(func, func); | ||
237 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | ||
238 | MAX_MSG_LEN, vaf->fmt, | ||
239 | *vaf->va) >= MAX_MSG_LEN); | ||
240 | ), | ||
241 | TP_printk("%s: %s", __get_str(func), __get_str(msg)) | ||
242 | ); | ||
243 | |||
81 | #endif /* __TRACE_BRCMSMAC_H */ | 244 | #endif /* __TRACE_BRCMSMAC_H */ |
82 | 245 | ||
83 | #ifdef CONFIG_BRCMDBG | 246 | #ifdef CONFIG_BRCM_TRACING |
84 | 247 | ||
85 | #undef TRACE_INCLUDE_PATH | 248 | #undef TRACE_INCLUDE_PATH |
86 | #define TRACE_INCLUDE_PATH . | 249 | #define TRACE_INCLUDE_PATH . |
@@ -89,4 +252,4 @@ TRACE_EVENT(brcms_dpc, | |||
89 | 252 | ||
90 | #include <trace/define_trace.h> | 253 | #include <trace/define_trace.h> |
91 | 254 | ||
92 | #endif /* CONFIG_BRCMDBG */ | 255 | #endif /* CONFIG_BRCM_TRACING */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c index 64a48f06d68b..a90b72202ec5 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "stf.h" | 26 | #include "stf.h" |
27 | #include "channel.h" | 27 | #include "channel.h" |
28 | #include "mac80211_if.h" | 28 | #include "mac80211_if.h" |
29 | #include "debug.h" | ||
29 | 30 | ||
30 | /* QDB() macro takes a dB value and converts to a quarter dB value */ | 31 | /* QDB() macro takes a dB value and converts to a quarter dB value */ |
31 | #define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR) | 32 | #define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR) |
@@ -336,8 +337,6 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) | |||
336 | const char *ccode = sprom->alpha2; | 337 | const char *ccode = sprom->alpha2; |
337 | int ccode_len = sizeof(sprom->alpha2); | 338 | int ccode_len = sizeof(sprom->alpha2); |
338 | 339 | ||
339 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | ||
340 | |||
341 | wlc_cm = kzalloc(sizeof(struct brcms_cm_info), GFP_ATOMIC); | 340 | wlc_cm = kzalloc(sizeof(struct brcms_cm_info), GFP_ATOMIC); |
342 | if (wlc_cm == NULL) | 341 | if (wlc_cm == NULL) |
343 | return NULL; | 342 | return NULL; |
@@ -615,8 +614,8 @@ brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, u16 chspec) | |||
615 | 614 | ||
616 | /* check the chanspec */ | 615 | /* check the chanspec */ |
617 | if (brcms_c_chspec_malformed(chspec)) { | 616 | if (brcms_c_chspec_malformed(chspec)) { |
618 | wiphy_err(wlc->wiphy, "wl%d: malformed chanspec 0x%x\n", | 617 | brcms_err(wlc->hw->d11core, "wl%d: malformed chanspec 0x%x\n", |
619 | wlc->pub->unit, chspec); | 618 | wlc->pub->unit, chspec); |
620 | return false; | 619 | return false; |
621 | } | 620 | } |
622 | 621 | ||
@@ -738,7 +737,8 @@ static int brcms_reg_notifier(struct wiphy *wiphy, | |||
738 | mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); | 737 | mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); |
739 | } else { | 738 | } else { |
740 | mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); | 739 | mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); |
741 | wiphy_err(wlc->wiphy, "wl%d: %s: no valid channel for \"%s\"\n", | 740 | brcms_err(wlc->hw->d11core, |
741 | "wl%d: %s: no valid channel for \"%s\"\n", | ||
742 | wlc->pub->unit, __func__, request->alpha2); | 742 | wlc->pub->unit, __func__, request->alpha2); |
743 | } | 743 | } |
744 | 744 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.c b/drivers/net/wireless/brcm80211/brcmsmac/debug.c new file mode 100644 index 000000000000..6ba4136c7cf6 --- /dev/null +++ b/drivers/net/wireless/brcm80211/brcmsmac/debug.c | |||
@@ -0,0 +1,44 @@ | |||
1 | #include <linux/net.h> | ||
2 | #include "types.h" | ||
3 | #include "debug.h" | ||
4 | #include "brcms_trace_events.h" | ||
5 | |||
6 | #define __brcms_fn(fn) \ | ||
7 | void __brcms_ ##fn(struct device *dev, const char *fmt, ...) \ | ||
8 | { \ | ||
9 | struct va_format vaf = { \ | ||
10 | .fmt = fmt, \ | ||
11 | }; \ | ||
12 | va_list args; \ | ||
13 | \ | ||
14 | va_start(args, fmt); \ | ||
15 | vaf.va = &args; \ | ||
16 | dev_ ##fn(dev, "%pV", &vaf); \ | ||
17 | trace_brcms_ ##fn(&vaf); \ | ||
18 | va_end(args); \ | ||
19 | } | ||
20 | |||
21 | __brcms_fn(info) | ||
22 | __brcms_fn(warn) | ||
23 | __brcms_fn(err) | ||
24 | __brcms_fn(crit) | ||
25 | |||
26 | #if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING) | ||
27 | void __brcms_dbg(struct device *dev, u32 level, const char *func, | ||
28 | const char *fmt, ...) | ||
29 | { | ||
30 | struct va_format vaf = { | ||
31 | .fmt = fmt, | ||
32 | }; | ||
33 | va_list args; | ||
34 | |||
35 | va_start(args, fmt); | ||
36 | vaf.va = &args; | ||
37 | #ifdef CONFIG_BRCMDBG | ||
38 | if ((brcm_msg_level & level) && net_ratelimit()) | ||
39 | dev_err(dev, "%s %pV", func, &vaf); | ||
40 | #endif | ||
41 | trace_brcms_dbg(level, func, &vaf); | ||
42 | va_end(args); | ||
43 | } | ||
44 | #endif | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.h b/drivers/net/wireless/brcm80211/brcmsmac/debug.h new file mode 100644 index 000000000000..f77066bda9d2 --- /dev/null +++ b/drivers/net/wireless/brcm80211/brcmsmac/debug.h | |||
@@ -0,0 +1,52 @@ | |||
1 | #ifndef _BRCMS_DEBUG_H_ | ||
2 | #define _BRCMS_DEBUG_H_ | ||
3 | |||
4 | #include <linux/device.h> | ||
5 | #include <linux/bcma/bcma.h> | ||
6 | #include <net/cfg80211.h> | ||
7 | #include <net/mac80211.h> | ||
8 | #include "main.h" | ||
9 | #include "mac80211_if.h" | ||
10 | |||
11 | __printf(2, 3) | ||
12 | void __brcms_info(struct device *dev, const char *fmt, ...); | ||
13 | __printf(2, 3) | ||
14 | void __brcms_warn(struct device *dev, const char *fmt, ...); | ||
15 | __printf(2, 3) | ||
16 | void __brcms_err(struct device *dev, const char *fmt, ...); | ||
17 | __printf(2, 3) | ||
18 | void __brcms_crit(struct device *dev, const char *fmt, ...); | ||
19 | |||
20 | #if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING) | ||
21 | __printf(4, 5) | ||
22 | void __brcms_dbg(struct device *dev, u32 level, const char *func, | ||
23 | const char *fmt, ...); | ||
24 | #else | ||
25 | static inline __printf(4, 5) | ||
26 | void __brcms_dbg(struct device *dev, u32 level, const char *func, | ||
27 | const char *fmt, ...) | ||
28 | { | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | /* | ||
33 | * Debug macros cannot be used when wlc is uninitialized. Generally | ||
34 | * this means any code that could run before brcms_c_attach() has | ||
35 | * returned successfully probably shouldn't use the following macros. | ||
36 | */ | ||
37 | |||
38 | #define brcms_dbg(core, l, f, a...) __brcms_dbg(&(core)->dev, l, __func__, f, ##a) | ||
39 | #define brcms_info(core, f, a...) __brcms_info(&(core)->dev, f, ##a) | ||
40 | #define brcms_warn(core, f, a...) __brcms_warn(&(core)->dev, f, ##a) | ||
41 | #define brcms_err(core, f, a...) __brcms_err(&(core)->dev, f, ##a) | ||
42 | #define brcms_crit(core, f, a...) __brcms_crit(&(core)->dev, f, ##a) | ||
43 | |||
44 | #define brcms_dbg_info(core, f, a...) brcms_dbg(core, BRCM_DL_INFO, f, ##a) | ||
45 | #define brcms_dbg_mac80211(core, f, a...) brcms_dbg(core, BRCM_DL_MAC80211, f, ##a) | ||
46 | #define brcms_dbg_rx(core, f, a...) brcms_dbg(core, BRCM_DL_RX, f, ##a) | ||
47 | #define brcms_dbg_tx(core, f, a...) brcms_dbg(core, BRCM_DL_TX, f, ##a) | ||
48 | #define brcms_dbg_int(core, f, a...) brcms_dbg(core, BRCM_DL_INT, f, ##a) | ||
49 | #define brcms_dbg_dma(core, f, a...) brcms_dbg(core, BRCM_DL_DMA, f, ##a) | ||
50 | #define brcms_dbg_ht(core, f, a...) brcms_dbg(core, BRCM_DL_HT, f, ##a) | ||
51 | |||
52 | #endif /* _BRCMS_DEBUG_H_ */ | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c index 5e53305bd9a9..511e45775c33 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c | |||
@@ -14,17 +14,22 @@ | |||
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
18 | |||
19 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
20 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
21 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <net/cfg80211.h> | ||
21 | #include <net/mac80211.h> | ||
22 | 22 | ||
23 | #include <brcmu_utils.h> | 23 | #include <brcmu_utils.h> |
24 | #include <aiutils.h> | 24 | #include <aiutils.h> |
25 | #include "types.h" | 25 | #include "types.h" |
26 | #include "main.h" | ||
26 | #include "dma.h" | 27 | #include "dma.h" |
27 | #include "soc.h" | 28 | #include "soc.h" |
29 | #include "scb.h" | ||
30 | #include "ampdu.h" | ||
31 | #include "debug.h" | ||
32 | #include "brcms_trace_events.h" | ||
28 | 33 | ||
29 | /* | 34 | /* |
30 | * dma register field offset calculation | 35 | * dma register field offset calculation |
@@ -176,28 +181,6 @@ | |||
176 | 181 | ||
177 | #define BCMEXTRAHDROOM 172 | 182 | #define BCMEXTRAHDROOM 172 |
178 | 183 | ||
179 | /* debug/trace */ | ||
180 | #ifdef DEBUG | ||
181 | #define DMA_ERROR(fmt, ...) \ | ||
182 | do { \ | ||
183 | if (*di->msg_level & 1) \ | ||
184 | pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ | ||
185 | } while (0) | ||
186 | #define DMA_TRACE(fmt, ...) \ | ||
187 | do { \ | ||
188 | if (*di->msg_level & 2) \ | ||
189 | pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ | ||
190 | } while (0) | ||
191 | #else | ||
192 | #define DMA_ERROR(fmt, ...) \ | ||
193 | no_printk(fmt, ##__VA_ARGS__) | ||
194 | #define DMA_TRACE(fmt, ...) \ | ||
195 | no_printk(fmt, ##__VA_ARGS__) | ||
196 | #endif /* DEBUG */ | ||
197 | |||
198 | #define DMA_NONE(fmt, ...) \ | ||
199 | no_printk(fmt, ##__VA_ARGS__) | ||
200 | |||
201 | #define MAXNAMEL 8 /* 8 char names */ | 184 | #define MAXNAMEL 8 /* 8 char names */ |
202 | 185 | ||
203 | /* macros to convert between byte offsets and indexes */ | 186 | /* macros to convert between byte offsets and indexes */ |
@@ -224,12 +207,14 @@ struct dma64desc { | |||
224 | /* dma engine software state */ | 207 | /* dma engine software state */ |
225 | struct dma_info { | 208 | struct dma_info { |
226 | struct dma_pub dma; /* exported structure */ | 209 | struct dma_pub dma; /* exported structure */ |
227 | uint *msg_level; /* message level pointer */ | ||
228 | char name[MAXNAMEL]; /* callers name for diag msgs */ | 210 | char name[MAXNAMEL]; /* callers name for diag msgs */ |
229 | 211 | ||
230 | struct bcma_device *core; | 212 | struct bcma_device *core; |
231 | struct device *dmadev; | 213 | struct device *dmadev; |
232 | 214 | ||
215 | /* session information for AMPDU */ | ||
216 | struct brcms_ampdu_session ampdu_session; | ||
217 | |||
233 | bool dma64; /* this dma engine is operating in 64-bit mode */ | 218 | bool dma64; /* this dma engine is operating in 64-bit mode */ |
234 | bool addrext; /* this dma engine supports DmaExtendedAddrChanges */ | 219 | bool addrext; /* this dma engine supports DmaExtendedAddrChanges */ |
235 | 220 | ||
@@ -298,12 +283,6 @@ struct dma_info { | |||
298 | bool aligndesc_4k; | 283 | bool aligndesc_4k; |
299 | }; | 284 | }; |
300 | 285 | ||
301 | /* | ||
302 | * default dma message level (if input msg_level | ||
303 | * pointer is null in dma_attach()) | ||
304 | */ | ||
305 | static uint dma_msg_level; | ||
306 | |||
307 | /* Check for odd number of 1's */ | 286 | /* Check for odd number of 1's */ |
308 | static u32 parity32(__le32 data) | 287 | static u32 parity32(__le32 data) |
309 | { | 288 | { |
@@ -353,7 +332,7 @@ static uint prevtxd(struct dma_info *di, uint i) | |||
353 | 332 | ||
354 | static uint nextrxd(struct dma_info *di, uint i) | 333 | static uint nextrxd(struct dma_info *di, uint i) |
355 | { | 334 | { |
356 | return txd(di, i + 1); | 335 | return rxd(di, i + 1); |
357 | } | 336 | } |
358 | 337 | ||
359 | static uint ntxdactive(struct dma_info *di, uint h, uint t) | 338 | static uint ntxdactive(struct dma_info *di, uint h, uint t) |
@@ -371,7 +350,7 @@ static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags) | |||
371 | uint dmactrlflags; | 350 | uint dmactrlflags; |
372 | 351 | ||
373 | if (di == NULL) { | 352 | if (di == NULL) { |
374 | DMA_ERROR("NULL dma handle\n"); | 353 | brcms_dbg_dma(di->core, "NULL dma handle\n"); |
375 | return 0; | 354 | return 0; |
376 | } | 355 | } |
377 | 356 | ||
@@ -423,13 +402,15 @@ static bool _dma_isaddrext(struct dma_info *di) | |||
423 | /* not all tx or rx channel are available */ | 402 | /* not all tx or rx channel are available */ |
424 | if (di->d64txregbase != 0) { | 403 | if (di->d64txregbase != 0) { |
425 | if (!_dma64_addrext(di, DMA64TXREGOFFS(di, control))) | 404 | if (!_dma64_addrext(di, DMA64TXREGOFFS(di, control))) |
426 | DMA_ERROR("%s: DMA64 tx doesn't have AE set\n", | 405 | brcms_dbg_dma(di->core, |
427 | di->name); | 406 | "%s: DMA64 tx doesn't have AE set\n", |
407 | di->name); | ||
428 | return true; | 408 | return true; |
429 | } else if (di->d64rxregbase != 0) { | 409 | } else if (di->d64rxregbase != 0) { |
430 | if (!_dma64_addrext(di, DMA64RXREGOFFS(di, control))) | 410 | if (!_dma64_addrext(di, DMA64RXREGOFFS(di, control))) |
431 | DMA_ERROR("%s: DMA64 rx doesn't have AE set\n", | 411 | brcms_dbg_dma(di->core, |
432 | di->name); | 412 | "%s: DMA64 rx doesn't have AE set\n", |
413 | di->name); | ||
433 | return true; | 414 | return true; |
434 | } | 415 | } |
435 | 416 | ||
@@ -530,8 +511,9 @@ static bool dma64_alloc(struct dma_info *di, uint direction) | |||
530 | va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, | 511 | va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, |
531 | &alloced, &di->txdpaorig); | 512 | &alloced, &di->txdpaorig); |
532 | if (va == NULL) { | 513 | if (va == NULL) { |
533 | DMA_ERROR("%s: DMA_ALLOC_CONSISTENT(ntxd) failed\n", | 514 | brcms_dbg_dma(di->core, |
534 | di->name); | 515 | "%s: DMA_ALLOC_CONSISTENT(ntxd) failed\n", |
516 | di->name); | ||
535 | return false; | 517 | return false; |
536 | } | 518 | } |
537 | align = (1 << align_bits); | 519 | align = (1 << align_bits); |
@@ -544,8 +526,9 @@ static bool dma64_alloc(struct dma_info *di, uint direction) | |||
544 | va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, | 526 | va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, |
545 | &alloced, &di->rxdpaorig); | 527 | &alloced, &di->rxdpaorig); |
546 | if (va == NULL) { | 528 | if (va == NULL) { |
547 | DMA_ERROR("%s: DMA_ALLOC_CONSISTENT(nrxd) failed\n", | 529 | brcms_dbg_dma(di->core, |
548 | di->name); | 530 | "%s: DMA_ALLOC_CONSISTENT(nrxd) failed\n", |
531 | di->name); | ||
549 | return false; | 532 | return false; |
550 | } | 533 | } |
551 | align = (1 << align_bits); | 534 | align = (1 << align_bits); |
@@ -564,12 +547,13 @@ static bool _dma_alloc(struct dma_info *di, uint direction) | |||
564 | return dma64_alloc(di, direction); | 547 | return dma64_alloc(di, direction); |
565 | } | 548 | } |
566 | 549 | ||
567 | struct dma_pub *dma_attach(char *name, struct si_pub *sih, | 550 | struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc, |
568 | struct bcma_device *core, | ||
569 | uint txregbase, uint rxregbase, uint ntxd, uint nrxd, | 551 | uint txregbase, uint rxregbase, uint ntxd, uint nrxd, |
570 | uint rxbufsize, int rxextheadroom, | 552 | uint rxbufsize, int rxextheadroom, |
571 | uint nrxpost, uint rxoffset, uint *msg_level) | 553 | uint nrxpost, uint rxoffset) |
572 | { | 554 | { |
555 | struct si_pub *sih = wlc->hw->sih; | ||
556 | struct bcma_device *core = wlc->hw->d11core; | ||
573 | struct dma_info *di; | 557 | struct dma_info *di; |
574 | u8 rev = core->id.rev; | 558 | u8 rev = core->id.rev; |
575 | uint size; | 559 | uint size; |
@@ -580,9 +564,6 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih, | |||
580 | if (di == NULL) | 564 | if (di == NULL) |
581 | return NULL; | 565 | return NULL; |
582 | 566 | ||
583 | di->msg_level = msg_level ? msg_level : &dma_msg_level; | ||
584 | |||
585 | |||
586 | di->dma64 = | 567 | di->dma64 = |
587 | ((bcma_aread32(core, BCMA_IOST) & SISF_DMA64) == SISF_DMA64); | 568 | ((bcma_aread32(core, BCMA_IOST) & SISF_DMA64) == SISF_DMA64); |
588 | 569 | ||
@@ -598,11 +579,11 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih, | |||
598 | */ | 579 | */ |
599 | _dma_ctrlflags(di, DMA_CTRL_ROC | DMA_CTRL_PEN, 0); | 580 | _dma_ctrlflags(di, DMA_CTRL_ROC | DMA_CTRL_PEN, 0); |
600 | 581 | ||
601 | DMA_TRACE("%s: %s flags 0x%x ntxd %d nrxd %d " | 582 | brcms_dbg_dma(di->core, "%s: %s flags 0x%x ntxd %d nrxd %d " |
602 | "rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d " | 583 | "rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d " |
603 | "txregbase %u rxregbase %u\n", name, "DMA64", | 584 | "txregbase %u rxregbase %u\n", name, "DMA64", |
604 | di->dma.dmactrlflags, ntxd, nrxd, rxbufsize, | 585 | di->dma.dmactrlflags, ntxd, nrxd, rxbufsize, |
605 | rxextheadroom, nrxpost, rxoffset, txregbase, rxregbase); | 586 | rxextheadroom, nrxpost, rxoffset, txregbase, rxregbase); |
606 | 587 | ||
607 | /* make a private copy of our callers name */ | 588 | /* make a private copy of our callers name */ |
608 | strncpy(di->name, name, MAXNAMEL); | 589 | strncpy(di->name, name, MAXNAMEL); |
@@ -664,8 +645,8 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih, | |||
664 | di->dmadesc_align = 4; /* 16 byte alignment */ | 645 | di->dmadesc_align = 4; /* 16 byte alignment */ |
665 | } | 646 | } |
666 | 647 | ||
667 | DMA_NONE("DMA descriptor align_needed %d, align %d\n", | 648 | brcms_dbg_dma(di->core, "DMA descriptor align_needed %d, align %d\n", |
668 | di->aligndesc_4k, di->dmadesc_align); | 649 | di->aligndesc_4k, di->dmadesc_align); |
669 | 650 | ||
670 | /* allocate tx packet pointer vector */ | 651 | /* allocate tx packet pointer vector */ |
671 | if (ntxd) { | 652 | if (ntxd) { |
@@ -703,21 +684,27 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih, | |||
703 | 684 | ||
704 | if ((di->ddoffsetlow != 0) && !di->addrext) { | 685 | if ((di->ddoffsetlow != 0) && !di->addrext) { |
705 | if (di->txdpa > SI_PCI_DMA_SZ) { | 686 | if (di->txdpa > SI_PCI_DMA_SZ) { |
706 | DMA_ERROR("%s: txdpa 0x%x: addrext not supported\n", | 687 | brcms_dbg_dma(di->core, |
707 | di->name, (u32)di->txdpa); | 688 | "%s: txdpa 0x%x: addrext not supported\n", |
689 | di->name, (u32)di->txdpa); | ||
708 | goto fail; | 690 | goto fail; |
709 | } | 691 | } |
710 | if (di->rxdpa > SI_PCI_DMA_SZ) { | 692 | if (di->rxdpa > SI_PCI_DMA_SZ) { |
711 | DMA_ERROR("%s: rxdpa 0x%x: addrext not supported\n", | 693 | brcms_dbg_dma(di->core, |
712 | di->name, (u32)di->rxdpa); | 694 | "%s: rxdpa 0x%x: addrext not supported\n", |
695 | di->name, (u32)di->rxdpa); | ||
713 | goto fail; | 696 | goto fail; |
714 | } | 697 | } |
715 | } | 698 | } |
716 | 699 | ||
717 | DMA_TRACE("ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh 0x%x addrext %d\n", | 700 | /* Initialize AMPDU session */ |
718 | di->ddoffsetlow, di->ddoffsethigh, | 701 | brcms_c_ampdu_reset_session(&di->ampdu_session, wlc); |
719 | di->dataoffsetlow, di->dataoffsethigh, | 702 | |
720 | di->addrext); | 703 | brcms_dbg_dma(di->core, |
704 | "ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh 0x%x addrext %d\n", | ||
705 | di->ddoffsetlow, di->ddoffsethigh, | ||
706 | di->dataoffsetlow, di->dataoffsethigh, | ||
707 | di->addrext); | ||
721 | 708 | ||
722 | return (struct dma_pub *) di; | 709 | return (struct dma_pub *) di; |
723 | 710 | ||
@@ -763,7 +750,7 @@ void dma_detach(struct dma_pub *pub) | |||
763 | { | 750 | { |
764 | struct dma_info *di = (struct dma_info *)pub; | 751 | struct dma_info *di = (struct dma_info *)pub; |
765 | 752 | ||
766 | DMA_TRACE("%s:\n", di->name); | 753 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
767 | 754 | ||
768 | /* free dma descriptor rings */ | 755 | /* free dma descriptor rings */ |
769 | if (di->txd64) | 756 | if (di->txd64) |
@@ -839,7 +826,7 @@ static void _dma_rxenable(struct dma_info *di) | |||
839 | uint dmactrlflags = di->dma.dmactrlflags; | 826 | uint dmactrlflags = di->dma.dmactrlflags; |
840 | u32 control; | 827 | u32 control; |
841 | 828 | ||
842 | DMA_TRACE("%s:\n", di->name); | 829 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
843 | 830 | ||
844 | control = D64_RC_RE | (bcma_read32(di->core, | 831 | control = D64_RC_RE | (bcma_read32(di->core, |
845 | DMA64RXREGOFFS(di, control)) & | 832 | DMA64RXREGOFFS(di, control)) & |
@@ -859,7 +846,7 @@ void dma_rxinit(struct dma_pub *pub) | |||
859 | { | 846 | { |
860 | struct dma_info *di = (struct dma_info *)pub; | 847 | struct dma_info *di = (struct dma_info *)pub; |
861 | 848 | ||
862 | DMA_TRACE("%s:\n", di->name); | 849 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
863 | 850 | ||
864 | if (di->nrxd == 0) | 851 | if (di->nrxd == 0) |
865 | return; | 852 | return; |
@@ -954,7 +941,7 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list) | |||
954 | return 0; | 941 | return 0; |
955 | 942 | ||
956 | len = le16_to_cpu(*(__le16 *) (p->data)); | 943 | len = le16_to_cpu(*(__le16 *) (p->data)); |
957 | DMA_TRACE("%s: dma_rx len %d\n", di->name, len); | 944 | brcms_dbg_dma(di->core, "%s: dma_rx len %d\n", di->name, len); |
958 | dma_spin_for_len(len, p); | 945 | dma_spin_for_len(len, p); |
959 | 946 | ||
960 | /* set actual length */ | 947 | /* set actual length */ |
@@ -981,14 +968,15 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list) | |||
981 | DMA64RXREGOFFS(di, status0)) & | 968 | DMA64RXREGOFFS(di, status0)) & |
982 | D64_RS0_CD_MASK) - di->rcvptrbase) & | 969 | D64_RS0_CD_MASK) - di->rcvptrbase) & |
983 | D64_RS0_CD_MASK, struct dma64desc); | 970 | D64_RS0_CD_MASK, struct dma64desc); |
984 | DMA_ERROR("rxin %d rxout %d, hw_curr %d\n", | 971 | brcms_dbg_dma(di->core, |
985 | di->rxin, di->rxout, cur); | 972 | "rxin %d rxout %d, hw_curr %d\n", |
973 | di->rxin, di->rxout, cur); | ||
986 | } | 974 | } |
987 | #endif /* DEBUG */ | 975 | #endif /* DEBUG */ |
988 | 976 | ||
989 | if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) { | 977 | if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) { |
990 | DMA_ERROR("%s: bad frame length (%d)\n", | 978 | brcms_dbg_dma(di->core, "%s: bad frame length (%d)\n", |
991 | di->name, len); | 979 | di->name, len); |
992 | skb_queue_walk_safe(&dma_frames, p, next) { | 980 | skb_queue_walk_safe(&dma_frames, p, next) { |
993 | skb_unlink(p, &dma_frames); | 981 | skb_unlink(p, &dma_frames); |
994 | brcmu_pkt_buf_free_skb(p); | 982 | brcmu_pkt_buf_free_skb(p); |
@@ -1005,7 +993,7 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list) | |||
1005 | 993 | ||
1006 | static bool dma64_rxidle(struct dma_info *di) | 994 | static bool dma64_rxidle(struct dma_info *di) |
1007 | { | 995 | { |
1008 | DMA_TRACE("%s:\n", di->name); | 996 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
1009 | 997 | ||
1010 | if (di->nrxd == 0) | 998 | if (di->nrxd == 0) |
1011 | return true; | 999 | return true; |
@@ -1016,6 +1004,17 @@ static bool dma64_rxidle(struct dma_info *di) | |||
1016 | D64_RS0_CD_MASK)); | 1004 | D64_RS0_CD_MASK)); |
1017 | } | 1005 | } |
1018 | 1006 | ||
1007 | static bool dma64_txidle(struct dma_info *di) | ||
1008 | { | ||
1009 | if (di->ntxd == 0) | ||
1010 | return true; | ||
1011 | |||
1012 | return ((bcma_read32(di->core, | ||
1013 | DMA64TXREGOFFS(di, status0)) & D64_XS0_CD_MASK) == | ||
1014 | (bcma_read32(di->core, DMA64TXREGOFFS(di, ptr)) & | ||
1015 | D64_XS0_CD_MASK)); | ||
1016 | } | ||
1017 | |||
1019 | /* | 1018 | /* |
1020 | * post receive buffers | 1019 | * post receive buffers |
1021 | * return false is refill failed completely and ring is empty this will stall | 1020 | * return false is refill failed completely and ring is empty this will stall |
@@ -1047,7 +1046,7 @@ bool dma_rxfill(struct dma_pub *pub) | |||
1047 | 1046 | ||
1048 | n = di->nrxpost - nrxdactive(di, rxin, rxout); | 1047 | n = di->nrxpost - nrxdactive(di, rxin, rxout); |
1049 | 1048 | ||
1050 | DMA_TRACE("%s: post %d\n", di->name, n); | 1049 | brcms_dbg_dma(di->core, "%s: post %d\n", di->name, n); |
1051 | 1050 | ||
1052 | if (di->rxbufsize > BCMEXTRAHDROOM) | 1051 | if (di->rxbufsize > BCMEXTRAHDROOM) |
1053 | extra_offset = di->rxextrahdrroom; | 1052 | extra_offset = di->rxextrahdrroom; |
@@ -1060,9 +1059,11 @@ bool dma_rxfill(struct dma_pub *pub) | |||
1060 | p = brcmu_pkt_buf_get_skb(di->rxbufsize + extra_offset); | 1059 | p = brcmu_pkt_buf_get_skb(di->rxbufsize + extra_offset); |
1061 | 1060 | ||
1062 | if (p == NULL) { | 1061 | if (p == NULL) { |
1063 | DMA_ERROR("%s: out of rxbufs\n", di->name); | 1062 | brcms_dbg_dma(di->core, "%s: out of rxbufs\n", |
1063 | di->name); | ||
1064 | if (i == 0 && dma64_rxidle(di)) { | 1064 | if (i == 0 && dma64_rxidle(di)) { |
1065 | DMA_ERROR("%s: ring is empty !\n", di->name); | 1065 | brcms_dbg_dma(di->core, "%s: ring is empty !\n", |
1066 | di->name); | ||
1066 | ring_empty = true; | 1067 | ring_empty = true; |
1067 | } | 1068 | } |
1068 | di->dma.rxnobuf++; | 1069 | di->dma.rxnobuf++; |
@@ -1107,7 +1108,7 @@ void dma_rxreclaim(struct dma_pub *pub) | |||
1107 | struct dma_info *di = (struct dma_info *)pub; | 1108 | struct dma_info *di = (struct dma_info *)pub; |
1108 | struct sk_buff *p; | 1109 | struct sk_buff *p; |
1109 | 1110 | ||
1110 | DMA_TRACE("%s:\n", di->name); | 1111 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
1111 | 1112 | ||
1112 | while ((p = _dma_getnextrxp(di, true))) | 1113 | while ((p = _dma_getnextrxp(di, true))) |
1113 | brcmu_pkt_buf_free_skb(p); | 1114 | brcmu_pkt_buf_free_skb(p); |
@@ -1138,7 +1139,7 @@ void dma_txinit(struct dma_pub *pub) | |||
1138 | struct dma_info *di = (struct dma_info *)pub; | 1139 | struct dma_info *di = (struct dma_info *)pub; |
1139 | u32 control = D64_XC_XE; | 1140 | u32 control = D64_XC_XE; |
1140 | 1141 | ||
1141 | DMA_TRACE("%s:\n", di->name); | 1142 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
1142 | 1143 | ||
1143 | if (di->ntxd == 0) | 1144 | if (di->ntxd == 0) |
1144 | return; | 1145 | return; |
@@ -1170,7 +1171,7 @@ void dma_txsuspend(struct dma_pub *pub) | |||
1170 | { | 1171 | { |
1171 | struct dma_info *di = (struct dma_info *)pub; | 1172 | struct dma_info *di = (struct dma_info *)pub; |
1172 | 1173 | ||
1173 | DMA_TRACE("%s:\n", di->name); | 1174 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
1174 | 1175 | ||
1175 | if (di->ntxd == 0) | 1176 | if (di->ntxd == 0) |
1176 | return; | 1177 | return; |
@@ -1182,7 +1183,7 @@ void dma_txresume(struct dma_pub *pub) | |||
1182 | { | 1183 | { |
1183 | struct dma_info *di = (struct dma_info *)pub; | 1184 | struct dma_info *di = (struct dma_info *)pub; |
1184 | 1185 | ||
1185 | DMA_TRACE("%s:\n", di->name); | 1186 | brcms_dbg_dma(di->core, "%s:\n", di->name); |
1186 | 1187 | ||
1187 | if (di->ntxd == 0) | 1188 | if (di->ntxd == 0) |
1188 | return; | 1189 | return; |
@@ -1205,11 +1206,11 @@ void dma_txreclaim(struct dma_pub *pub, enum txd_range range) | |||
1205 | struct dma_info *di = (struct dma_info *)pub; | 1206 | struct dma_info *di = (struct dma_info *)pub; |
1206 | struct sk_buff *p; | 1207 | struct sk_buff *p; |
1207 | 1208 | ||
1208 | DMA_TRACE("%s: %s\n", | 1209 | brcms_dbg_dma(di->core, "%s: %s\n", |
1209 | di->name, | 1210 | di->name, |
1210 | range == DMA_RANGE_ALL ? "all" : | 1211 | range == DMA_RANGE_ALL ? "all" : |
1211 | range == DMA_RANGE_TRANSMITTED ? "transmitted" : | 1212 | range == DMA_RANGE_TRANSMITTED ? "transmitted" : |
1212 | "transferred"); | 1213 | "transferred"); |
1213 | 1214 | ||
1214 | if (di->txin == di->txout) | 1215 | if (di->txin == di->txout) |
1215 | return; | 1216 | return; |
@@ -1264,39 +1265,25 @@ bool dma_rxreset(struct dma_pub *pub) | |||
1264 | return status == D64_RS0_RS_DISABLED; | 1265 | return status == D64_RS0_RS_DISABLED; |
1265 | } | 1266 | } |
1266 | 1267 | ||
1267 | /* | 1268 | static void dma_txenq(struct dma_info *di, struct sk_buff *p) |
1268 | * !! tx entry routine | ||
1269 | * WARNING: call must check the return value for error. | ||
1270 | * the error(toss frames) could be fatal and cause many subsequent hard | ||
1271 | * to debug problems | ||
1272 | */ | ||
1273 | int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit) | ||
1274 | { | 1269 | { |
1275 | struct dma_info *di = (struct dma_info *)pub; | ||
1276 | unsigned char *data; | 1270 | unsigned char *data; |
1277 | uint len; | 1271 | uint len; |
1278 | u16 txout; | 1272 | u16 txout; |
1279 | u32 flags = 0; | 1273 | u32 flags = 0; |
1280 | dma_addr_t pa; | 1274 | dma_addr_t pa; |
1281 | 1275 | ||
1282 | DMA_TRACE("%s:\n", di->name); | ||
1283 | |||
1284 | txout = di->txout; | 1276 | txout = di->txout; |
1285 | 1277 | ||
1278 | if (WARN_ON(nexttxd(di, txout) == di->txin)) | ||
1279 | return; | ||
1280 | |||
1286 | /* | 1281 | /* |
1287 | * obtain and initialize transmit descriptor entry. | 1282 | * obtain and initialize transmit descriptor entry. |
1288 | */ | 1283 | */ |
1289 | data = p->data; | 1284 | data = p->data; |
1290 | len = p->len; | 1285 | len = p->len; |
1291 | 1286 | ||
1292 | /* no use to transmit a zero length packet */ | ||
1293 | if (len == 0) | ||
1294 | return 0; | ||
1295 | |||
1296 | /* return nonzero if out of tx descriptors */ | ||
1297 | if (nexttxd(di, txout) == di->txin) | ||
1298 | goto outoftxd; | ||
1299 | |||
1300 | /* get physical address of buffer start */ | 1287 | /* get physical address of buffer start */ |
1301 | pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE); | 1288 | pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE); |
1302 | 1289 | ||
@@ -1318,23 +1305,147 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit) | |||
1318 | 1305 | ||
1319 | /* bump the tx descriptor index */ | 1306 | /* bump the tx descriptor index */ |
1320 | di->txout = txout; | 1307 | di->txout = txout; |
1308 | } | ||
1321 | 1309 | ||
1322 | /* kick the chip */ | 1310 | static void ampdu_finalize(struct dma_info *di) |
1323 | if (commit) | 1311 | { |
1324 | bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), | 1312 | struct brcms_ampdu_session *session = &di->ampdu_session; |
1325 | di->xmtptrbase + I2B(txout, struct dma64desc)); | 1313 | struct sk_buff *p; |
1314 | |||
1315 | trace_brcms_ampdu_session(&session->wlc->hw->d11core->dev, | ||
1316 | session->max_ampdu_len, | ||
1317 | session->max_ampdu_frames, | ||
1318 | session->ampdu_len, | ||
1319 | skb_queue_len(&session->skb_list), | ||
1320 | session->dma_len); | ||
1321 | |||
1322 | if (WARN_ON(skb_queue_empty(&session->skb_list))) | ||
1323 | return; | ||
1324 | |||
1325 | brcms_c_ampdu_finalize(session); | ||
1326 | |||
1327 | while (!skb_queue_empty(&session->skb_list)) { | ||
1328 | p = skb_dequeue(&session->skb_list); | ||
1329 | dma_txenq(di, p); | ||
1330 | } | ||
1331 | |||
1332 | bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), | ||
1333 | di->xmtptrbase + I2B(di->txout, struct dma64desc)); | ||
1334 | brcms_c_ampdu_reset_session(session, session->wlc); | ||
1335 | } | ||
1336 | |||
1337 | static void prep_ampdu_frame(struct dma_info *di, struct sk_buff *p) | ||
1338 | { | ||
1339 | struct brcms_ampdu_session *session = &di->ampdu_session; | ||
1340 | int ret; | ||
1341 | |||
1342 | ret = brcms_c_ampdu_add_frame(session, p); | ||
1343 | if (ret == -ENOSPC) { | ||
1344 | /* | ||
1345 | * AMPDU cannot accomodate this frame. Close out the in- | ||
1346 | * progress AMPDU session and start a new one. | ||
1347 | */ | ||
1348 | ampdu_finalize(di); | ||
1349 | ret = brcms_c_ampdu_add_frame(session, p); | ||
1350 | } | ||
1351 | |||
1352 | WARN_ON(ret); | ||
1353 | } | ||
1354 | |||
1355 | /* Update count of available tx descriptors based on current DMA state */ | ||
1356 | static void dma_update_txavail(struct dma_info *di) | ||
1357 | { | ||
1358 | /* | ||
1359 | * Available space is number of descriptors less the number of | ||
1360 | * active descriptors and the number of queued AMPDU frames. | ||
1361 | */ | ||
1362 | di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - | ||
1363 | skb_queue_len(&di->ampdu_session.skb_list) - 1; | ||
1364 | } | ||
1365 | |||
1366 | /* | ||
1367 | * !! tx entry routine | ||
1368 | * WARNING: call must check the return value for error. | ||
1369 | * the error(toss frames) could be fatal and cause many subsequent hard | ||
1370 | * to debug problems | ||
1371 | */ | ||
1372 | int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub, | ||
1373 | struct sk_buff *p) | ||
1374 | { | ||
1375 | struct dma_info *di = (struct dma_info *)pub; | ||
1376 | struct brcms_ampdu_session *session = &di->ampdu_session; | ||
1377 | struct ieee80211_tx_info *tx_info; | ||
1378 | bool is_ampdu; | ||
1379 | |||
1380 | /* no use to transmit a zero length packet */ | ||
1381 | if (p->len == 0) | ||
1382 | return 0; | ||
1383 | |||
1384 | /* return nonzero if out of tx descriptors */ | ||
1385 | if (di->dma.txavail == 0 || nexttxd(di, di->txout) == di->txin) | ||
1386 | goto outoftxd; | ||
1387 | |||
1388 | tx_info = IEEE80211_SKB_CB(p); | ||
1389 | is_ampdu = tx_info->flags & IEEE80211_TX_CTL_AMPDU; | ||
1390 | if (is_ampdu) | ||
1391 | prep_ampdu_frame(di, p); | ||
1392 | else | ||
1393 | dma_txenq(di, p); | ||
1326 | 1394 | ||
1327 | /* tx flow control */ | 1395 | /* tx flow control */ |
1328 | di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1; | 1396 | dma_update_txavail(di); |
1397 | |||
1398 | /* kick the chip */ | ||
1399 | if (is_ampdu) { | ||
1400 | /* | ||
1401 | * Start sending data if we've got a full AMPDU, there's | ||
1402 | * no more space in the DMA ring, or the ring isn't | ||
1403 | * currently transmitting. | ||
1404 | */ | ||
1405 | if (skb_queue_len(&session->skb_list) == session->max_ampdu_frames || | ||
1406 | di->dma.txavail == 0 || dma64_txidle(di)) | ||
1407 | ampdu_finalize(di); | ||
1408 | } else { | ||
1409 | bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), | ||
1410 | di->xmtptrbase + I2B(di->txout, struct dma64desc)); | ||
1411 | } | ||
1329 | 1412 | ||
1330 | return 0; | 1413 | return 0; |
1331 | 1414 | ||
1332 | outoftxd: | 1415 | outoftxd: |
1333 | DMA_ERROR("%s: out of txds !!!\n", di->name); | 1416 | brcms_dbg_dma(di->core, "%s: out of txds !!!\n", di->name); |
1334 | brcmu_pkt_buf_free_skb(p); | 1417 | brcmu_pkt_buf_free_skb(p); |
1335 | di->dma.txavail = 0; | 1418 | di->dma.txavail = 0; |
1336 | di->dma.txnobuf++; | 1419 | di->dma.txnobuf++; |
1337 | return -1; | 1420 | return -ENOSPC; |
1421 | } | ||
1422 | |||
1423 | void dma_txflush(struct dma_pub *pub) | ||
1424 | { | ||
1425 | struct dma_info *di = (struct dma_info *)pub; | ||
1426 | struct brcms_ampdu_session *session = &di->ampdu_session; | ||
1427 | |||
1428 | if (!skb_queue_empty(&session->skb_list)) | ||
1429 | ampdu_finalize(di); | ||
1430 | } | ||
1431 | |||
1432 | int dma_txpending(struct dma_pub *pub) | ||
1433 | { | ||
1434 | struct dma_info *di = (struct dma_info *)pub; | ||
1435 | return ntxdactive(di, di->txin, di->txout); | ||
1436 | } | ||
1437 | |||
1438 | /* | ||
1439 | * If we have an active AMPDU session and are not transmitting, | ||
1440 | * this function will force tx to start. | ||
1441 | */ | ||
1442 | void dma_kick_tx(struct dma_pub *pub) | ||
1443 | { | ||
1444 | struct dma_info *di = (struct dma_info *)pub; | ||
1445 | struct brcms_ampdu_session *session = &di->ampdu_session; | ||
1446 | |||
1447 | if (!skb_queue_empty(&session->skb_list) && dma64_txidle(di)) | ||
1448 | ampdu_finalize(di); | ||
1338 | } | 1449 | } |
1339 | 1450 | ||
1340 | /* | 1451 | /* |
@@ -1354,11 +1465,11 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) | |||
1354 | u16 active_desc; | 1465 | u16 active_desc; |
1355 | struct sk_buff *txp; | 1466 | struct sk_buff *txp; |
1356 | 1467 | ||
1357 | DMA_TRACE("%s: %s\n", | 1468 | brcms_dbg_dma(di->core, "%s: %s\n", |
1358 | di->name, | 1469 | di->name, |
1359 | range == DMA_RANGE_ALL ? "all" : | 1470 | range == DMA_RANGE_ALL ? "all" : |
1360 | range == DMA_RANGE_TRANSMITTED ? "transmitted" : | 1471 | range == DMA_RANGE_TRANSMITTED ? "transmitted" : |
1361 | "transferred"); | 1472 | "transferred"); |
1362 | 1473 | ||
1363 | if (di->ntxd == 0) | 1474 | if (di->ntxd == 0) |
1364 | return NULL; | 1475 | return NULL; |
@@ -1412,13 +1523,13 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) | |||
1412 | di->txin = i; | 1523 | di->txin = i; |
1413 | 1524 | ||
1414 | /* tx flow control */ | 1525 | /* tx flow control */ |
1415 | di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - 1; | 1526 | dma_update_txavail(di); |
1416 | 1527 | ||
1417 | return txp; | 1528 | return txp; |
1418 | 1529 | ||
1419 | bogus: | 1530 | bogus: |
1420 | DMA_NONE("bogus curr: start %d end %d txout %d\n", | 1531 | brcms_dbg_dma(di->core, "bogus curr: start %d end %d txout %d\n", |
1421 | start, end, di->txout); | 1532 | start, end, di->txout); |
1422 | return NULL; | 1533 | return NULL; |
1423 | } | 1534 | } |
1424 | 1535 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.h b/drivers/net/wireless/brcm80211/brcmsmac/dma.h index cc269ee5c499..ff5b80b09046 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.h | |||
@@ -74,12 +74,11 @@ struct dma_pub { | |||
74 | uint txnobuf; /* tx out of dma descriptors */ | 74 | uint txnobuf; /* tx out of dma descriptors */ |
75 | }; | 75 | }; |
76 | 76 | ||
77 | extern struct dma_pub *dma_attach(char *name, struct si_pub *sih, | 77 | extern struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc, |
78 | struct bcma_device *d11core, | ||
79 | uint txregbase, uint rxregbase, | 78 | uint txregbase, uint rxregbase, |
80 | uint ntxd, uint nrxd, | 79 | uint ntxd, uint nrxd, |
81 | uint rxbufsize, int rxextheadroom, | 80 | uint rxbufsize, int rxextheadroom, |
82 | uint nrxpost, uint rxoffset, uint *msg_level); | 81 | uint nrxpost, uint rxoffset); |
83 | 82 | ||
84 | void dma_rxinit(struct dma_pub *pub); | 83 | void dma_rxinit(struct dma_pub *pub); |
85 | int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list); | 84 | int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list); |
@@ -87,7 +86,11 @@ bool dma_rxfill(struct dma_pub *pub); | |||
87 | bool dma_rxreset(struct dma_pub *pub); | 86 | bool dma_rxreset(struct dma_pub *pub); |
88 | bool dma_txreset(struct dma_pub *pub); | 87 | bool dma_txreset(struct dma_pub *pub); |
89 | void dma_txinit(struct dma_pub *pub); | 88 | void dma_txinit(struct dma_pub *pub); |
90 | int dma_txfast(struct dma_pub *pub, struct sk_buff *p0, bool commit); | 89 | int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub, |
90 | struct sk_buff *p0); | ||
91 | void dma_txflush(struct dma_pub *pub); | ||
92 | int dma_txpending(struct dma_pub *pub); | ||
93 | void dma_kick_tx(struct dma_pub *pub); | ||
91 | void dma_txsuspend(struct dma_pub *pub); | 94 | void dma_txsuspend(struct dma_pub *pub); |
92 | bool dma_txsuspended(struct dma_pub *pub); | 95 | bool dma_txsuspended(struct dma_pub *pub); |
93 | void dma_txresume(struct dma_pub *pub); | 96 | void dma_txresume(struct dma_pub *pub); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index a744ea5a9559..1710ccba8bac 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "ucode_loader.h" | 33 | #include "ucode_loader.h" |
34 | #include "mac80211_if.h" | 34 | #include "mac80211_if.h" |
35 | #include "main.h" | 35 | #include "main.h" |
36 | #include "debug.h" | ||
36 | 37 | ||
37 | #define N_TX_QUEUES 4 /* #tx queues on mac80211<->driver interface */ | 38 | #define N_TX_QUEUES 4 /* #tx queues on mac80211<->driver interface */ |
38 | 39 | ||
@@ -98,10 +99,14 @@ static struct bcma_device_id brcms_coreid_table[] = { | |||
98 | }; | 99 | }; |
99 | MODULE_DEVICE_TABLE(bcma, brcms_coreid_table); | 100 | MODULE_DEVICE_TABLE(bcma, brcms_coreid_table); |
100 | 101 | ||
101 | #ifdef DEBUG | 102 | #if defined(CONFIG_BRCMDBG) |
102 | static int msglevel = 0xdeadbeef; | 103 | /* |
103 | module_param(msglevel, int, 0); | 104 | * Module parameter for setting the debug message level. Available |
104 | #endif /* DEBUG */ | 105 | * flags are specified by the BRCM_DL_* macros in |
106 | * drivers/net/wireless/brcm80211/include/defs.h. | ||
107 | */ | ||
108 | module_param_named(debug, brcm_msg_level, uint, S_IRUGO | S_IWUSR); | ||
109 | #endif | ||
105 | 110 | ||
106 | static struct ieee80211_channel brcms_2ghz_chantable[] = { | 111 | static struct ieee80211_channel brcms_2ghz_chantable[] = { |
107 | CHAN2GHZ(1, 2412, IEEE80211_CHAN_NO_HT40MINUS), | 112 | CHAN2GHZ(1, 2412, IEEE80211_CHAN_NO_HT40MINUS), |
@@ -276,7 +281,7 @@ static void brcms_ops_tx(struct ieee80211_hw *hw, | |||
276 | 281 | ||
277 | spin_lock_bh(&wl->lock); | 282 | spin_lock_bh(&wl->lock); |
278 | if (!wl->pub->up) { | 283 | if (!wl->pub->up) { |
279 | wiphy_err(wl->wiphy, "ops->tx called while down\n"); | 284 | brcms_err(wl->wlc->hw->d11core, "ops->tx called while down\n"); |
280 | kfree_skb(skb); | 285 | kfree_skb(skb); |
281 | goto done; | 286 | goto done; |
282 | } | 287 | } |
@@ -313,8 +318,8 @@ static int brcms_ops_start(struct ieee80211_hw *hw) | |||
313 | spin_unlock_bh(&wl->lock); | 318 | spin_unlock_bh(&wl->lock); |
314 | 319 | ||
315 | if (err != 0) | 320 | if (err != 0) |
316 | wiphy_err(hw->wiphy, "%s: brcms_up() returned %d\n", __func__, | 321 | brcms_err(wl->wlc->hw->d11core, "%s: brcms_up() returned %d\n", |
317 | err); | 322 | __func__, err); |
318 | return err; | 323 | return err; |
319 | } | 324 | } |
320 | 325 | ||
@@ -332,7 +337,7 @@ static void brcms_ops_stop(struct ieee80211_hw *hw) | |||
332 | status = brcms_c_chipmatch(wl->wlc->hw->d11core); | 337 | status = brcms_c_chipmatch(wl->wlc->hw->d11core); |
333 | spin_unlock_bh(&wl->lock); | 338 | spin_unlock_bh(&wl->lock); |
334 | if (!status) { | 339 | if (!status) { |
335 | wiphy_err(wl->wiphy, | 340 | brcms_err(wl->wlc->hw->d11core, |
336 | "wl: brcms_ops_stop: chipmatch failed\n"); | 341 | "wl: brcms_ops_stop: chipmatch failed\n"); |
337 | return; | 342 | return; |
338 | } | 343 | } |
@@ -350,8 +355,9 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
350 | 355 | ||
351 | /* Just STA for now */ | 356 | /* Just STA for now */ |
352 | if (vif->type != NL80211_IFTYPE_STATION) { | 357 | if (vif->type != NL80211_IFTYPE_STATION) { |
353 | wiphy_err(hw->wiphy, "%s: Attempt to add type %d, only" | 358 | brcms_err(wl->wlc->hw->d11core, |
354 | " STA for now\n", __func__, vif->type); | 359 | "%s: Attempt to add type %d, only STA for now\n", |
360 | __func__, vif->type); | ||
355 | return -EOPNOTSUPP; | 361 | return -EOPNOTSUPP; |
356 | } | 362 | } |
357 | 363 | ||
@@ -370,9 +376,9 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) | |||
370 | { | 376 | { |
371 | struct ieee80211_conf *conf = &hw->conf; | 377 | struct ieee80211_conf *conf = &hw->conf; |
372 | struct brcms_info *wl = hw->priv; | 378 | struct brcms_info *wl = hw->priv; |
379 | struct bcma_device *core = wl->wlc->hw->d11core; | ||
373 | int err = 0; | 380 | int err = 0; |
374 | int new_int; | 381 | int new_int; |
375 | struct wiphy *wiphy = hw->wiphy; | ||
376 | 382 | ||
377 | spin_lock_bh(&wl->lock); | 383 | spin_lock_bh(&wl->lock); |
378 | if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { | 384 | if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { |
@@ -380,25 +386,26 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) | |||
380 | conf->listen_interval); | 386 | conf->listen_interval); |
381 | } | 387 | } |
382 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) | 388 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) |
383 | wiphy_dbg(wiphy, "%s: change monitor mode: %s\n", | 389 | brcms_dbg_info(core, "%s: change monitor mode: %s\n", |
384 | __func__, conf->flags & IEEE80211_CONF_MONITOR ? | 390 | __func__, conf->flags & IEEE80211_CONF_MONITOR ? |
385 | "true" : "false"); | 391 | "true" : "false"); |
386 | if (changed & IEEE80211_CONF_CHANGE_PS) | 392 | if (changed & IEEE80211_CONF_CHANGE_PS) |
387 | wiphy_err(wiphy, "%s: change power-save mode: %s (implement)\n", | 393 | brcms_err(core, "%s: change power-save mode: %s (implement)\n", |
388 | __func__, conf->flags & IEEE80211_CONF_PS ? | 394 | __func__, conf->flags & IEEE80211_CONF_PS ? |
389 | "true" : "false"); | 395 | "true" : "false"); |
390 | 396 | ||
391 | if (changed & IEEE80211_CONF_CHANGE_POWER) { | 397 | if (changed & IEEE80211_CONF_CHANGE_POWER) { |
392 | err = brcms_c_set_tx_power(wl->wlc, conf->power_level); | 398 | err = brcms_c_set_tx_power(wl->wlc, conf->power_level); |
393 | if (err < 0) { | 399 | if (err < 0) { |
394 | wiphy_err(wiphy, "%s: Error setting power_level\n", | 400 | brcms_err(core, "%s: Error setting power_level\n", |
395 | __func__); | 401 | __func__); |
396 | goto config_out; | 402 | goto config_out; |
397 | } | 403 | } |
398 | new_int = brcms_c_get_tx_power(wl->wlc); | 404 | new_int = brcms_c_get_tx_power(wl->wlc); |
399 | if (new_int != conf->power_level) | 405 | if (new_int != conf->power_level) |
400 | wiphy_err(wiphy, "%s: Power level req != actual, %d %d" | 406 | brcms_err(core, |
401 | "\n", __func__, conf->power_level, | 407 | "%s: Power level req != actual, %d %d\n", |
408 | __func__, conf->power_level, | ||
402 | new_int); | 409 | new_int); |
403 | } | 410 | } |
404 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 411 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { |
@@ -425,13 +432,13 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, | |||
425 | struct ieee80211_bss_conf *info, u32 changed) | 432 | struct ieee80211_bss_conf *info, u32 changed) |
426 | { | 433 | { |
427 | struct brcms_info *wl = hw->priv; | 434 | struct brcms_info *wl = hw->priv; |
428 | struct wiphy *wiphy = hw->wiphy; | 435 | struct bcma_device *core = wl->wlc->hw->d11core; |
429 | 436 | ||
430 | if (changed & BSS_CHANGED_ASSOC) { | 437 | if (changed & BSS_CHANGED_ASSOC) { |
431 | /* association status changed (associated/disassociated) | 438 | /* association status changed (associated/disassociated) |
432 | * also implies a change in the AID. | 439 | * also implies a change in the AID. |
433 | */ | 440 | */ |
434 | wiphy_err(wiphy, "%s: %s: %sassociated\n", KBUILD_MODNAME, | 441 | brcms_err(core, "%s: %s: %sassociated\n", KBUILD_MODNAME, |
435 | __func__, info->assoc ? "" : "dis"); | 442 | __func__, info->assoc ? "" : "dis"); |
436 | spin_lock_bh(&wl->lock); | 443 | spin_lock_bh(&wl->lock); |
437 | brcms_c_associate_upd(wl->wlc, info->assoc); | 444 | brcms_c_associate_upd(wl->wlc, info->assoc); |
@@ -491,7 +498,7 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, | |||
491 | error = brcms_c_set_rateset(wl->wlc, &rs); | 498 | error = brcms_c_set_rateset(wl->wlc, &rs); |
492 | spin_unlock_bh(&wl->lock); | 499 | spin_unlock_bh(&wl->lock); |
493 | if (error) | 500 | if (error) |
494 | wiphy_err(wiphy, "changing basic rates failed: %d\n", | 501 | brcms_err(core, "changing basic rates failed: %d\n", |
495 | error); | 502 | error); |
496 | } | 503 | } |
497 | if (changed & BSS_CHANGED_BEACON_INT) { | 504 | if (changed & BSS_CHANGED_BEACON_INT) { |
@@ -508,30 +515,30 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, | |||
508 | } | 515 | } |
509 | if (changed & BSS_CHANGED_BEACON) | 516 | if (changed & BSS_CHANGED_BEACON) |
510 | /* Beacon data changed, retrieve new beacon (beaconing modes) */ | 517 | /* Beacon data changed, retrieve new beacon (beaconing modes) */ |
511 | wiphy_err(wiphy, "%s: beacon changed\n", __func__); | 518 | brcms_err(core, "%s: beacon changed\n", __func__); |
512 | 519 | ||
513 | if (changed & BSS_CHANGED_BEACON_ENABLED) { | 520 | if (changed & BSS_CHANGED_BEACON_ENABLED) { |
514 | /* Beaconing should be enabled/disabled (beaconing modes) */ | 521 | /* Beaconing should be enabled/disabled (beaconing modes) */ |
515 | wiphy_err(wiphy, "%s: Beacon enabled: %s\n", __func__, | 522 | brcms_err(core, "%s: Beacon enabled: %s\n", __func__, |
516 | info->enable_beacon ? "true" : "false"); | 523 | info->enable_beacon ? "true" : "false"); |
517 | } | 524 | } |
518 | 525 | ||
519 | if (changed & BSS_CHANGED_CQM) { | 526 | if (changed & BSS_CHANGED_CQM) { |
520 | /* Connection quality monitor config changed */ | 527 | /* Connection quality monitor config changed */ |
521 | wiphy_err(wiphy, "%s: cqm change: threshold %d, hys %d " | 528 | brcms_err(core, "%s: cqm change: threshold %d, hys %d " |
522 | " (implement)\n", __func__, info->cqm_rssi_thold, | 529 | " (implement)\n", __func__, info->cqm_rssi_thold, |
523 | info->cqm_rssi_hyst); | 530 | info->cqm_rssi_hyst); |
524 | } | 531 | } |
525 | 532 | ||
526 | if (changed & BSS_CHANGED_IBSS) { | 533 | if (changed & BSS_CHANGED_IBSS) { |
527 | /* IBSS join status changed */ | 534 | /* IBSS join status changed */ |
528 | wiphy_err(wiphy, "%s: IBSS joined: %s (implement)\n", __func__, | 535 | brcms_err(core, "%s: IBSS joined: %s (implement)\n", |
529 | info->ibss_joined ? "true" : "false"); | 536 | __func__, info->ibss_joined ? "true" : "false"); |
530 | } | 537 | } |
531 | 538 | ||
532 | if (changed & BSS_CHANGED_ARP_FILTER) { | 539 | if (changed & BSS_CHANGED_ARP_FILTER) { |
533 | /* Hardware ARP filter address list or state changed */ | 540 | /* Hardware ARP filter address list or state changed */ |
534 | wiphy_err(wiphy, "%s: arp filtering: enabled %s, count %d" | 541 | brcms_err(core, "%s: arp filtering: enabled %s, count %d" |
535 | " (implement)\n", __func__, info->arp_filter_enabled ? | 542 | " (implement)\n", __func__, info->arp_filter_enabled ? |
536 | "true" : "false", info->arp_addr_cnt); | 543 | "true" : "false", info->arp_addr_cnt); |
537 | } | 544 | } |
@@ -541,8 +548,8 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw, | |||
541 | * QoS for this association was enabled/disabled. | 548 | * QoS for this association was enabled/disabled. |
542 | * Note that it is only ever disabled for station mode. | 549 | * Note that it is only ever disabled for station mode. |
543 | */ | 550 | */ |
544 | wiphy_err(wiphy, "%s: qos enabled: %s (implement)\n", __func__, | 551 | brcms_err(core, "%s: qos enabled: %s (implement)\n", |
545 | info->qos ? "true" : "false"); | 552 | __func__, info->qos ? "true" : "false"); |
546 | } | 553 | } |
547 | return; | 554 | return; |
548 | } | 555 | } |
@@ -553,25 +560,25 @@ brcms_ops_configure_filter(struct ieee80211_hw *hw, | |||
553 | unsigned int *total_flags, u64 multicast) | 560 | unsigned int *total_flags, u64 multicast) |
554 | { | 561 | { |
555 | struct brcms_info *wl = hw->priv; | 562 | struct brcms_info *wl = hw->priv; |
556 | struct wiphy *wiphy = hw->wiphy; | 563 | struct bcma_device *core = wl->wlc->hw->d11core; |
557 | 564 | ||
558 | changed_flags &= MAC_FILTERS; | 565 | changed_flags &= MAC_FILTERS; |
559 | *total_flags &= MAC_FILTERS; | 566 | *total_flags &= MAC_FILTERS; |
560 | 567 | ||
561 | if (changed_flags & FIF_PROMISC_IN_BSS) | 568 | if (changed_flags & FIF_PROMISC_IN_BSS) |
562 | wiphy_dbg(wiphy, "FIF_PROMISC_IN_BSS\n"); | 569 | brcms_dbg_info(core, "FIF_PROMISC_IN_BSS\n"); |
563 | if (changed_flags & FIF_ALLMULTI) | 570 | if (changed_flags & FIF_ALLMULTI) |
564 | wiphy_dbg(wiphy, "FIF_ALLMULTI\n"); | 571 | brcms_dbg_info(core, "FIF_ALLMULTI\n"); |
565 | if (changed_flags & FIF_FCSFAIL) | 572 | if (changed_flags & FIF_FCSFAIL) |
566 | wiphy_dbg(wiphy, "FIF_FCSFAIL\n"); | 573 | brcms_dbg_info(core, "FIF_FCSFAIL\n"); |
567 | if (changed_flags & FIF_CONTROL) | 574 | if (changed_flags & FIF_CONTROL) |
568 | wiphy_dbg(wiphy, "FIF_CONTROL\n"); | 575 | brcms_dbg_info(core, "FIF_CONTROL\n"); |
569 | if (changed_flags & FIF_OTHER_BSS) | 576 | if (changed_flags & FIF_OTHER_BSS) |
570 | wiphy_dbg(wiphy, "FIF_OTHER_BSS\n"); | 577 | brcms_dbg_info(core, "FIF_OTHER_BSS\n"); |
571 | if (changed_flags & FIF_PSPOLL) | 578 | if (changed_flags & FIF_PSPOLL) |
572 | wiphy_dbg(wiphy, "FIF_PSPOLL\n"); | 579 | brcms_dbg_info(core, "FIF_PSPOLL\n"); |
573 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) | 580 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) |
574 | wiphy_dbg(wiphy, "FIF_BCN_PRBRESP_PROMISC\n"); | 581 | brcms_dbg_info(core, "FIF_BCN_PRBRESP_PROMISC\n"); |
575 | 582 | ||
576 | spin_lock_bh(&wl->lock); | 583 | spin_lock_bh(&wl->lock); |
577 | brcms_c_mac_promisc(wl->wlc, *total_flags); | 584 | brcms_c_mac_promisc(wl->wlc, *total_flags); |
@@ -653,8 +660,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, | |||
653 | status = brcms_c_aggregatable(wl->wlc, tid); | 660 | status = brcms_c_aggregatable(wl->wlc, tid); |
654 | spin_unlock_bh(&wl->lock); | 661 | spin_unlock_bh(&wl->lock); |
655 | if (!status) { | 662 | if (!status) { |
656 | wiphy_err(wl->wiphy, "START: tid %d is not agg\'able\n", | 663 | brcms_err(wl->wlc->hw->d11core, |
657 | tid); | 664 | "START: tid %d is not agg\'able\n", tid); |
658 | return -EINVAL; | 665 | return -EINVAL; |
659 | } | 666 | } |
660 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 667 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
@@ -681,8 +688,8 @@ brcms_ops_ampdu_action(struct ieee80211_hw *hw, | |||
681 | /* Power save wakeup */ | 688 | /* Power save wakeup */ |
682 | break; | 689 | break; |
683 | default: | 690 | default: |
684 | wiphy_err(wl->wiphy, "%s: Invalid command, ignoring\n", | 691 | brcms_err(wl->wlc->hw->d11core, |
685 | __func__); | 692 | "%s: Invalid command, ignoring\n", __func__); |
686 | } | 693 | } |
687 | 694 | ||
688 | return 0; | 695 | return 0; |
@@ -1144,14 +1151,13 @@ static int brcms_suspend(struct bcma_device *pdev) | |||
1144 | wl->pub->hw_up = false; | 1151 | wl->pub->hw_up = false; |
1145 | spin_unlock_bh(&wl->lock); | 1152 | spin_unlock_bh(&wl->lock); |
1146 | 1153 | ||
1147 | pr_debug("brcms_suspend ok\n"); | 1154 | brcms_dbg_info(wl->wlc->hw->d11core, "brcms_suspend ok\n"); |
1148 | 1155 | ||
1149 | return 0; | 1156 | return 0; |
1150 | } | 1157 | } |
1151 | 1158 | ||
1152 | static int brcms_resume(struct bcma_device *pdev) | 1159 | static int brcms_resume(struct bcma_device *pdev) |
1153 | { | 1160 | { |
1154 | pr_debug("brcms_resume ok\n"); | ||
1155 | return 0; | 1161 | return 0; |
1156 | } | 1162 | } |
1157 | 1163 | ||
@@ -1184,10 +1190,6 @@ static DECLARE_WORK(brcms_driver_work, brcms_driver_init); | |||
1184 | 1190 | ||
1185 | static int __init brcms_module_init(void) | 1191 | static int __init brcms_module_init(void) |
1186 | { | 1192 | { |
1187 | #ifdef DEBUG | ||
1188 | if (msglevel != 0xdeadbeef) | ||
1189 | brcm_msg_level = msglevel; | ||
1190 | #endif | ||
1191 | if (!schedule_work(&brcms_driver_work)) | 1193 | if (!schedule_work(&brcms_driver_work)) |
1192 | return -EBUSY; | 1194 | return -EBUSY; |
1193 | 1195 | ||
@@ -1216,7 +1218,7 @@ module_exit(brcms_module_exit); | |||
1216 | void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, | 1218 | void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, |
1217 | bool state, int prio) | 1219 | bool state, int prio) |
1218 | { | 1220 | { |
1219 | wiphy_err(wl->wiphy, "Shouldn't be here %s\n", __func__); | 1221 | brcms_err(wl->wlc->hw->d11core, "Shouldn't be here %s\n", __func__); |
1220 | } | 1222 | } |
1221 | 1223 | ||
1222 | /* | 1224 | /* |
@@ -1224,7 +1226,8 @@ void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, | |||
1224 | */ | 1226 | */ |
1225 | void brcms_init(struct brcms_info *wl) | 1227 | void brcms_init(struct brcms_info *wl) |
1226 | { | 1228 | { |
1227 | BCMMSG(wl->pub->ieee_hw->wiphy, "wl%d\n", wl->pub->unit); | 1229 | brcms_dbg_info(wl->wlc->hw->d11core, "Initializing wl%d\n", |
1230 | wl->pub->unit); | ||
1228 | brcms_reset(wl); | 1231 | brcms_reset(wl); |
1229 | brcms_c_init(wl->wlc, wl->mute_tx); | 1232 | brcms_c_init(wl->wlc, wl->mute_tx); |
1230 | } | 1233 | } |
@@ -1234,7 +1237,7 @@ void brcms_init(struct brcms_info *wl) | |||
1234 | */ | 1237 | */ |
1235 | uint brcms_reset(struct brcms_info *wl) | 1238 | uint brcms_reset(struct brcms_info *wl) |
1236 | { | 1239 | { |
1237 | BCMMSG(wl->pub->ieee_hw->wiphy, "wl%d\n", wl->pub->unit); | 1240 | brcms_dbg_info(wl->wlc->hw->d11core, "Resetting wl%d\n", wl->pub->unit); |
1238 | brcms_c_reset(wl->wlc); | 1241 | brcms_c_reset(wl->wlc); |
1239 | 1242 | ||
1240 | /* dpc will not be rescheduled */ | 1243 | /* dpc will not be rescheduled */ |
@@ -1248,7 +1251,7 @@ uint brcms_reset(struct brcms_info *wl) | |||
1248 | 1251 | ||
1249 | void brcms_fatal_error(struct brcms_info *wl) | 1252 | void brcms_fatal_error(struct brcms_info *wl) |
1250 | { | 1253 | { |
1251 | wiphy_err(wl->wlc->wiphy, "wl%d: fatal error, reinitializing\n", | 1254 | brcms_err(wl->wlc->hw->d11core, "wl%d: fatal error, reinitializing\n", |
1252 | wl->wlc->pub->unit); | 1255 | wl->wlc->pub->unit); |
1253 | brcms_reset(wl); | 1256 | brcms_reset(wl); |
1254 | ieee80211_restart_hw(wl->pub->ieee_hw); | 1257 | ieee80211_restart_hw(wl->pub->ieee_hw); |
@@ -1396,8 +1399,9 @@ void brcms_add_timer(struct brcms_timer *t, uint ms, int periodic) | |||
1396 | 1399 | ||
1397 | #ifdef DEBUG | 1400 | #ifdef DEBUG |
1398 | if (t->set) | 1401 | if (t->set) |
1399 | wiphy_err(hw->wiphy, "%s: Already set. Name: %s, per %d\n", | 1402 | brcms_dbg_info(t->wl->wlc->hw->d11core, |
1400 | __func__, t->name, periodic); | 1403 | "%s: Already set. Name: %s, per %d\n", |
1404 | __func__, t->name, periodic); | ||
1401 | #endif | 1405 | #endif |
1402 | t->ms = ms; | 1406 | t->ms = ms; |
1403 | t->periodic = (bool) periodic; | 1407 | t->periodic = (bool) periodic; |
@@ -1486,8 +1490,8 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx) | |||
1486 | } | 1490 | } |
1487 | } | 1491 | } |
1488 | } | 1492 | } |
1489 | wiphy_err(wl->wiphy, "ERROR: ucode buf tag:%d can not be found!\n", | 1493 | brcms_err(wl->wlc->hw->d11core, |
1490 | idx); | 1494 | "ERROR: ucode buf tag:%d can not be found!\n", idx); |
1491 | *pbuf = NULL; | 1495 | *pbuf = NULL; |
1492 | fail: | 1496 | fail: |
1493 | return -ENODATA; | 1497 | return -ENODATA; |
@@ -1510,7 +1514,7 @@ int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, u32 idx) | |||
1510 | pdata = wl->fw.fw_bin[i]->data + | 1514 | pdata = wl->fw.fw_bin[i]->data + |
1511 | le32_to_cpu(hdr->offset); | 1515 | le32_to_cpu(hdr->offset); |
1512 | if (le32_to_cpu(hdr->len) != 4) { | 1516 | if (le32_to_cpu(hdr->len) != 4) { |
1513 | wiphy_err(wl->wiphy, | 1517 | brcms_err(wl->wlc->hw->d11core, |
1514 | "ERROR: fw hdr len\n"); | 1518 | "ERROR: fw hdr len\n"); |
1515 | return -ENOMSG; | 1519 | return -ENOMSG; |
1516 | } | 1520 | } |
@@ -1519,7 +1523,8 @@ int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, u32 idx) | |||
1519 | } | 1523 | } |
1520 | } | 1524 | } |
1521 | } | 1525 | } |
1522 | wiphy_err(wl->wiphy, "ERROR: ucode tag:%d can not be found!\n", idx); | 1526 | brcms_err(wl->wlc->hw->d11core, |
1527 | "ERROR: ucode tag:%d can not be found!\n", idx); | ||
1523 | return -ENOMSG; | 1528 | return -ENOMSG; |
1524 | } | 1529 | } |
1525 | 1530 | ||
@@ -1560,8 +1565,8 @@ int brcms_check_firmwares(struct brcms_info *wl) | |||
1560 | sizeof(struct firmware_hdr)); | 1565 | sizeof(struct firmware_hdr)); |
1561 | rc = -EBADF; | 1566 | rc = -EBADF; |
1562 | } else if (fw->size < MIN_FW_SIZE || fw->size > MAX_FW_SIZE) { | 1567 | } else if (fw->size < MIN_FW_SIZE || fw->size > MAX_FW_SIZE) { |
1563 | wiphy_err(wl->wiphy, "%s: out of bounds fw file size " | 1568 | wiphy_err(wl->wiphy, "%s: out of bounds fw file size %zu\n", |
1564 | "%zu\n", __func__, fw->size); | 1569 | __func__, fw->size); |
1565 | rc = -EBADF; | 1570 | rc = -EBADF; |
1566 | } else { | 1571 | } else { |
1567 | /* check if ucode section overruns firmware image */ | 1572 | /* check if ucode section overruns firmware image */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 75086b37c817..2a44593f1e37 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
@@ -34,12 +34,9 @@ | |||
34 | #include "ucode_loader.h" | 34 | #include "ucode_loader.h" |
35 | #include "main.h" | 35 | #include "main.h" |
36 | #include "soc.h" | 36 | #include "soc.h" |
37 | 37 | #include "dma.h" | |
38 | /* | 38 | #include "debug.h" |
39 | * Indication for txflowcontrol that all priority bits in | 39 | #include "brcms_trace_events.h" |
40 | * TXQ_STOP_FOR_PRIOFC_MASK are to be considered. | ||
41 | */ | ||
42 | #define ALLPRIO -1 | ||
43 | 40 | ||
44 | /* watchdog timer, in unit of ms */ | 41 | /* watchdog timer, in unit of ms */ |
45 | #define TIMER_INTERVAL_WATCHDOG 1000 | 42 | #define TIMER_INTERVAL_WATCHDOG 1000 |
@@ -126,21 +123,6 @@ | |||
126 | 123 | ||
127 | #define BRCMS_TEMPSENSE_PERIOD 10 /* 10 second timeout */ | 124 | #define BRCMS_TEMPSENSE_PERIOD 10 /* 10 second timeout */ |
128 | 125 | ||
129 | /* precedences numbers for wlc queues. These are twice as may levels as | ||
130 | * 802.1D priorities. | ||
131 | * Odd numbers are used for HI priority traffic at same precedence levels | ||
132 | * These constants are used ONLY by wlc_prio2prec_map. Do not use them | ||
133 | * elsewhere. | ||
134 | */ | ||
135 | #define _BRCMS_PREC_NONE 0 /* None = - */ | ||
136 | #define _BRCMS_PREC_BK 2 /* BK - Background */ | ||
137 | #define _BRCMS_PREC_BE 4 /* BE - Best-effort */ | ||
138 | #define _BRCMS_PREC_EE 6 /* EE - Excellent-effort */ | ||
139 | #define _BRCMS_PREC_CL 8 /* CL - Controlled Load */ | ||
140 | #define _BRCMS_PREC_VI 10 /* Vi - Video */ | ||
141 | #define _BRCMS_PREC_VO 12 /* Vo - Voice */ | ||
142 | #define _BRCMS_PREC_NC 14 /* NC - Network Control */ | ||
143 | |||
144 | /* synthpu_dly times in us */ | 126 | /* synthpu_dly times in us */ |
145 | #define SYNTHPU_DLY_APHY_US 3700 | 127 | #define SYNTHPU_DLY_APHY_US 3700 |
146 | #define SYNTHPU_DLY_BPHY_US 1050 | 128 | #define SYNTHPU_DLY_BPHY_US 1050 |
@@ -237,17 +219,17 @@ | |||
237 | 219 | ||
238 | #define MAX_DMA_SEGS 4 | 220 | #define MAX_DMA_SEGS 4 |
239 | 221 | ||
240 | /* Max # of entries in Tx FIFO based on 4kb page size */ | 222 | /* # of entries in Tx FIFO */ |
241 | #define NTXD 256 | 223 | #define NTXD 64 |
242 | /* Max # of entries in Rx FIFO based on 4kb page size */ | 224 | /* Max # of entries in Rx FIFO based on 4kb page size */ |
243 | #define NRXD 256 | 225 | #define NRXD 256 |
244 | 226 | ||
227 | /* Amount of headroom to leave in Tx FIFO */ | ||
228 | #define TX_HEADROOM 4 | ||
229 | |||
245 | /* try to keep this # rbufs posted to the chip */ | 230 | /* try to keep this # rbufs posted to the chip */ |
246 | #define NRXBUFPOST 32 | 231 | #define NRXBUFPOST 32 |
247 | 232 | ||
248 | /* data msg txq hiwat mark */ | ||
249 | #define BRCMS_DATAHIWAT 50 | ||
250 | |||
251 | /* max # frames to process in brcms_c_recv() */ | 233 | /* max # frames to process in brcms_c_recv() */ |
252 | #define RXBND 8 | 234 | #define RXBND 8 |
253 | /* max # tx status to process in wlc_txstatus() */ | 235 | /* max # tx status to process in wlc_txstatus() */ |
@@ -283,24 +265,8 @@ struct edcf_acparam { | |||
283 | u16 TXOP; | 265 | u16 TXOP; |
284 | } __packed; | 266 | } __packed; |
285 | 267 | ||
286 | const u8 prio2fifo[NUMPRIO] = { | ||
287 | TX_AC_BE_FIFO, /* 0 BE AC_BE Best Effort */ | ||
288 | TX_AC_BK_FIFO, /* 1 BK AC_BK Background */ | ||
289 | TX_AC_BK_FIFO, /* 2 -- AC_BK Background */ | ||
290 | TX_AC_BE_FIFO, /* 3 EE AC_BE Best Effort */ | ||
291 | TX_AC_VI_FIFO, /* 4 CL AC_VI Video */ | ||
292 | TX_AC_VI_FIFO, /* 5 VI AC_VI Video */ | ||
293 | TX_AC_VO_FIFO, /* 6 VO AC_VO Voice */ | ||
294 | TX_AC_VO_FIFO /* 7 NC AC_VO Voice */ | ||
295 | }; | ||
296 | |||
297 | /* debug/trace */ | 268 | /* debug/trace */ |
298 | uint brcm_msg_level = | 269 | uint brcm_msg_level; |
299 | #if defined(DEBUG) | ||
300 | LOG_ERROR_VAL; | ||
301 | #else | ||
302 | 0; | ||
303 | #endif /* DEBUG */ | ||
304 | 270 | ||
305 | /* TX FIFO number to WME/802.1E Access Category */ | 271 | /* TX FIFO number to WME/802.1E Access Category */ |
306 | static const u8 wme_fifo2ac[] = { | 272 | static const u8 wme_fifo2ac[] = { |
@@ -320,18 +286,6 @@ static const u8 wme_ac2fifo[] = { | |||
320 | TX_AC_BK_FIFO | 286 | TX_AC_BK_FIFO |
321 | }; | 287 | }; |
322 | 288 | ||
323 | /* 802.1D Priority to precedence queue mapping */ | ||
324 | const u8 wlc_prio2prec_map[] = { | ||
325 | _BRCMS_PREC_BE, /* 0 BE - Best-effort */ | ||
326 | _BRCMS_PREC_BK, /* 1 BK - Background */ | ||
327 | _BRCMS_PREC_NONE, /* 2 None = - */ | ||
328 | _BRCMS_PREC_EE, /* 3 EE - Excellent-effort */ | ||
329 | _BRCMS_PREC_CL, /* 4 CL - Controlled Load */ | ||
330 | _BRCMS_PREC_VI, /* 5 Vi - Video */ | ||
331 | _BRCMS_PREC_VO, /* 6 Vo - Voice */ | ||
332 | _BRCMS_PREC_NC, /* 7 NC - Network Control */ | ||
333 | }; | ||
334 | |||
335 | static const u16 xmtfifo_sz[][NFIFO] = { | 289 | static const u16 xmtfifo_sz[][NFIFO] = { |
336 | /* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */ | 290 | /* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */ |
337 | {20, 192, 192, 21, 17, 5}, | 291 | {20, 192, 192, 21, 17, 5}, |
@@ -371,6 +325,36 @@ static const char fifo_names[6][0]; | |||
371 | static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL); | 325 | static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL); |
372 | #endif | 326 | #endif |
373 | 327 | ||
328 | /* Mapping of ieee80211 AC numbers to tx fifos */ | ||
329 | static const u8 ac_to_fifo_mapping[IEEE80211_NUM_ACS] = { | ||
330 | [IEEE80211_AC_VO] = TX_AC_VO_FIFO, | ||
331 | [IEEE80211_AC_VI] = TX_AC_VI_FIFO, | ||
332 | [IEEE80211_AC_BE] = TX_AC_BE_FIFO, | ||
333 | [IEEE80211_AC_BK] = TX_AC_BK_FIFO, | ||
334 | }; | ||
335 | |||
336 | /* Mapping of tx fifos to ieee80211 AC numbers */ | ||
337 | static const u8 fifo_to_ac_mapping[IEEE80211_NUM_ACS] = { | ||
338 | [TX_AC_BK_FIFO] = IEEE80211_AC_BK, | ||
339 | [TX_AC_BE_FIFO] = IEEE80211_AC_BE, | ||
340 | [TX_AC_VI_FIFO] = IEEE80211_AC_VI, | ||
341 | [TX_AC_VO_FIFO] = IEEE80211_AC_VO, | ||
342 | }; | ||
343 | |||
344 | static u8 brcms_ac_to_fifo(u8 ac) | ||
345 | { | ||
346 | if (ac >= ARRAY_SIZE(ac_to_fifo_mapping)) | ||
347 | return TX_AC_BE_FIFO; | ||
348 | return ac_to_fifo_mapping[ac]; | ||
349 | } | ||
350 | |||
351 | static u8 brcms_fifo_to_ac(u8 fifo) | ||
352 | { | ||
353 | if (fifo >= ARRAY_SIZE(fifo_to_ac_mapping)) | ||
354 | return IEEE80211_AC_BE; | ||
355 | return fifo_to_ac_mapping[fifo]; | ||
356 | } | ||
357 | |||
374 | /* Find basic rate for a given rate */ | 358 | /* Find basic rate for a given rate */ |
375 | static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec) | 359 | static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec) |
376 | { | 360 | { |
@@ -415,10 +399,15 @@ static bool brcms_deviceremoved(struct brcms_c_info *wlc) | |||
415 | } | 399 | } |
416 | 400 | ||
417 | /* sum the individual fifo tx pending packet counts */ | 401 | /* sum the individual fifo tx pending packet counts */ |
418 | static s16 brcms_txpktpendtot(struct brcms_c_info *wlc) | 402 | static int brcms_txpktpendtot(struct brcms_c_info *wlc) |
419 | { | 403 | { |
420 | return wlc->core->txpktpend[0] + wlc->core->txpktpend[1] + | 404 | int i; |
421 | wlc->core->txpktpend[2] + wlc->core->txpktpend[3]; | 405 | int pending = 0; |
406 | |||
407 | for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) | ||
408 | if (wlc->hw->di[i]) | ||
409 | pending += dma_txpending(wlc->hw->di[i]); | ||
410 | return pending; | ||
422 | } | 411 | } |
423 | 412 | ||
424 | static bool brcms_is_mband_unlocked(struct brcms_c_info *wlc) | 413 | static bool brcms_is_mband_unlocked(struct brcms_c_info *wlc) |
@@ -626,14 +615,11 @@ static uint brcms_c_calc_frame_time(struct brcms_c_info *wlc, u32 ratespec, | |||
626 | uint rate = rspec2rate(ratespec); | 615 | uint rate = rspec2rate(ratespec); |
627 | 616 | ||
628 | if (rate == 0) { | 617 | if (rate == 0) { |
629 | wiphy_err(wlc->wiphy, "wl%d: WAR: using rate of 1 mbps\n", | 618 | brcms_err(wlc->hw->d11core, "wl%d: WAR: using rate of 1 mbps\n", |
630 | wlc->pub->unit); | 619 | wlc->pub->unit); |
631 | rate = BRCM_RATE_1M; | 620 | rate = BRCM_RATE_1M; |
632 | } | 621 | } |
633 | 622 | ||
634 | BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d, len%d\n", | ||
635 | wlc->pub->unit, ratespec, preamble_type, mac_len); | ||
636 | |||
637 | if (is_mcs_rate(ratespec)) { | 623 | if (is_mcs_rate(ratespec)) { |
638 | uint mcs = ratespec & RSPEC_RATE_MASK; | 624 | uint mcs = ratespec & RSPEC_RATE_MASK; |
639 | int tot_streams = mcs_2_txstreams(mcs) + rspec_stc(ratespec); | 625 | int tot_streams = mcs_2_txstreams(mcs) + rspec_stc(ratespec); |
@@ -696,7 +682,7 @@ static void brcms_c_write_inits(struct brcms_hardware *wlc_hw, | |||
696 | u16 size; | 682 | u16 size; |
697 | u32 value; | 683 | u32 value; |
698 | 684 | ||
699 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 685 | brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); |
700 | 686 | ||
701 | for (i = 0; inits[i].addr != cpu_to_le16(0xffff); i++) { | 687 | for (i = 0; inits[i].addr != cpu_to_le16(0xffff); i++) { |
702 | size = le16_to_cpu(inits[i].size); | 688 | size = le16_to_cpu(inits[i].size); |
@@ -725,7 +711,6 @@ static void brcms_c_write_mhf(struct brcms_hardware *wlc_hw, u16 *mhfs) | |||
725 | 711 | ||
726 | static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw) | 712 | static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw) |
727 | { | 713 | { |
728 | struct wiphy *wiphy = wlc_hw->wlc->wiphy; | ||
729 | struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; | 714 | struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; |
730 | 715 | ||
731 | /* init microcode host flags */ | 716 | /* init microcode host flags */ |
@@ -736,8 +721,9 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw) | |||
736 | if (BRCMS_ISNPHY(wlc_hw->band)) | 721 | if (BRCMS_ISNPHY(wlc_hw->band)) |
737 | brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); | 722 | brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); |
738 | else | 723 | else |
739 | wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" | 724 | brcms_err(wlc_hw->d11core, |
740 | " %d\n", __func__, wlc_hw->unit, | 725 | "%s: wl%d: unsupported phy in corerev %d\n", |
726 | __func__, wlc_hw->unit, | ||
741 | wlc_hw->corerev); | 727 | wlc_hw->corerev); |
742 | } else { | 728 | } else { |
743 | if (D11REV_IS(wlc_hw->corerev, 24)) { | 729 | if (D11REV_IS(wlc_hw->corerev, 24)) { |
@@ -745,12 +731,14 @@ static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw) | |||
745 | brcms_c_write_inits(wlc_hw, | 731 | brcms_c_write_inits(wlc_hw, |
746 | ucode->d11lcn0bsinitvals24); | 732 | ucode->d11lcn0bsinitvals24); |
747 | else | 733 | else |
748 | wiphy_err(wiphy, "%s: wl%d: unsupported phy in" | 734 | brcms_err(wlc_hw->d11core, |
749 | " core rev %d\n", __func__, | 735 | "%s: wl%d: unsupported phy in core rev %d\n", |
750 | wlc_hw->unit, wlc_hw->corerev); | 736 | __func__, wlc_hw->unit, |
737 | wlc_hw->corerev); | ||
751 | } else { | 738 | } else { |
752 | wiphy_err(wiphy, "%s: wl%d: unsupported corerev %d\n", | 739 | brcms_err(wlc_hw->d11core, |
753 | __func__, wlc_hw->unit, wlc_hw->corerev); | 740 | "%s: wl%d: unsupported corerev %d\n", |
741 | __func__, wlc_hw->unit, wlc_hw->corerev); | ||
754 | } | 742 | } |
755 | } | 743 | } |
756 | } | 744 | } |
@@ -765,7 +753,7 @@ static void brcms_b_core_ioctl(struct brcms_hardware *wlc_hw, u32 m, u32 v) | |||
765 | 753 | ||
766 | static void brcms_b_core_phy_clk(struct brcms_hardware *wlc_hw, bool clk) | 754 | static void brcms_b_core_phy_clk(struct brcms_hardware *wlc_hw, bool clk) |
767 | { | 755 | { |
768 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d: clk %d\n", wlc_hw->unit, clk); | 756 | brcms_dbg_info(wlc_hw->d11core, "wl%d: clk %d\n", wlc_hw->unit, clk); |
769 | 757 | ||
770 | wlc_hw->phyclk = clk; | 758 | wlc_hw->phyclk = clk; |
771 | 759 | ||
@@ -790,8 +778,8 @@ static void brcms_b_core_phy_clk(struct brcms_hardware *wlc_hw, bool clk) | |||
790 | /* low-level band switch utility routine */ | 778 | /* low-level band switch utility routine */ |
791 | static void brcms_c_setxband(struct brcms_hardware *wlc_hw, uint bandunit) | 779 | static void brcms_c_setxband(struct brcms_hardware *wlc_hw, uint bandunit) |
792 | { | 780 | { |
793 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d: bandunit %d\n", wlc_hw->unit, | 781 | brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, |
794 | bandunit); | 782 | bandunit); |
795 | 783 | ||
796 | wlc_hw->band = wlc_hw->bandstate[bandunit]; | 784 | wlc_hw->band = wlc_hw->bandstate[bandunit]; |
797 | 785 | ||
@@ -819,7 +807,7 @@ static u32 brcms_c_setband_inact(struct brcms_c_info *wlc, uint bandunit) | |||
819 | u32 macintmask; | 807 | u32 macintmask; |
820 | u32 macctrl; | 808 | u32 macctrl; |
821 | 809 | ||
822 | BCMMSG(wlc->wiphy, "wl%d\n", wlc_hw->unit); | 810 | brcms_dbg_mac80211(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); |
823 | macctrl = bcma_read32(wlc_hw->d11core, | 811 | macctrl = bcma_read32(wlc_hw->d11core, |
824 | D11REGOFFS(maccontrol)); | 812 | D11REGOFFS(maccontrol)); |
825 | WARN_ON((macctrl & MCTL_EN_MAC) != 0); | 813 | WARN_ON((macctrl & MCTL_EN_MAC) != 0); |
@@ -841,9 +829,10 @@ static u32 brcms_c_setband_inact(struct brcms_c_info *wlc, uint bandunit) | |||
841 | static bool | 829 | static bool |
842 | brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | 830 | brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) |
843 | { | 831 | { |
844 | struct sk_buff *p; | 832 | struct sk_buff *p = NULL; |
845 | uint queue; | 833 | uint queue = NFIFO; |
846 | struct d11txh *txh; | 834 | struct dma_pub *dma = NULL; |
835 | struct d11txh *txh = NULL; | ||
847 | struct scb *scb = NULL; | 836 | struct scb *scb = NULL; |
848 | bool free_pdu; | 837 | bool free_pdu; |
849 | int tx_rts, tx_frame_count, tx_rts_count; | 838 | int tx_rts, tx_frame_count, tx_rts_count; |
@@ -854,6 +843,11 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
854 | struct ieee80211_tx_info *tx_info; | 843 | struct ieee80211_tx_info *tx_info; |
855 | struct ieee80211_tx_rate *txrate; | 844 | struct ieee80211_tx_rate *txrate; |
856 | int i; | 845 | int i; |
846 | bool fatal = true; | ||
847 | |||
848 | trace_brcms_txstatus(&wlc->hw->d11core->dev, txs->framelen, | ||
849 | txs->frameid, txs->status, txs->lasttxtime, | ||
850 | txs->sequence, txs->phyerr, txs->ackphyrxsh); | ||
857 | 851 | ||
858 | /* discard intermediate indications for ucode with one legitimate case: | 852 | /* discard intermediate indications for ucode with one legitimate case: |
859 | * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, | 853 | * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, |
@@ -862,34 +856,36 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
862 | */ | 856 | */ |
863 | if (!(txs->status & TX_STATUS_AMPDU) | 857 | if (!(txs->status & TX_STATUS_AMPDU) |
864 | && (txs->status & TX_STATUS_INTERMEDIATE)) { | 858 | && (txs->status & TX_STATUS_INTERMEDIATE)) { |
865 | BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n"); | 859 | brcms_dbg_tx(wlc->hw->d11core, "INTERMEDIATE but not AMPDU\n"); |
866 | return false; | 860 | fatal = false; |
861 | goto out; | ||
867 | } | 862 | } |
868 | 863 | ||
869 | queue = txs->frameid & TXFID_QUEUE_MASK; | 864 | queue = txs->frameid & TXFID_QUEUE_MASK; |
870 | if (queue >= NFIFO) { | 865 | if (queue >= NFIFO) { |
871 | p = NULL; | 866 | brcms_err(wlc->hw->d11core, "queue %u >= NFIFO\n", queue); |
872 | goto fatal; | 867 | goto out; |
873 | } | 868 | } |
874 | 869 | ||
870 | dma = wlc->hw->di[queue]; | ||
871 | |||
875 | p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); | 872 | p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); |
876 | if (p == NULL) | 873 | if (p == NULL) { |
877 | goto fatal; | 874 | brcms_err(wlc->hw->d11core, "dma_getnexttxp returned null!\n"); |
875 | goto out; | ||
876 | } | ||
878 | 877 | ||
879 | txh = (struct d11txh *) (p->data); | 878 | txh = (struct d11txh *) (p->data); |
880 | mcl = le16_to_cpu(txh->MacTxControlLow); | 879 | mcl = le16_to_cpu(txh->MacTxControlLow); |
881 | 880 | ||
882 | if (txs->phyerr) { | 881 | if (txs->phyerr) |
883 | if (brcm_msg_level & LOG_ERROR_VAL) { | 882 | brcms_err(wlc->hw->d11core, "phyerr 0x%x, rate 0x%x\n", |
884 | wiphy_err(wlc->wiphy, "phyerr 0x%x, rate 0x%x\n", | 883 | txs->phyerr, txh->MainRates); |
885 | txs->phyerr, txh->MainRates); | ||
886 | brcms_c_print_txdesc(txh); | ||
887 | } | ||
888 | brcms_c_print_txstatus(txs); | ||
889 | } | ||
890 | 884 | ||
891 | if (txs->frameid != le16_to_cpu(txh->TxFrameID)) | 885 | if (txs->frameid != le16_to_cpu(txh->TxFrameID)) { |
892 | goto fatal; | 886 | brcms_err(wlc->hw->d11core, "frameid != txh->TxFrameID\n"); |
887 | goto out; | ||
888 | } | ||
893 | tx_info = IEEE80211_SKB_CB(p); | 889 | tx_info = IEEE80211_SKB_CB(p); |
894 | h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); | 890 | h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); |
895 | 891 | ||
@@ -898,14 +894,24 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
898 | 894 | ||
899 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { | 895 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { |
900 | brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs); | 896 | brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs); |
901 | return false; | 897 | fatal = false; |
898 | goto out; | ||
902 | } | 899 | } |
903 | 900 | ||
901 | /* | ||
902 | * brcms_c_ampdu_dotxstatus() will trace tx descriptors for AMPDU | ||
903 | * frames; this traces them for the rest. | ||
904 | */ | ||
905 | trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, sizeof(*txh)); | ||
906 | |||
904 | supr_status = txs->status & TX_STATUS_SUPR_MASK; | 907 | supr_status = txs->status & TX_STATUS_SUPR_MASK; |
905 | if (supr_status == TX_STATUS_SUPR_BADCH) | 908 | if (supr_status == TX_STATUS_SUPR_BADCH) { |
906 | BCMMSG(wlc->wiphy, | 909 | unsigned xfts = le16_to_cpu(txh->XtraFrameTypes); |
907 | "%s: Pkt tx suppressed, possibly channel %d\n", | 910 | brcms_dbg_tx(wlc->hw->d11core, |
908 | __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec)); | 911 | "Pkt tx suppressed, dest chan %u, current %d\n", |
912 | (xfts >> XFTS_CHANNEL_SHIFT) & 0xff, | ||
913 | CHSPEC_CHANNEL(wlc->default_bss->chanspec)); | ||
914 | } | ||
909 | 915 | ||
910 | tx_rts = le16_to_cpu(txh->MacTxControlLow) & TXC_SENDRTS; | 916 | tx_rts = le16_to_cpu(txh->MacTxControlLow) & TXC_SENDRTS; |
911 | tx_frame_count = | 917 | tx_frame_count = |
@@ -916,7 +922,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
916 | lastframe = !ieee80211_has_morefrags(h->frame_control); | 922 | lastframe = !ieee80211_has_morefrags(h->frame_control); |
917 | 923 | ||
918 | if (!lastframe) { | 924 | if (!lastframe) { |
919 | wiphy_err(wlc->wiphy, "Not last frame!\n"); | 925 | brcms_err(wlc->hw->d11core, "Not last frame!\n"); |
920 | } else { | 926 | } else { |
921 | /* | 927 | /* |
922 | * Set information to be consumed by Minstrel ht. | 928 | * Set information to be consumed by Minstrel ht. |
@@ -982,26 +988,37 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
982 | totlen = p->len; | 988 | totlen = p->len; |
983 | free_pdu = true; | 989 | free_pdu = true; |
984 | 990 | ||
985 | brcms_c_txfifo_complete(wlc, queue, 1); | ||
986 | |||
987 | if (lastframe) { | 991 | if (lastframe) { |
988 | /* remove PLCP & Broadcom tx descriptor header */ | 992 | /* remove PLCP & Broadcom tx descriptor header */ |
989 | skb_pull(p, D11_PHY_HDR_LEN); | 993 | skb_pull(p, D11_PHY_HDR_LEN); |
990 | skb_pull(p, D11_TXH_LEN); | 994 | skb_pull(p, D11_TXH_LEN); |
991 | ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p); | 995 | ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p); |
992 | } else { | 996 | } else { |
993 | wiphy_err(wlc->wiphy, "%s: Not last frame => not calling " | 997 | brcms_err(wlc->hw->d11core, |
994 | "tx_status\n", __func__); | 998 | "%s: Not last frame => not calling tx_status\n", |
999 | __func__); | ||
995 | } | 1000 | } |
996 | 1001 | ||
997 | return false; | 1002 | fatal = false; |
998 | 1003 | ||
999 | fatal: | 1004 | out: |
1000 | if (p) | 1005 | if (fatal) { |
1001 | brcmu_pkt_buf_free_skb(p); | 1006 | if (txh) |
1007 | trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, | ||
1008 | sizeof(*txh)); | ||
1009 | if (p) | ||
1010 | brcmu_pkt_buf_free_skb(p); | ||
1011 | } | ||
1002 | 1012 | ||
1003 | return true; | 1013 | if (dma && queue < NFIFO) { |
1014 | u16 ac_queue = brcms_fifo_to_ac(queue); | ||
1015 | if (dma->txavail > TX_HEADROOM && queue < TX_BCMC_FIFO && | ||
1016 | ieee80211_queue_stopped(wlc->pub->ieee_hw, ac_queue)) | ||
1017 | ieee80211_wake_queue(wlc->pub->ieee_hw, ac_queue); | ||
1018 | dma_kick_tx(dma); | ||
1019 | } | ||
1004 | 1020 | ||
1021 | return fatal; | ||
1005 | } | 1022 | } |
1006 | 1023 | ||
1007 | /* process tx completion events in BMAC | 1024 | /* process tx completion events in BMAC |
@@ -1011,7 +1028,6 @@ static bool | |||
1011 | brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) | 1028 | brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) |
1012 | { | 1029 | { |
1013 | bool morepending = false; | 1030 | bool morepending = false; |
1014 | struct brcms_c_info *wlc = wlc_hw->wlc; | ||
1015 | struct bcma_device *core; | 1031 | struct bcma_device *core; |
1016 | struct tx_status txstatus, *txs; | 1032 | struct tx_status txstatus, *txs; |
1017 | u32 s1, s2; | 1033 | u32 s1, s2; |
@@ -1022,8 +1038,6 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) | |||
1022 | */ | 1038 | */ |
1023 | uint max_tx_num = bound ? TXSBND : -1; | 1039 | uint max_tx_num = bound ? TXSBND : -1; |
1024 | 1040 | ||
1025 | BCMMSG(wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
1026 | |||
1027 | txs = &txstatus; | 1041 | txs = &txstatus; |
1028 | core = wlc_hw->d11core; | 1042 | core = wlc_hw->d11core; |
1029 | *fatal = false; | 1043 | *fatal = false; |
@@ -1032,8 +1046,8 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) | |||
1032 | && (s1 & TXS_V)) { | 1046 | && (s1 & TXS_V)) { |
1033 | 1047 | ||
1034 | if (s1 == 0xffffffff) { | 1048 | if (s1 == 0xffffffff) { |
1035 | wiphy_err(wlc->wiphy, "wl%d: %s: dead chip\n", | 1049 | brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, |
1036 | wlc_hw->unit, __func__); | 1050 | __func__); |
1037 | return morepending; | 1051 | return morepending; |
1038 | } | 1052 | } |
1039 | s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2)); | 1053 | s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2)); |
@@ -1058,9 +1072,6 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) | |||
1058 | if (n >= max_tx_num) | 1072 | if (n >= max_tx_num) |
1059 | morepending = true; | 1073 | morepending = true; |
1060 | 1074 | ||
1061 | if (!pktq_empty(&wlc->pkt_queue->q)) | ||
1062 | brcms_c_send_q(wlc); | ||
1063 | |||
1064 | return morepending; | 1075 | return morepending; |
1065 | } | 1076 | } |
1066 | 1077 | ||
@@ -1112,7 +1123,6 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme) | |||
1112 | u16 pio_mhf2 = 0; | 1123 | u16 pio_mhf2 = 0; |
1113 | struct brcms_hardware *wlc_hw = wlc->hw; | 1124 | struct brcms_hardware *wlc_hw = wlc->hw; |
1114 | uint unit = wlc_hw->unit; | 1125 | uint unit = wlc_hw->unit; |
1115 | struct wiphy *wiphy = wlc->wiphy; | ||
1116 | 1126 | ||
1117 | /* name and offsets for dma_attach */ | 1127 | /* name and offsets for dma_attach */ |
1118 | snprintf(name, sizeof(name), "wl%d", unit); | 1128 | snprintf(name, sizeof(name), "wl%d", unit); |
@@ -1125,12 +1135,12 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme) | |||
1125 | * TX: TX_AC_BK_FIFO (TX AC Background data packets) | 1135 | * TX: TX_AC_BK_FIFO (TX AC Background data packets) |
1126 | * RX: RX_FIFO (RX data packets) | 1136 | * RX: RX_FIFO (RX data packets) |
1127 | */ | 1137 | */ |
1128 | wlc_hw->di[0] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, | 1138 | wlc_hw->di[0] = dma_attach(name, wlc, |
1129 | (wme ? dmareg(DMA_TX, 0) : 0), | 1139 | (wme ? dmareg(DMA_TX, 0) : 0), |
1130 | dmareg(DMA_RX, 0), | 1140 | dmareg(DMA_RX, 0), |
1131 | (wme ? NTXD : 0), NRXD, | 1141 | (wme ? NTXD : 0), NRXD, |
1132 | RXBUFSZ, -1, NRXBUFPOST, | 1142 | RXBUFSZ, -1, NRXBUFPOST, |
1133 | BRCMS_HWRXOFF, &brcm_msg_level); | 1143 | BRCMS_HWRXOFF); |
1134 | dma_attach_err |= (NULL == wlc_hw->di[0]); | 1144 | dma_attach_err |= (NULL == wlc_hw->di[0]); |
1135 | 1145 | ||
1136 | /* | 1146 | /* |
@@ -1139,10 +1149,9 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme) | |||
1139 | * (legacy) TX_DATA_FIFO (TX data packets) | 1149 | * (legacy) TX_DATA_FIFO (TX data packets) |
1140 | * RX: UNUSED | 1150 | * RX: UNUSED |
1141 | */ | 1151 | */ |
1142 | wlc_hw->di[1] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, | 1152 | wlc_hw->di[1] = dma_attach(name, wlc, |
1143 | dmareg(DMA_TX, 1), 0, | 1153 | dmareg(DMA_TX, 1), 0, |
1144 | NTXD, 0, 0, -1, 0, 0, | 1154 | NTXD, 0, 0, -1, 0, 0); |
1145 | &brcm_msg_level); | ||
1146 | dma_attach_err |= (NULL == wlc_hw->di[1]); | 1155 | dma_attach_err |= (NULL == wlc_hw->di[1]); |
1147 | 1156 | ||
1148 | /* | 1157 | /* |
@@ -1150,26 +1159,26 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme) | |||
1150 | * TX: TX_AC_VI_FIFO (TX AC Video data packets) | 1159 | * TX: TX_AC_VI_FIFO (TX AC Video data packets) |
1151 | * RX: UNUSED | 1160 | * RX: UNUSED |
1152 | */ | 1161 | */ |
1153 | wlc_hw->di[2] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, | 1162 | wlc_hw->di[2] = dma_attach(name, wlc, |
1154 | dmareg(DMA_TX, 2), 0, | 1163 | dmareg(DMA_TX, 2), 0, |
1155 | NTXD, 0, 0, -1, 0, 0, | 1164 | NTXD, 0, 0, -1, 0, 0); |
1156 | &brcm_msg_level); | ||
1157 | dma_attach_err |= (NULL == wlc_hw->di[2]); | 1165 | dma_attach_err |= (NULL == wlc_hw->di[2]); |
1158 | /* | 1166 | /* |
1159 | * FIFO 3 | 1167 | * FIFO 3 |
1160 | * TX: TX_AC_VO_FIFO (TX AC Voice data packets) | 1168 | * TX: TX_AC_VO_FIFO (TX AC Voice data packets) |
1161 | * (legacy) TX_CTL_FIFO (TX control & mgmt packets) | 1169 | * (legacy) TX_CTL_FIFO (TX control & mgmt packets) |
1162 | */ | 1170 | */ |
1163 | wlc_hw->di[3] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core, | 1171 | wlc_hw->di[3] = dma_attach(name, wlc, |
1164 | dmareg(DMA_TX, 3), | 1172 | dmareg(DMA_TX, 3), |
1165 | 0, NTXD, 0, 0, -1, | 1173 | 0, NTXD, 0, 0, -1, |
1166 | 0, 0, &brcm_msg_level); | 1174 | 0, 0); |
1167 | dma_attach_err |= (NULL == wlc_hw->di[3]); | 1175 | dma_attach_err |= (NULL == wlc_hw->di[3]); |
1168 | /* Cleaner to leave this as if with AP defined */ | 1176 | /* Cleaner to leave this as if with AP defined */ |
1169 | 1177 | ||
1170 | if (dma_attach_err) { | 1178 | if (dma_attach_err) { |
1171 | wiphy_err(wiphy, "wl%d: wlc_attach: dma_attach failed" | 1179 | brcms_err(wlc_hw->d11core, |
1172 | "\n", unit); | 1180 | "wl%d: wlc_attach: dma_attach failed\n", |
1181 | unit); | ||
1173 | return false; | 1182 | return false; |
1174 | } | 1183 | } |
1175 | 1184 | ||
@@ -1503,8 +1512,7 @@ brcms_b_set_addrmatch(struct brcms_hardware *wlc_hw, int match_reg_offset, | |||
1503 | u16 mac_m; | 1512 | u16 mac_m; |
1504 | u16 mac_h; | 1513 | u16 mac_h; |
1505 | 1514 | ||
1506 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d: brcms_b_set_addrmatch\n", | 1515 | brcms_dbg_rx(core, "wl%d: brcms_b_set_addrmatch\n", wlc_hw->unit); |
1507 | wlc_hw->unit); | ||
1508 | 1516 | ||
1509 | mac_l = addr[0] | (addr[1] << 8); | 1517 | mac_l = addr[0] | (addr[1] << 8); |
1510 | mac_m = addr[2] | (addr[3] << 8); | 1518 | mac_m = addr[2] | (addr[3] << 8); |
@@ -1527,7 +1535,7 @@ brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len, | |||
1527 | __le32 word_le; | 1535 | __le32 word_le; |
1528 | __be32 word_be; | 1536 | __be32 word_be; |
1529 | bool be_bit; | 1537 | bool be_bit; |
1530 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 1538 | brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); |
1531 | 1539 | ||
1532 | bcma_write32(core, D11REGOFFS(tplatewrptr), offset); | 1540 | bcma_write32(core, D11REGOFFS(tplatewrptr), offset); |
1533 | 1541 | ||
@@ -1700,8 +1708,8 @@ static void brcms_b_bsinit(struct brcms_c_info *wlc, u16 chanspec) | |||
1700 | { | 1708 | { |
1701 | struct brcms_hardware *wlc_hw = wlc->hw; | 1709 | struct brcms_hardware *wlc_hw = wlc->hw; |
1702 | 1710 | ||
1703 | BCMMSG(wlc->wiphy, "wl%d: bandunit %d\n", wlc_hw->unit, | 1711 | brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, |
1704 | wlc_hw->band->bandunit); | 1712 | wlc_hw->band->bandunit); |
1705 | 1713 | ||
1706 | brcms_c_ucode_bsinit(wlc_hw); | 1714 | brcms_c_ucode_bsinit(wlc_hw); |
1707 | 1715 | ||
@@ -1736,8 +1744,6 @@ static void brcms_b_bsinit(struct brcms_c_info *wlc, u16 chanspec) | |||
1736 | /* Perform a soft reset of the PHY PLL */ | 1744 | /* Perform a soft reset of the PHY PLL */ |
1737 | void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw) | 1745 | void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw) |
1738 | { | 1746 | { |
1739 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
1740 | |||
1741 | ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_addr), | 1747 | ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_addr), |
1742 | ~0, 0); | 1748 | ~0, 0); |
1743 | udelay(1); | 1749 | udelay(1); |
@@ -1782,7 +1788,7 @@ void brcms_b_phy_reset(struct brcms_hardware *wlc_hw) | |||
1782 | u32 phy_bw_clkbits; | 1788 | u32 phy_bw_clkbits; |
1783 | bool phy_in_reset = false; | 1789 | bool phy_in_reset = false; |
1784 | 1790 | ||
1785 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 1791 | brcms_dbg_info(wlc_hw->d11core, "wl%d: reset phy\n", wlc_hw->unit); |
1786 | 1792 | ||
1787 | if (pih == NULL) | 1793 | if (pih == NULL) |
1788 | return; | 1794 | return; |
@@ -1916,7 +1922,7 @@ static void brcms_c_get_macaddr(struct brcms_hardware *wlc_hw, u8 etheraddr[ETH_ | |||
1916 | /* power both the pll and external oscillator on/off */ | 1922 | /* power both the pll and external oscillator on/off */ |
1917 | static void brcms_b_xtal(struct brcms_hardware *wlc_hw, bool want) | 1923 | static void brcms_b_xtal(struct brcms_hardware *wlc_hw, bool want) |
1918 | { | 1924 | { |
1919 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d: want %d\n", wlc_hw->unit, want); | 1925 | brcms_dbg_info(wlc_hw->d11core, "wl%d: want %d\n", wlc_hw->unit, want); |
1920 | 1926 | ||
1921 | /* | 1927 | /* |
1922 | * dont power down if plldown is false or | 1928 | * dont power down if plldown is false or |
@@ -2005,7 +2011,7 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags) | |||
2005 | if (flags == BRCMS_USE_COREFLAGS) | 2011 | if (flags == BRCMS_USE_COREFLAGS) |
2006 | flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); | 2012 | flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); |
2007 | 2013 | ||
2008 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 2014 | brcms_dbg_info(wlc_hw->d11core, "wl%d: core reset\n", wlc_hw->unit); |
2009 | 2015 | ||
2010 | /* request FAST clock if not on */ | 2016 | /* request FAST clock if not on */ |
2011 | fastclk = wlc_hw->forcefastclk; | 2017 | fastclk = wlc_hw->forcefastclk; |
@@ -2016,13 +2022,13 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags) | |||
2016 | if (bcma_core_is_enabled(wlc_hw->d11core)) { | 2022 | if (bcma_core_is_enabled(wlc_hw->d11core)) { |
2017 | for (i = 0; i < NFIFO; i++) | 2023 | for (i = 0; i < NFIFO; i++) |
2018 | if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) | 2024 | if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) |
2019 | wiphy_err(wlc_hw->wlc->wiphy, "wl%d: %s: " | 2025 | brcms_err(wlc_hw->d11core, "wl%d: %s: " |
2020 | "dma_txreset[%d]: cannot stop dma\n", | 2026 | "dma_txreset[%d]: cannot stop dma\n", |
2021 | wlc_hw->unit, __func__, i); | 2027 | wlc_hw->unit, __func__, i); |
2022 | 2028 | ||
2023 | if ((wlc_hw->di[RX_FIFO]) | 2029 | if ((wlc_hw->di[RX_FIFO]) |
2024 | && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) | 2030 | && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) |
2025 | wiphy_err(wlc_hw->wlc->wiphy, "wl%d: %s: dma_rxreset" | 2031 | brcms_err(wlc_hw->d11core, "wl%d: %s: dma_rxreset" |
2026 | "[%d]: cannot stop dma\n", | 2032 | "[%d]: cannot stop dma\n", |
2027 | wlc_hw->unit, __func__, RX_FIFO); | 2033 | wlc_hw->unit, __func__, RX_FIFO); |
2028 | } | 2034 | } |
@@ -2235,7 +2241,7 @@ static void brcms_ucode_write(struct brcms_hardware *wlc_hw, | |||
2235 | uint i; | 2241 | uint i; |
2236 | uint count; | 2242 | uint count; |
2237 | 2243 | ||
2238 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 2244 | brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); |
2239 | 2245 | ||
2240 | count = (nbytes / sizeof(u32)); | 2246 | count = (nbytes / sizeof(u32)); |
2241 | 2247 | ||
@@ -2263,8 +2269,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw) | |||
2263 | ucode->bcm43xx_16_mimosz); | 2269 | ucode->bcm43xx_16_mimosz); |
2264 | wlc_hw->ucode_loaded = true; | 2270 | wlc_hw->ucode_loaded = true; |
2265 | } else | 2271 | } else |
2266 | wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in " | 2272 | brcms_err(wlc_hw->d11core, |
2267 | "corerev %d\n", | 2273 | "%s: wl%d: unsupported phy in corerev %d\n", |
2268 | __func__, wlc_hw->unit, wlc_hw->corerev); | 2274 | __func__, wlc_hw->unit, wlc_hw->corerev); |
2269 | } else if (D11REV_IS(wlc_hw->corerev, 24)) { | 2275 | } else if (D11REV_IS(wlc_hw->corerev, 24)) { |
2270 | if (BRCMS_ISLCNPHY(wlc_hw->band)) { | 2276 | if (BRCMS_ISLCNPHY(wlc_hw->band)) { |
@@ -2272,8 +2278,8 @@ static void brcms_ucode_download(struct brcms_hardware *wlc_hw) | |||
2272 | ucode->bcm43xx_24_lcnsz); | 2278 | ucode->bcm43xx_24_lcnsz); |
2273 | wlc_hw->ucode_loaded = true; | 2279 | wlc_hw->ucode_loaded = true; |
2274 | } else { | 2280 | } else { |
2275 | wiphy_err(wlc->wiphy, "%s: wl%d: unsupported phy in " | 2281 | brcms_err(wlc_hw->d11core, |
2276 | "corerev %d\n", | 2282 | "%s: wl%d: unsupported phy in corerev %d\n", |
2277 | __func__, wlc_hw->unit, wlc_hw->corerev); | 2283 | __func__, wlc_hw->unit, wlc_hw->corerev); |
2278 | } | 2284 | } |
2279 | } | 2285 | } |
@@ -2310,7 +2316,6 @@ static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw) | |||
2310 | uint unit; | 2316 | uint unit; |
2311 | uint intstatus, idx; | 2317 | uint intstatus, idx; |
2312 | struct bcma_device *core = wlc_hw->d11core; | 2318 | struct bcma_device *core = wlc_hw->d11core; |
2313 | struct wiphy *wiphy = wlc_hw->wlc->wiphy; | ||
2314 | 2319 | ||
2315 | unit = wlc_hw->unit; | 2320 | unit = wlc_hw->unit; |
2316 | 2321 | ||
@@ -2323,39 +2328,39 @@ static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw) | |||
2323 | if (!intstatus) | 2328 | if (!intstatus) |
2324 | continue; | 2329 | continue; |
2325 | 2330 | ||
2326 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d: intstatus%d 0x%x\n", | 2331 | brcms_dbg_int(core, "wl%d: intstatus%d 0x%x\n", |
2327 | unit, idx, intstatus); | 2332 | unit, idx, intstatus); |
2328 | 2333 | ||
2329 | if (intstatus & I_RO) { | 2334 | if (intstatus & I_RO) { |
2330 | wiphy_err(wiphy, "wl%d: fifo %d: receive fifo " | 2335 | brcms_err(core, "wl%d: fifo %d: receive fifo " |
2331 | "overflow\n", unit, idx); | 2336 | "overflow\n", unit, idx); |
2332 | fatal = true; | 2337 | fatal = true; |
2333 | } | 2338 | } |
2334 | 2339 | ||
2335 | if (intstatus & I_PC) { | 2340 | if (intstatus & I_PC) { |
2336 | wiphy_err(wiphy, "wl%d: fifo %d: descriptor error\n", | 2341 | brcms_err(core, "wl%d: fifo %d: descriptor error\n", |
2337 | unit, idx); | 2342 | unit, idx); |
2338 | fatal = true; | 2343 | fatal = true; |
2339 | } | 2344 | } |
2340 | 2345 | ||
2341 | if (intstatus & I_PD) { | 2346 | if (intstatus & I_PD) { |
2342 | wiphy_err(wiphy, "wl%d: fifo %d: data error\n", unit, | 2347 | brcms_err(core, "wl%d: fifo %d: data error\n", unit, |
2343 | idx); | 2348 | idx); |
2344 | fatal = true; | 2349 | fatal = true; |
2345 | } | 2350 | } |
2346 | 2351 | ||
2347 | if (intstatus & I_DE) { | 2352 | if (intstatus & I_DE) { |
2348 | wiphy_err(wiphy, "wl%d: fifo %d: descriptor protocol " | 2353 | brcms_err(core, "wl%d: fifo %d: descriptor protocol " |
2349 | "error\n", unit, idx); | 2354 | "error\n", unit, idx); |
2350 | fatal = true; | 2355 | fatal = true; |
2351 | } | 2356 | } |
2352 | 2357 | ||
2353 | if (intstatus & I_RU) | 2358 | if (intstatus & I_RU) |
2354 | wiphy_err(wiphy, "wl%d: fifo %d: receive descriptor " | 2359 | brcms_err(core, "wl%d: fifo %d: receive descriptor " |
2355 | "underflow\n", idx, unit); | 2360 | "underflow\n", idx, unit); |
2356 | 2361 | ||
2357 | if (intstatus & I_XU) { | 2362 | if (intstatus & I_XU) { |
2358 | wiphy_err(wiphy, "wl%d: fifo %d: transmit fifo " | 2363 | brcms_err(core, "wl%d: fifo %d: transmit fifo " |
2359 | "underflow\n", idx, unit); | 2364 | "underflow\n", idx, unit); |
2360 | fatal = true; | 2365 | fatal = true; |
2361 | } | 2366 | } |
@@ -2516,13 +2521,13 @@ static inline u32 wlc_intstatus(struct brcms_c_info *wlc, bool in_isr) | |||
2516 | { | 2521 | { |
2517 | struct brcms_hardware *wlc_hw = wlc->hw; | 2522 | struct brcms_hardware *wlc_hw = wlc->hw; |
2518 | struct bcma_device *core = wlc_hw->d11core; | 2523 | struct bcma_device *core = wlc_hw->d11core; |
2519 | u32 macintstatus; | 2524 | u32 macintstatus, mask; |
2520 | 2525 | ||
2521 | /* macintstatus includes a DMA interrupt summary bit */ | 2526 | /* macintstatus includes a DMA interrupt summary bit */ |
2522 | macintstatus = bcma_read32(core, D11REGOFFS(macintstatus)); | 2527 | macintstatus = bcma_read32(core, D11REGOFFS(macintstatus)); |
2528 | mask = in_isr ? wlc->macintmask : wlc->defmacintmask; | ||
2523 | 2529 | ||
2524 | BCMMSG(wlc->wiphy, "wl%d: macintstatus: 0x%x\n", wlc_hw->unit, | 2530 | trace_brcms_macintstatus(&core->dev, in_isr, macintstatus, mask); |
2525 | macintstatus); | ||
2526 | 2531 | ||
2527 | /* detect cardbus removed, in power down(suspend) and in reset */ | 2532 | /* detect cardbus removed, in power down(suspend) and in reset */ |
2528 | if (brcms_deviceremoved(wlc)) | 2533 | if (brcms_deviceremoved(wlc)) |
@@ -2535,7 +2540,7 @@ static inline u32 wlc_intstatus(struct brcms_c_info *wlc, bool in_isr) | |||
2535 | return 0; | 2540 | return 0; |
2536 | 2541 | ||
2537 | /* defer unsolicited interrupts */ | 2542 | /* defer unsolicited interrupts */ |
2538 | macintstatus &= (in_isr ? wlc->macintmask : wlc->defmacintmask); | 2543 | macintstatus &= mask; |
2539 | 2544 | ||
2540 | /* if not for us */ | 2545 | /* if not for us */ |
2541 | if (macintstatus == 0) | 2546 | if (macintstatus == 0) |
@@ -2605,8 +2610,8 @@ bool brcms_c_isr(struct brcms_c_info *wlc, bool *wantdpc) | |||
2605 | macintstatus = wlc_intstatus(wlc, true); | 2610 | macintstatus = wlc_intstatus(wlc, true); |
2606 | 2611 | ||
2607 | if (macintstatus == 0xffffffff) | 2612 | if (macintstatus == 0xffffffff) |
2608 | wiphy_err(wlc->wiphy, "DEVICEREMOVED detected in the ISR code" | 2613 | brcms_err(wlc_hw->d11core, |
2609 | " path\n"); | 2614 | "DEVICEREMOVED detected in the ISR code path\n"); |
2610 | 2615 | ||
2611 | /* it is not for us */ | 2616 | /* it is not for us */ |
2612 | if (macintstatus == 0) | 2617 | if (macintstatus == 0) |
@@ -2626,10 +2631,9 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc) | |||
2626 | struct brcms_hardware *wlc_hw = wlc->hw; | 2631 | struct brcms_hardware *wlc_hw = wlc->hw; |
2627 | struct bcma_device *core = wlc_hw->d11core; | 2632 | struct bcma_device *core = wlc_hw->d11core; |
2628 | u32 mc, mi; | 2633 | u32 mc, mi; |
2629 | struct wiphy *wiphy = wlc->wiphy; | ||
2630 | 2634 | ||
2631 | BCMMSG(wlc->wiphy, "wl%d: bandunit %d\n", wlc_hw->unit, | 2635 | brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, |
2632 | wlc_hw->band->bandunit); | 2636 | wlc_hw->band->bandunit); |
2633 | 2637 | ||
2634 | /* | 2638 | /* |
2635 | * Track overlapping suspend requests | 2639 | * Track overlapping suspend requests |
@@ -2644,7 +2648,7 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc) | |||
2644 | mc = bcma_read32(core, D11REGOFFS(maccontrol)); | 2648 | mc = bcma_read32(core, D11REGOFFS(maccontrol)); |
2645 | 2649 | ||
2646 | if (mc == 0xffffffff) { | 2650 | if (mc == 0xffffffff) { |
2647 | wiphy_err(wiphy, "wl%d: %s: dead chip\n", wlc_hw->unit, | 2651 | brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, |
2648 | __func__); | 2652 | __func__); |
2649 | brcms_down(wlc->wl); | 2653 | brcms_down(wlc->wl); |
2650 | return; | 2654 | return; |
@@ -2655,7 +2659,7 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc) | |||
2655 | 2659 | ||
2656 | mi = bcma_read32(core, D11REGOFFS(macintstatus)); | 2660 | mi = bcma_read32(core, D11REGOFFS(macintstatus)); |
2657 | if (mi == 0xffffffff) { | 2661 | if (mi == 0xffffffff) { |
2658 | wiphy_err(wiphy, "wl%d: %s: dead chip\n", wlc_hw->unit, | 2662 | brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, |
2659 | __func__); | 2663 | __func__); |
2660 | brcms_down(wlc->wl); | 2664 | brcms_down(wlc->wl); |
2661 | return; | 2665 | return; |
@@ -2668,10 +2672,10 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc) | |||
2668 | BRCMS_MAX_MAC_SUSPEND); | 2672 | BRCMS_MAX_MAC_SUSPEND); |
2669 | 2673 | ||
2670 | if (!(bcma_read32(core, D11REGOFFS(macintstatus)) & MI_MACSSPNDD)) { | 2674 | if (!(bcma_read32(core, D11REGOFFS(macintstatus)) & MI_MACSSPNDD)) { |
2671 | wiphy_err(wiphy, "wl%d: wlc_suspend_mac_and_wait: waited %d uS" | 2675 | brcms_err(core, "wl%d: wlc_suspend_mac_and_wait: waited %d uS" |
2672 | " and MI_MACSSPNDD is still not on.\n", | 2676 | " and MI_MACSSPNDD is still not on.\n", |
2673 | wlc_hw->unit, BRCMS_MAX_MAC_SUSPEND); | 2677 | wlc_hw->unit, BRCMS_MAX_MAC_SUSPEND); |
2674 | wiphy_err(wiphy, "wl%d: psmdebug 0x%08x, phydebug 0x%08x, " | 2678 | brcms_err(core, "wl%d: psmdebug 0x%08x, phydebug 0x%08x, " |
2675 | "psm_brc 0x%04x\n", wlc_hw->unit, | 2679 | "psm_brc 0x%04x\n", wlc_hw->unit, |
2676 | bcma_read32(core, D11REGOFFS(psmdebug)), | 2680 | bcma_read32(core, D11REGOFFS(psmdebug)), |
2677 | bcma_read32(core, D11REGOFFS(phydebug)), | 2681 | bcma_read32(core, D11REGOFFS(phydebug)), |
@@ -2680,7 +2684,7 @@ void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc) | |||
2680 | 2684 | ||
2681 | mc = bcma_read32(core, D11REGOFFS(maccontrol)); | 2685 | mc = bcma_read32(core, D11REGOFFS(maccontrol)); |
2682 | if (mc == 0xffffffff) { | 2686 | if (mc == 0xffffffff) { |
2683 | wiphy_err(wiphy, "wl%d: %s: dead chip\n", wlc_hw->unit, | 2687 | brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, |
2684 | __func__); | 2688 | __func__); |
2685 | brcms_down(wlc->wl); | 2689 | brcms_down(wlc->wl); |
2686 | return; | 2690 | return; |
@@ -2696,8 +2700,8 @@ void brcms_c_enable_mac(struct brcms_c_info *wlc) | |||
2696 | struct bcma_device *core = wlc_hw->d11core; | 2700 | struct bcma_device *core = wlc_hw->d11core; |
2697 | u32 mc, mi; | 2701 | u32 mc, mi; |
2698 | 2702 | ||
2699 | BCMMSG(wlc->wiphy, "wl%d: bandunit %d\n", wlc_hw->unit, | 2703 | brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, |
2700 | wlc->band->bandunit); | 2704 | wlc->band->bandunit); |
2701 | 2705 | ||
2702 | /* | 2706 | /* |
2703 | * Track overlapping suspend requests | 2707 | * Track overlapping suspend requests |
@@ -2740,8 +2744,6 @@ static bool brcms_b_validate_chip_access(struct brcms_hardware *wlc_hw) | |||
2740 | u32 w, val; | 2744 | u32 w, val; |
2741 | struct wiphy *wiphy = wlc_hw->wlc->wiphy; | 2745 | struct wiphy *wiphy = wlc_hw->wlc->wiphy; |
2742 | 2746 | ||
2743 | BCMMSG(wiphy, "wl%d\n", wlc_hw->unit); | ||
2744 | |||
2745 | /* Validate dchip register access */ | 2747 | /* Validate dchip register access */ |
2746 | 2748 | ||
2747 | bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); | 2749 | bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); |
@@ -2802,7 +2804,7 @@ void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on) | |||
2802 | struct bcma_device *core = wlc_hw->d11core; | 2804 | struct bcma_device *core = wlc_hw->d11core; |
2803 | u32 tmp; | 2805 | u32 tmp; |
2804 | 2806 | ||
2805 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 2807 | brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); |
2806 | 2808 | ||
2807 | tmp = 0; | 2809 | tmp = 0; |
2808 | 2810 | ||
@@ -2818,8 +2820,8 @@ void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on) | |||
2818 | 2820 | ||
2819 | tmp = bcma_read32(core, D11REGOFFS(clk_ctl_st)); | 2821 | tmp = bcma_read32(core, D11REGOFFS(clk_ctl_st)); |
2820 | if ((tmp & CCS_ERSRC_AVAIL_HT) != CCS_ERSRC_AVAIL_HT) | 2822 | if ((tmp & CCS_ERSRC_AVAIL_HT) != CCS_ERSRC_AVAIL_HT) |
2821 | wiphy_err(wlc_hw->wlc->wiphy, "%s: turn on PHY" | 2823 | brcms_err(core, "%s: turn on PHY PLL failed\n", |
2822 | " PLL failed\n", __func__); | 2824 | __func__); |
2823 | } else { | 2825 | } else { |
2824 | bcma_set32(core, D11REGOFFS(clk_ctl_st), | 2826 | bcma_set32(core, D11REGOFFS(clk_ctl_st), |
2825 | tmp | CCS_ERSRC_REQ_D11PLL | | 2827 | tmp | CCS_ERSRC_REQ_D11PLL | |
@@ -2835,8 +2837,8 @@ void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on) | |||
2835 | (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) | 2837 | (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) |
2836 | != | 2838 | != |
2837 | (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) | 2839 | (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) |
2838 | wiphy_err(wlc_hw->wlc->wiphy, "%s: turn on " | 2840 | brcms_err(core, "%s: turn on PHY PLL failed\n", |
2839 | "PHY PLL failed\n", __func__); | 2841 | __func__); |
2840 | } | 2842 | } |
2841 | } else { | 2843 | } else { |
2842 | /* | 2844 | /* |
@@ -2854,7 +2856,7 @@ static void brcms_c_coredisable(struct brcms_hardware *wlc_hw) | |||
2854 | { | 2856 | { |
2855 | bool dev_gone; | 2857 | bool dev_gone; |
2856 | 2858 | ||
2857 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 2859 | brcms_dbg_info(wlc_hw->d11core, "wl%d: disable core\n", wlc_hw->unit); |
2858 | 2860 | ||
2859 | dev_gone = brcms_deviceremoved(wlc_hw->wlc); | 2861 | dev_gone = brcms_deviceremoved(wlc_hw->wlc); |
2860 | 2862 | ||
@@ -2884,12 +2886,14 @@ static void brcms_c_flushqueues(struct brcms_c_info *wlc) | |||
2884 | uint i; | 2886 | uint i; |
2885 | 2887 | ||
2886 | /* free any posted tx packets */ | 2888 | /* free any posted tx packets */ |
2887 | for (i = 0; i < NFIFO; i++) | 2889 | for (i = 0; i < NFIFO; i++) { |
2888 | if (wlc_hw->di[i]) { | 2890 | if (wlc_hw->di[i]) { |
2889 | dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); | 2891 | dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); |
2890 | wlc->core->txpktpend[i] = 0; | 2892 | if (i < TX_BCMC_FIFO) |
2891 | BCMMSG(wlc->wiphy, "pktpend fifo %d clrd\n", i); | 2893 | ieee80211_wake_queue(wlc->pub->ieee_hw, |
2894 | brcms_fifo_to_ac(i)); | ||
2892 | } | 2895 | } |
2896 | } | ||
2893 | 2897 | ||
2894 | /* free any posted rx packets */ | 2898 | /* free any posted rx packets */ |
2895 | dma_rxreclaim(wlc_hw->di[RX_FIFO]); | 2899 | dma_rxreclaim(wlc_hw->di[RX_FIFO]); |
@@ -3109,7 +3113,7 @@ static void brcms_c_statsupd(struct brcms_c_info *wlc) | |||
3109 | /* check for rx fifo 0 overflow */ | 3113 | /* check for rx fifo 0 overflow */ |
3110 | delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl); | 3114 | delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl); |
3111 | if (delta) | 3115 | if (delta) |
3112 | wiphy_err(wlc->wiphy, "wl%d: %u rx fifo 0 overflows!\n", | 3116 | brcms_err(wlc->hw->d11core, "wl%d: %u rx fifo 0 overflows!\n", |
3113 | wlc->pub->unit, delta); | 3117 | wlc->pub->unit, delta); |
3114 | 3118 | ||
3115 | /* check for tx fifo underflows */ | 3119 | /* check for tx fifo underflows */ |
@@ -3118,8 +3122,9 @@ static void brcms_c_statsupd(struct brcms_c_info *wlc) | |||
3118 | (u16) (wlc->core->macstat_snapshot->txfunfl[i] - | 3122 | (u16) (wlc->core->macstat_snapshot->txfunfl[i] - |
3119 | txfunfl[i]); | 3123 | txfunfl[i]); |
3120 | if (delta) | 3124 | if (delta) |
3121 | wiphy_err(wlc->wiphy, "wl%d: %u tx fifo %d underflows!" | 3125 | brcms_err(wlc->hw->d11core, |
3122 | "\n", wlc->pub->unit, delta, i); | 3126 | "wl%d: %u tx fifo %d underflows!\n", |
3127 | wlc->pub->unit, delta, i); | ||
3123 | } | 3128 | } |
3124 | #endif /* DEBUG */ | 3129 | #endif /* DEBUG */ |
3125 | 3130 | ||
@@ -3132,8 +3137,6 @@ static void brcms_c_statsupd(struct brcms_c_info *wlc) | |||
3132 | 3137 | ||
3133 | static void brcms_b_reset(struct brcms_hardware *wlc_hw) | 3138 | static void brcms_b_reset(struct brcms_hardware *wlc_hw) |
3134 | { | 3139 | { |
3135 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
3136 | |||
3137 | /* reset the core */ | 3140 | /* reset the core */ |
3138 | if (!brcms_deviceremoved(wlc_hw->wlc)) | 3141 | if (!brcms_deviceremoved(wlc_hw->wlc)) |
3139 | brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); | 3142 | brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); |
@@ -3144,7 +3147,7 @@ static void brcms_b_reset(struct brcms_hardware *wlc_hw) | |||
3144 | 3147 | ||
3145 | void brcms_c_reset(struct brcms_c_info *wlc) | 3148 | void brcms_c_reset(struct brcms_c_info *wlc) |
3146 | { | 3149 | { |
3147 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 3150 | brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); |
3148 | 3151 | ||
3149 | /* slurp up hw mac counters before core reset */ | 3152 | /* slurp up hw mac counters before core reset */ |
3150 | brcms_c_statsupd(wlc); | 3153 | brcms_c_statsupd(wlc); |
@@ -3189,10 +3192,9 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc) | |||
3189 | bool fifosz_fixup = false; | 3192 | bool fifosz_fixup = false; |
3190 | int err = 0; | 3193 | int err = 0; |
3191 | u16 buf[NFIFO]; | 3194 | u16 buf[NFIFO]; |
3192 | struct wiphy *wiphy = wlc->wiphy; | ||
3193 | struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; | 3195 | struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; |
3194 | 3196 | ||
3195 | BCMMSG(wlc->wiphy, "wl%d\n", wlc_hw->unit); | 3197 | brcms_dbg_info(core, "wl%d: core init\n", wlc_hw->unit); |
3196 | 3198 | ||
3197 | /* reset PSM */ | 3199 | /* reset PSM */ |
3198 | brcms_b_mctrl(wlc_hw, ~0, (MCTL_IHR_EN | MCTL_PSM_JMP_0 | MCTL_WAKE)); | 3200 | brcms_b_mctrl(wlc_hw, ~0, (MCTL_IHR_EN | MCTL_PSM_JMP_0 | MCTL_WAKE)); |
@@ -3212,7 +3214,7 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc) | |||
3212 | SPINWAIT(((bcma_read32(core, D11REGOFFS(macintstatus)) & | 3214 | SPINWAIT(((bcma_read32(core, D11REGOFFS(macintstatus)) & |
3213 | MI_MACSSPNDD) == 0), 1000 * 1000); | 3215 | MI_MACSSPNDD) == 0), 1000 * 1000); |
3214 | if ((bcma_read32(core, D11REGOFFS(macintstatus)) & MI_MACSSPNDD) == 0) | 3216 | if ((bcma_read32(core, D11REGOFFS(macintstatus)) & MI_MACSSPNDD) == 0) |
3215 | wiphy_err(wiphy, "wl%d: wlc_coreinit: ucode did not self-" | 3217 | brcms_err(core, "wl%d: wlc_coreinit: ucode did not self-" |
3216 | "suspend!\n", wlc_hw->unit); | 3218 | "suspend!\n", wlc_hw->unit); |
3217 | 3219 | ||
3218 | brcms_c_gpio_init(wlc); | 3220 | brcms_c_gpio_init(wlc); |
@@ -3223,18 +3225,18 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc) | |||
3223 | if (BRCMS_ISNPHY(wlc_hw->band)) | 3225 | if (BRCMS_ISNPHY(wlc_hw->band)) |
3224 | brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); | 3226 | brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); |
3225 | else | 3227 | else |
3226 | wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" | 3228 | brcms_err(core, "%s: wl%d: unsupported phy in corerev" |
3227 | " %d\n", __func__, wlc_hw->unit, | 3229 | " %d\n", __func__, wlc_hw->unit, |
3228 | wlc_hw->corerev); | 3230 | wlc_hw->corerev); |
3229 | } else if (D11REV_IS(wlc_hw->corerev, 24)) { | 3231 | } else if (D11REV_IS(wlc_hw->corerev, 24)) { |
3230 | if (BRCMS_ISLCNPHY(wlc_hw->band)) | 3232 | if (BRCMS_ISLCNPHY(wlc_hw->band)) |
3231 | brcms_c_write_inits(wlc_hw, ucode->d11lcn0initvals24); | 3233 | brcms_c_write_inits(wlc_hw, ucode->d11lcn0initvals24); |
3232 | else | 3234 | else |
3233 | wiphy_err(wiphy, "%s: wl%d: unsupported phy in corerev" | 3235 | brcms_err(core, "%s: wl%d: unsupported phy in corerev" |
3234 | " %d\n", __func__, wlc_hw->unit, | 3236 | " %d\n", __func__, wlc_hw->unit, |
3235 | wlc_hw->corerev); | 3237 | wlc_hw->corerev); |
3236 | } else { | 3238 | } else { |
3237 | wiphy_err(wiphy, "%s: wl%d: unsupported corerev %d\n", | 3239 | brcms_err(core, "%s: wl%d: unsupported corerev %d\n", |
3238 | __func__, wlc_hw->unit, wlc_hw->corerev); | 3240 | __func__, wlc_hw->unit, wlc_hw->corerev); |
3239 | } | 3241 | } |
3240 | 3242 | ||
@@ -3276,7 +3278,7 @@ static void brcms_b_coreinit(struct brcms_c_info *wlc) | |||
3276 | err = -1; | 3278 | err = -1; |
3277 | } | 3279 | } |
3278 | if (err != 0) | 3280 | if (err != 0) |
3279 | wiphy_err(wiphy, "wlc_coreinit: txfifo mismatch: ucode size %d" | 3281 | brcms_err(core, "wlc_coreinit: txfifo mismatch: ucode size %d" |
3280 | " driver size %d index %d\n", buf[i], | 3282 | " driver size %d index %d\n", buf[i], |
3281 | wlc_hw->xmtfifo_sz[i], i); | 3283 | wlc_hw->xmtfifo_sz[i], i); |
3282 | 3284 | ||
@@ -3359,8 +3361,6 @@ static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) { | |||
3359 | bool fastclk; | 3361 | bool fastclk; |
3360 | struct brcms_c_info *wlc = wlc_hw->wlc; | 3362 | struct brcms_c_info *wlc = wlc_hw->wlc; |
3361 | 3363 | ||
3362 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
3363 | |||
3364 | /* request FAST clock if not on */ | 3364 | /* request FAST clock if not on */ |
3365 | fastclk = wlc_hw->forcefastclk; | 3365 | fastclk = wlc_hw->forcefastclk; |
3366 | if (!fastclk) | 3366 | if (!fastclk) |
@@ -3453,7 +3453,7 @@ static void brcms_c_rate_lookup_init(struct brcms_c_info *wlc, | |||
3453 | rate = (rateset->rates[i] & BRCMS_RATE_MASK); | 3453 | rate = (rateset->rates[i] & BRCMS_RATE_MASK); |
3454 | 3454 | ||
3455 | if (rate > BRCM_MAXRATE) { | 3455 | if (rate > BRCM_MAXRATE) { |
3456 | wiphy_err(wlc->wiphy, "brcms_c_rate_lookup_init: " | 3456 | brcms_err(wlc->hw->d11core, "brcms_c_rate_lookup_init: " |
3457 | "invalid rate 0x%X in rate set\n", | 3457 | "invalid rate 0x%X in rate set\n", |
3458 | rateset->rates[i]); | 3458 | rateset->rates[i]); |
3459 | continue; | 3459 | continue; |
@@ -3529,7 +3529,6 @@ static void brcms_c_bandinit_ordered(struct brcms_c_info *wlc, | |||
3529 | uint parkband; | 3529 | uint parkband; |
3530 | uint i, band_order[2]; | 3530 | uint i, band_order[2]; |
3531 | 3531 | ||
3532 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | ||
3533 | /* | 3532 | /* |
3534 | * We might have been bandlocked during down and the chip | 3533 | * We might have been bandlocked during down and the chip |
3535 | * power-cycled (hibernate). Figure out the right band to park on | 3534 | * power-cycled (hibernate). Figure out the right band to park on |
@@ -3710,8 +3709,8 @@ static void brcms_c_set_ratetable(struct brcms_c_info *wlc) | |||
3710 | /* band-specific init */ | 3709 | /* band-specific init */ |
3711 | static void brcms_c_bsinit(struct brcms_c_info *wlc) | 3710 | static void brcms_c_bsinit(struct brcms_c_info *wlc) |
3712 | { | 3711 | { |
3713 | BCMMSG(wlc->wiphy, "wl%d: bandunit %d\n", | 3712 | brcms_dbg_info(wlc->hw->d11core, "wl%d: bandunit %d\n", |
3714 | wlc->pub->unit, wlc->band->bandunit); | 3713 | wlc->pub->unit, wlc->band->bandunit); |
3715 | 3714 | ||
3716 | /* write ucode ACK/CTS rate table */ | 3715 | /* write ucode ACK/CTS rate table */ |
3717 | brcms_c_set_ratetable(wlc); | 3716 | brcms_c_set_ratetable(wlc); |
@@ -3734,7 +3733,8 @@ brcms_c_duty_cycle_set(struct brcms_c_info *wlc, int duty_cycle, bool isOFDM, | |||
3734 | isOFDM ? M_TX_IDLE_BUSY_RATIO_X_16_OFDM : | 3733 | isOFDM ? M_TX_IDLE_BUSY_RATIO_X_16_OFDM : |
3735 | M_TX_IDLE_BUSY_RATIO_X_16_CCK; | 3734 | M_TX_IDLE_BUSY_RATIO_X_16_CCK; |
3736 | if (duty_cycle > 100 || duty_cycle < 0) { | 3735 | if (duty_cycle > 100 || duty_cycle < 0) { |
3737 | wiphy_err(wlc->wiphy, "wl%d: duty cycle value off limit\n", | 3736 | brcms_err(wlc->hw->d11core, |
3737 | "wl%d: duty cycle value off limit\n", | ||
3738 | wlc->pub->unit); | 3738 | wlc->pub->unit); |
3739 | return -EINVAL; | 3739 | return -EINVAL; |
3740 | } | 3740 | } |
@@ -3752,40 +3752,6 @@ brcms_c_duty_cycle_set(struct brcms_c_info *wlc, int duty_cycle, bool isOFDM, | |||
3752 | return 0; | 3752 | return 0; |
3753 | } | 3753 | } |
3754 | 3754 | ||
3755 | /* | ||
3756 | * Initialize the base precedence map for dequeueing | ||
3757 | * from txq based on WME settings | ||
3758 | */ | ||
3759 | static void brcms_c_tx_prec_map_init(struct brcms_c_info *wlc) | ||
3760 | { | ||
3761 | wlc->tx_prec_map = BRCMS_PREC_BMP_ALL; | ||
3762 | memset(wlc->fifo2prec_map, 0, NFIFO * sizeof(u16)); | ||
3763 | |||
3764 | wlc->fifo2prec_map[TX_AC_BK_FIFO] = BRCMS_PREC_BMP_AC_BK; | ||
3765 | wlc->fifo2prec_map[TX_AC_BE_FIFO] = BRCMS_PREC_BMP_AC_BE; | ||
3766 | wlc->fifo2prec_map[TX_AC_VI_FIFO] = BRCMS_PREC_BMP_AC_VI; | ||
3767 | wlc->fifo2prec_map[TX_AC_VO_FIFO] = BRCMS_PREC_BMP_AC_VO; | ||
3768 | } | ||
3769 | |||
3770 | static void | ||
3771 | brcms_c_txflowcontrol_signal(struct brcms_c_info *wlc, | ||
3772 | struct brcms_txq_info *qi, bool on, int prio) | ||
3773 | { | ||
3774 | /* transmit flowcontrol is not yet implemented */ | ||
3775 | } | ||
3776 | |||
3777 | static void brcms_c_txflowcontrol_reset(struct brcms_c_info *wlc) | ||
3778 | { | ||
3779 | struct brcms_txq_info *qi; | ||
3780 | |||
3781 | for (qi = wlc->tx_queues; qi != NULL; qi = qi->next) { | ||
3782 | if (qi->stopped) { | ||
3783 | brcms_c_txflowcontrol_signal(wlc, qi, OFF, ALLPRIO); | ||
3784 | qi->stopped = 0; | ||
3785 | } | ||
3786 | } | ||
3787 | } | ||
3788 | |||
3789 | /* push sw hps and wake state through hardware */ | 3755 | /* push sw hps and wake state through hardware */ |
3790 | static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc) | 3756 | static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc) |
3791 | { | 3757 | { |
@@ -3795,7 +3761,8 @@ static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc) | |||
3795 | 3761 | ||
3796 | hps = brcms_c_ps_allowed(wlc); | 3762 | hps = brcms_c_ps_allowed(wlc); |
3797 | 3763 | ||
3798 | BCMMSG(wlc->wiphy, "wl%d: hps %d\n", wlc->pub->unit, hps); | 3764 | brcms_dbg_mac80211(wlc->hw->d11core, "wl%d: hps %d\n", wlc->pub->unit, |
3765 | hps); | ||
3799 | 3766 | ||
3800 | v1 = bcma_read32(wlc->hw->d11core, D11REGOFFS(maccontrol)); | 3767 | v1 = bcma_read32(wlc->hw->d11core, D11REGOFFS(maccontrol)); |
3801 | v2 = MCTL_WAKE; | 3768 | v2 = MCTL_WAKE; |
@@ -3881,7 +3848,8 @@ brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, | |||
3881 | { | 3848 | { |
3882 | uint bandunit; | 3849 | uint bandunit; |
3883 | 3850 | ||
3884 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d: 0x%x\n", wlc_hw->unit, chanspec); | 3851 | brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: 0x%x\n", wlc_hw->unit, |
3852 | chanspec); | ||
3885 | 3853 | ||
3886 | wlc_hw->chanspec = chanspec; | 3854 | wlc_hw->chanspec = chanspec; |
3887 | 3855 | ||
@@ -3942,7 +3910,7 @@ static void brcms_c_set_chanspec(struct brcms_c_info *wlc, u16 chanspec) | |||
3942 | u16 old_chanspec = wlc->chanspec; | 3910 | u16 old_chanspec = wlc->chanspec; |
3943 | 3911 | ||
3944 | if (!brcms_c_valid_chanspec_db(wlc->cmi, chanspec)) { | 3912 | if (!brcms_c_valid_chanspec_db(wlc->cmi, chanspec)) { |
3945 | wiphy_err(wlc->wiphy, "wl%d: %s: Bad channel %d\n", | 3913 | brcms_err(wlc->hw->d11core, "wl%d: %s: Bad channel %d\n", |
3946 | wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec)); | 3914 | wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec)); |
3947 | return; | 3915 | return; |
3948 | } | 3916 | } |
@@ -3953,8 +3921,8 @@ static void brcms_c_set_chanspec(struct brcms_c_info *wlc, u16 chanspec) | |||
3953 | if (wlc->band->bandunit != bandunit || wlc->bandinit_pending) { | 3921 | if (wlc->band->bandunit != bandunit || wlc->bandinit_pending) { |
3954 | switchband = true; | 3922 | switchband = true; |
3955 | if (wlc->bandlocked) { | 3923 | if (wlc->bandlocked) { |
3956 | wiphy_err(wlc->wiphy, "wl%d: %s: chspec %d " | 3924 | brcms_err(wlc->hw->d11core, |
3957 | "band is locked!\n", | 3925 | "wl%d: %s: chspec %d band is locked!\n", |
3958 | wlc->pub->unit, __func__, | 3926 | wlc->pub->unit, __func__, |
3959 | CHSPEC_CHANNEL(chanspec)); | 3927 | CHSPEC_CHANNEL(chanspec)); |
3960 | return; | 3928 | return; |
@@ -4018,6 +3986,10 @@ void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, | |||
4018 | */ | 3986 | */ |
4019 | void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val) | 3987 | void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val) |
4020 | { | 3988 | { |
3989 | /* | ||
3990 | * Cannot use brcms_dbg_* here because this function is called | ||
3991 | * before wlc is sufficiently initialized. | ||
3992 | */ | ||
4021 | BCMMSG(wlc->wiphy, "idx %d, val %d\n", idx, val); | 3993 | BCMMSG(wlc->wiphy, "idx %d, val %d\n", idx, val); |
4022 | 3994 | ||
4023 | switch (idx) { | 3995 | switch (idx) { |
@@ -4090,8 +4062,8 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci, | |||
4090 | 4062 | ||
4091 | /* Only apply params if the core is out of reset and has clocks */ | 4063 | /* Only apply params if the core is out of reset and has clocks */ |
4092 | if (!wlc->clk) { | 4064 | if (!wlc->clk) { |
4093 | wiphy_err(wlc->wiphy, "wl%d: %s : no-clock\n", wlc->pub->unit, | 4065 | brcms_err(wlc->hw->d11core, "wl%d: %s : no-clock\n", |
4094 | __func__); | 4066 | wlc->pub->unit, __func__); |
4095 | return; | 4067 | return; |
4096 | } | 4068 | } |
4097 | 4069 | ||
@@ -4109,7 +4081,7 @@ void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci, | |||
4109 | 4081 | ||
4110 | if (acp_shm.aifs < EDCF_AIFSN_MIN | 4082 | if (acp_shm.aifs < EDCF_AIFSN_MIN |
4111 | || acp_shm.aifs > EDCF_AIFSN_MAX) { | 4083 | || acp_shm.aifs > EDCF_AIFSN_MAX) { |
4112 | wiphy_err(wlc->wiphy, "wl%d: edcf_setparams: bad " | 4084 | brcms_err(wlc->hw->d11core, "wl%d: edcf_setparams: bad " |
4113 | "aifs %d\n", wlc->pub->unit, acp_shm.aifs); | 4085 | "aifs %d\n", wlc->pub->unit, acp_shm.aifs); |
4114 | } else { | 4086 | } else { |
4115 | acp_shm.cwmin = params->cw_min; | 4087 | acp_shm.cwmin = params->cw_min; |
@@ -4224,8 +4196,8 @@ static void brcms_c_radio_timer(void *arg) | |||
4224 | struct brcms_c_info *wlc = (struct brcms_c_info *) arg; | 4196 | struct brcms_c_info *wlc = (struct brcms_c_info *) arg; |
4225 | 4197 | ||
4226 | if (brcms_deviceremoved(wlc)) { | 4198 | if (brcms_deviceremoved(wlc)) { |
4227 | wiphy_err(wlc->wiphy, "wl%d: %s: dead chip\n", wlc->pub->unit, | 4199 | brcms_err(wlc->hw->d11core, "wl%d: %s: dead chip\n", |
4228 | __func__); | 4200 | wlc->pub->unit, __func__); |
4229 | brcms_down(wlc->wl); | 4201 | brcms_down(wlc->wl); |
4230 | return; | 4202 | return; |
4231 | } | 4203 | } |
@@ -4238,8 +4210,6 @@ static void brcms_b_watchdog(struct brcms_c_info *wlc) | |||
4238 | { | 4210 | { |
4239 | struct brcms_hardware *wlc_hw = wlc->hw; | 4211 | struct brcms_hardware *wlc_hw = wlc->hw; |
4240 | 4212 | ||
4241 | BCMMSG(wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
4242 | |||
4243 | if (!wlc_hw->up) | 4213 | if (!wlc_hw->up) |
4244 | return; | 4214 | return; |
4245 | 4215 | ||
@@ -4258,14 +4228,14 @@ static void brcms_b_watchdog(struct brcms_c_info *wlc) | |||
4258 | /* common watchdog code */ | 4228 | /* common watchdog code */ |
4259 | static void brcms_c_watchdog(struct brcms_c_info *wlc) | 4229 | static void brcms_c_watchdog(struct brcms_c_info *wlc) |
4260 | { | 4230 | { |
4261 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 4231 | brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); |
4262 | 4232 | ||
4263 | if (!wlc->pub->up) | 4233 | if (!wlc->pub->up) |
4264 | return; | 4234 | return; |
4265 | 4235 | ||
4266 | if (brcms_deviceremoved(wlc)) { | 4236 | if (brcms_deviceremoved(wlc)) { |
4267 | wiphy_err(wlc->wiphy, "wl%d: %s: dead chip\n", wlc->pub->unit, | 4237 | brcms_err(wlc->hw->d11core, "wl%d: %s: dead chip\n", |
4268 | __func__); | 4238 | wlc->pub->unit, __func__); |
4269 | brcms_down(wlc->wl); | 4239 | brcms_down(wlc->wl); |
4270 | return; | 4240 | return; |
4271 | } | 4241 | } |
@@ -4437,13 +4407,13 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core, | |||
4437 | struct ssb_sprom *sprom = &core->bus->sprom; | 4407 | struct ssb_sprom *sprom = &core->bus->sprom; |
4438 | 4408 | ||
4439 | if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) | 4409 | if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) |
4440 | BCMMSG(wlc->wiphy, "wl%d: vendor 0x%x device 0x%x\n", unit, | 4410 | brcms_dbg_info(core, "wl%d: vendor 0x%x device 0x%x\n", unit, |
4441 | pcidev->vendor, | 4411 | pcidev->vendor, |
4442 | pcidev->device); | 4412 | pcidev->device); |
4443 | else | 4413 | else |
4444 | BCMMSG(wlc->wiphy, "wl%d: vendor 0x%x device 0x%x\n", unit, | 4414 | brcms_dbg_info(core, "wl%d: vendor 0x%x device 0x%x\n", unit, |
4445 | core->bus->boardinfo.vendor, | 4415 | core->bus->boardinfo.vendor, |
4446 | core->bus->boardinfo.type); | 4416 | core->bus->boardinfo.type); |
4447 | 4417 | ||
4448 | wme = true; | 4418 | wme = true; |
4449 | 4419 | ||
@@ -4715,8 +4685,9 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core, | |||
4715 | goto fail; | 4685 | goto fail; |
4716 | } | 4686 | } |
4717 | 4687 | ||
4718 | BCMMSG(wlc->wiphy, "deviceid 0x%x nbands %d board 0x%x\n", | 4688 | brcms_dbg_info(wlc_hw->d11core, "deviceid 0x%x nbands %d board 0x%x\n", |
4719 | wlc_hw->deviceid, wlc_hw->_nbands, ai_get_boardtype(wlc_hw->sih)); | 4689 | wlc_hw->deviceid, wlc_hw->_nbands, |
4690 | ai_get_boardtype(wlc_hw->sih)); | ||
4720 | 4691 | ||
4721 | return err; | 4692 | return err; |
4722 | 4693 | ||
@@ -4836,56 +4807,6 @@ static void brcms_c_bss_default_init(struct brcms_c_info *wlc) | |||
4836 | bi->flags |= BRCMS_BSS_HT; | 4807 | bi->flags |= BRCMS_BSS_HT; |
4837 | } | 4808 | } |
4838 | 4809 | ||
4839 | static struct brcms_txq_info *brcms_c_txq_alloc(struct brcms_c_info *wlc) | ||
4840 | { | ||
4841 | struct brcms_txq_info *qi, *p; | ||
4842 | |||
4843 | qi = kzalloc(sizeof(struct brcms_txq_info), GFP_ATOMIC); | ||
4844 | if (qi != NULL) { | ||
4845 | /* | ||
4846 | * Have enough room for control packets along with HI watermark | ||
4847 | * Also, add room to txq for total psq packets if all the SCBs | ||
4848 | * leave PS mode. The watermark for flowcontrol to OS packets | ||
4849 | * will remain the same | ||
4850 | */ | ||
4851 | brcmu_pktq_init(&qi->q, BRCMS_PREC_COUNT, | ||
4852 | 2 * BRCMS_DATAHIWAT + PKTQ_LEN_DEFAULT); | ||
4853 | |||
4854 | /* add this queue to the the global list */ | ||
4855 | p = wlc->tx_queues; | ||
4856 | if (p == NULL) { | ||
4857 | wlc->tx_queues = qi; | ||
4858 | } else { | ||
4859 | while (p->next != NULL) | ||
4860 | p = p->next; | ||
4861 | p->next = qi; | ||
4862 | } | ||
4863 | } | ||
4864 | return qi; | ||
4865 | } | ||
4866 | |||
4867 | static void brcms_c_txq_free(struct brcms_c_info *wlc, | ||
4868 | struct brcms_txq_info *qi) | ||
4869 | { | ||
4870 | struct brcms_txq_info *p; | ||
4871 | |||
4872 | if (qi == NULL) | ||
4873 | return; | ||
4874 | |||
4875 | /* remove the queue from the linked list */ | ||
4876 | p = wlc->tx_queues; | ||
4877 | if (p == qi) | ||
4878 | wlc->tx_queues = p->next; | ||
4879 | else { | ||
4880 | while (p != NULL && p->next != qi) | ||
4881 | p = p->next; | ||
4882 | if (p != NULL) | ||
4883 | p->next = p->next->next; | ||
4884 | } | ||
4885 | |||
4886 | kfree(qi); | ||
4887 | } | ||
4888 | |||
4889 | static void brcms_c_update_mimo_band_bwcap(struct brcms_c_info *wlc, u8 bwcap) | 4810 | static void brcms_c_update_mimo_band_bwcap(struct brcms_c_info *wlc, u8 bwcap) |
4890 | { | 4811 | { |
4891 | uint i; | 4812 | uint i; |
@@ -4991,8 +4912,6 @@ uint brcms_c_detach(struct brcms_c_info *wlc) | |||
4991 | if (wlc == NULL) | 4912 | if (wlc == NULL) |
4992 | return 0; | 4913 | return 0; |
4993 | 4914 | ||
4994 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | ||
4995 | |||
4996 | callbacks += brcms_b_detach(wlc); | 4915 | callbacks += brcms_b_detach(wlc); |
4997 | 4916 | ||
4998 | /* delete software timers */ | 4917 | /* delete software timers */ |
@@ -5005,10 +4924,6 @@ uint brcms_c_detach(struct brcms_c_info *wlc) | |||
5005 | 4924 | ||
5006 | brcms_c_detach_module(wlc); | 4925 | brcms_c_detach_module(wlc); |
5007 | 4926 | ||
5008 | |||
5009 | while (wlc->tx_queues != NULL) | ||
5010 | brcms_c_txq_free(wlc, wlc->tx_queues); | ||
5011 | |||
5012 | brcms_c_detach_mfree(wlc); | 4927 | brcms_c_detach_mfree(wlc); |
5013 | return callbacks; | 4928 | return callbacks; |
5014 | } | 4929 | } |
@@ -5026,7 +4941,7 @@ static void brcms_b_hw_up(struct brcms_hardware *wlc_hw) | |||
5026 | if (wlc_hw->wlc->pub->hw_up) | 4941 | if (wlc_hw->wlc->pub->hw_up) |
5027 | return; | 4942 | return; |
5028 | 4943 | ||
5029 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 4944 | brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); |
5030 | 4945 | ||
5031 | /* | 4946 | /* |
5032 | * Enable pll and xtal, initialize the power control registers, | 4947 | * Enable pll and xtal, initialize the power control registers, |
@@ -5063,7 +4978,7 @@ static void brcms_b_hw_up(struct brcms_hardware *wlc_hw) | |||
5063 | 4978 | ||
5064 | static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) | 4979 | static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) |
5065 | { | 4980 | { |
5066 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | 4981 | brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); |
5067 | 4982 | ||
5068 | /* | 4983 | /* |
5069 | * Enable pll and xtal, initialize the power control registers, | 4984 | * Enable pll and xtal, initialize the power control registers, |
@@ -5077,7 +4992,7 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) | |||
5077 | * Configure pci/pcmcia here instead of in brcms_c_attach() | 4992 | * Configure pci/pcmcia here instead of in brcms_c_attach() |
5078 | * to allow mfg hotswap: down, hotswap (chip power cycle), up. | 4993 | * to allow mfg hotswap: down, hotswap (chip power cycle), up. |
5079 | */ | 4994 | */ |
5080 | bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci, wlc_hw->d11core, | 4995 | bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core, |
5081 | true); | 4996 | true); |
5082 | 4997 | ||
5083 | /* | 4998 | /* |
@@ -5102,8 +5017,6 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) | |||
5102 | 5017 | ||
5103 | static int brcms_b_up_finish(struct brcms_hardware *wlc_hw) | 5018 | static int brcms_b_up_finish(struct brcms_hardware *wlc_hw) |
5104 | { | 5019 | { |
5105 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
5106 | |||
5107 | wlc_hw->up = true; | 5020 | wlc_hw->up = true; |
5108 | wlc_phy_hw_state_upd(wlc_hw->band->pi, true); | 5021 | wlc_phy_hw_state_upd(wlc_hw->band->pi, true); |
5109 | 5022 | ||
@@ -5135,7 +5048,7 @@ int brcms_c_up(struct brcms_c_info *wlc) | |||
5135 | { | 5048 | { |
5136 | struct ieee80211_channel *ch; | 5049 | struct ieee80211_channel *ch; |
5137 | 5050 | ||
5138 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 5051 | brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); |
5139 | 5052 | ||
5140 | /* HW is turned off so don't try to access it */ | 5053 | /* HW is turned off so don't try to access it */ |
5141 | if (wlc->pub->hw_off || brcms_deviceremoved(wlc)) | 5054 | if (wlc->pub->hw_off || brcms_deviceremoved(wlc)) |
@@ -5176,8 +5089,8 @@ int brcms_c_up(struct brcms_c_info *wlc) | |||
5176 | WL_RADIO_HW_DISABLE); | 5089 | WL_RADIO_HW_DISABLE); |
5177 | 5090 | ||
5178 | if (bsscfg->enable && bsscfg->BSS) | 5091 | if (bsscfg->enable && bsscfg->BSS) |
5179 | wiphy_err(wlc->wiphy, "wl%d: up" | 5092 | brcms_err(wlc->hw->d11core, |
5180 | ": rfdisable -> " | 5093 | "wl%d: up: rfdisable -> " |
5181 | "bsscfg_disable()\n", | 5094 | "bsscfg_disable()\n", |
5182 | wlc->pub->unit); | 5095 | wlc->pub->unit); |
5183 | } | 5096 | } |
@@ -5237,8 +5150,6 @@ static int brcms_b_bmac_down_prep(struct brcms_hardware *wlc_hw) | |||
5237 | bool dev_gone; | 5150 | bool dev_gone; |
5238 | uint callbacks = 0; | 5151 | uint callbacks = 0; |
5239 | 5152 | ||
5240 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
5241 | |||
5242 | if (!wlc_hw->up) | 5153 | if (!wlc_hw->up) |
5243 | return callbacks; | 5154 | return callbacks; |
5244 | 5155 | ||
@@ -5265,8 +5176,6 @@ static int brcms_b_down_finish(struct brcms_hardware *wlc_hw) | |||
5265 | uint callbacks = 0; | 5176 | uint callbacks = 0; |
5266 | bool dev_gone; | 5177 | bool dev_gone; |
5267 | 5178 | ||
5268 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
5269 | |||
5270 | if (!wlc_hw->up) | 5179 | if (!wlc_hw->up) |
5271 | return callbacks; | 5180 | return callbacks; |
5272 | 5181 | ||
@@ -5314,14 +5223,14 @@ uint brcms_c_down(struct brcms_c_info *wlc) | |||
5314 | uint callbacks = 0; | 5223 | uint callbacks = 0; |
5315 | int i; | 5224 | int i; |
5316 | bool dev_gone = false; | 5225 | bool dev_gone = false; |
5317 | struct brcms_txq_info *qi; | ||
5318 | 5226 | ||
5319 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 5227 | brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); |
5320 | 5228 | ||
5321 | /* check if we are already in the going down path */ | 5229 | /* check if we are already in the going down path */ |
5322 | if (wlc->going_down) { | 5230 | if (wlc->going_down) { |
5323 | wiphy_err(wlc->wiphy, "wl%d: %s: Driver going down so return" | 5231 | brcms_err(wlc->hw->d11core, |
5324 | "\n", wlc->pub->unit, __func__); | 5232 | "wl%d: %s: Driver going down so return\n", |
5233 | wlc->pub->unit, __func__); | ||
5325 | return 0; | 5234 | return 0; |
5326 | } | 5235 | } |
5327 | if (!wlc->pub->up) | 5236 | if (!wlc->pub->up) |
@@ -5353,13 +5262,6 @@ uint brcms_c_down(struct brcms_c_info *wlc) | |||
5353 | 5262 | ||
5354 | wlc_phy_mute_upd(wlc->band->pi, false, PHY_MUTE_ALL); | 5263 | wlc_phy_mute_upd(wlc->band->pi, false, PHY_MUTE_ALL); |
5355 | 5264 | ||
5356 | /* clear txq flow control */ | ||
5357 | brcms_c_txflowcontrol_reset(wlc); | ||
5358 | |||
5359 | /* flush tx queues */ | ||
5360 | for (qi = wlc->tx_queues; qi != NULL; qi = qi->next) | ||
5361 | brcmu_pktq_flush(&qi->q, true, NULL, NULL); | ||
5362 | |||
5363 | callbacks += brcms_b_down_finish(wlc->hw); | 5265 | callbacks += brcms_b_down_finish(wlc->hw); |
5364 | 5266 | ||
5365 | /* brcms_b_down_finish has done brcms_c_coredisable(). so clk is off */ | 5267 | /* brcms_b_down_finish has done brcms_c_coredisable(). so clk is off */ |
@@ -5441,7 +5343,7 @@ int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config) | |||
5441 | 5343 | ||
5442 | default: | 5344 | default: |
5443 | /* Error */ | 5345 | /* Error */ |
5444 | wiphy_err(wlc->wiphy, "wl%d: %s: invalid gmode %d\n", | 5346 | brcms_err(wlc->hw->d11core, "wl%d: %s: invalid gmode %d\n", |
5445 | wlc->pub->unit, __func__, gmode); | 5347 | wlc->pub->unit, __func__, gmode); |
5446 | return -ENOTSUPP; | 5348 | return -ENOTSUPP; |
5447 | } | 5349 | } |
@@ -5745,45 +5647,6 @@ int brcms_c_module_unregister(struct brcms_pub *pub, const char *name, | |||
5745 | return -ENODATA; | 5647 | return -ENODATA; |
5746 | } | 5648 | } |
5747 | 5649 | ||
5748 | void brcms_c_print_txstatus(struct tx_status *txs) | ||
5749 | { | ||
5750 | pr_debug("\ntxpkt (MPDU) Complete\n"); | ||
5751 | |||
5752 | pr_debug("FrameID: %04x TxStatus: %04x\n", txs->frameid, txs->status); | ||
5753 | |||
5754 | pr_debug("[15:12] %d frame attempts\n", | ||
5755 | (txs->status & TX_STATUS_FRM_RTX_MASK) >> | ||
5756 | TX_STATUS_FRM_RTX_SHIFT); | ||
5757 | pr_debug(" [11:8] %d rts attempts\n", | ||
5758 | (txs->status & TX_STATUS_RTS_RTX_MASK) >> | ||
5759 | TX_STATUS_RTS_RTX_SHIFT); | ||
5760 | pr_debug(" [7] %d PM mode indicated\n", | ||
5761 | txs->status & TX_STATUS_PMINDCTD ? 1 : 0); | ||
5762 | pr_debug(" [6] %d intermediate status\n", | ||
5763 | txs->status & TX_STATUS_INTERMEDIATE ? 1 : 0); | ||
5764 | pr_debug(" [5] %d AMPDU\n", | ||
5765 | txs->status & TX_STATUS_AMPDU ? 1 : 0); | ||
5766 | pr_debug(" [4:2] %d Frame Suppressed Reason (%s)\n", | ||
5767 | (txs->status & TX_STATUS_SUPR_MASK) >> TX_STATUS_SUPR_SHIFT, | ||
5768 | (const char *[]) { | ||
5769 | "None", | ||
5770 | "PMQ Entry", | ||
5771 | "Flush request", | ||
5772 | "Previous frag failure", | ||
5773 | "Channel mismatch", | ||
5774 | "Lifetime Expiry", | ||
5775 | "Underflow" | ||
5776 | } [(txs->status & TX_STATUS_SUPR_MASK) >> | ||
5777 | TX_STATUS_SUPR_SHIFT]); | ||
5778 | pr_debug(" [1] %d acked\n", | ||
5779 | txs->status & TX_STATUS_ACK_RCV ? 1 : 0); | ||
5780 | |||
5781 | pr_debug("LastTxTime: %04x Seq: %04x PHYTxStatus: %04x RxAckRSSI: %04x RxAckSQ: %04x\n", | ||
5782 | txs->lasttxtime, txs->sequence, txs->phyerr, | ||
5783 | (txs->ackphyrxsh & PRXS1_JSSI_MASK) >> PRXS1_JSSI_SHIFT, | ||
5784 | (txs->ackphyrxsh & PRXS1_SQ_MASK) >> PRXS1_SQ_SHIFT); | ||
5785 | } | ||
5786 | |||
5787 | static bool brcms_c_chipmatch_pci(struct bcma_device *core) | 5650 | static bool brcms_c_chipmatch_pci(struct bcma_device *core) |
5788 | { | 5651 | { |
5789 | struct pci_dev *pcidev = core->bus->host_pci; | 5652 | struct pci_dev *pcidev = core->bus->host_pci; |
@@ -5832,184 +5695,6 @@ bool brcms_c_chipmatch(struct bcma_device *core) | |||
5832 | } | 5695 | } |
5833 | } | 5696 | } |
5834 | 5697 | ||
5835 | #if defined(DEBUG) | ||
5836 | void brcms_c_print_txdesc(struct d11txh *txh) | ||
5837 | { | ||
5838 | u16 mtcl = le16_to_cpu(txh->MacTxControlLow); | ||
5839 | u16 mtch = le16_to_cpu(txh->MacTxControlHigh); | ||
5840 | u16 mfc = le16_to_cpu(txh->MacFrameControl); | ||
5841 | u16 tfest = le16_to_cpu(txh->TxFesTimeNormal); | ||
5842 | u16 ptcw = le16_to_cpu(txh->PhyTxControlWord); | ||
5843 | u16 ptcw_1 = le16_to_cpu(txh->PhyTxControlWord_1); | ||
5844 | u16 ptcw_1_Fbr = le16_to_cpu(txh->PhyTxControlWord_1_Fbr); | ||
5845 | u16 ptcw_1_Rts = le16_to_cpu(txh->PhyTxControlWord_1_Rts); | ||
5846 | u16 ptcw_1_FbrRts = le16_to_cpu(txh->PhyTxControlWord_1_FbrRts); | ||
5847 | u16 mainrates = le16_to_cpu(txh->MainRates); | ||
5848 | u16 xtraft = le16_to_cpu(txh->XtraFrameTypes); | ||
5849 | u8 *iv = txh->IV; | ||
5850 | u8 *ra = txh->TxFrameRA; | ||
5851 | u16 tfestfb = le16_to_cpu(txh->TxFesTimeFallback); | ||
5852 | u8 *rtspfb = txh->RTSPLCPFallback; | ||
5853 | u16 rtsdfb = le16_to_cpu(txh->RTSDurFallback); | ||
5854 | u8 *fragpfb = txh->FragPLCPFallback; | ||
5855 | u16 fragdfb = le16_to_cpu(txh->FragDurFallback); | ||
5856 | u16 mmodelen = le16_to_cpu(txh->MModeLen); | ||
5857 | u16 mmodefbrlen = le16_to_cpu(txh->MModeFbrLen); | ||
5858 | u16 tfid = le16_to_cpu(txh->TxFrameID); | ||
5859 | u16 txs = le16_to_cpu(txh->TxStatus); | ||
5860 | u16 mnmpdu = le16_to_cpu(txh->MaxNMpdus); | ||
5861 | u16 mabyte = le16_to_cpu(txh->MaxABytes_MRT); | ||
5862 | u16 mabyte_f = le16_to_cpu(txh->MaxABytes_FBR); | ||
5863 | u16 mmbyte = le16_to_cpu(txh->MinMBytes); | ||
5864 | |||
5865 | u8 *rtsph = txh->RTSPhyHeader; | ||
5866 | struct ieee80211_rts rts = txh->rts_frame; | ||
5867 | |||
5868 | /* add plcp header along with txh descriptor */ | ||
5869 | brcmu_dbg_hex_dump(txh, sizeof(struct d11txh) + 48, | ||
5870 | "Raw TxDesc + plcp header:\n"); | ||
5871 | |||
5872 | pr_debug("TxCtlLow: %04x ", mtcl); | ||
5873 | pr_debug("TxCtlHigh: %04x ", mtch); | ||
5874 | pr_debug("FC: %04x ", mfc); | ||
5875 | pr_debug("FES Time: %04x\n", tfest); | ||
5876 | pr_debug("PhyCtl: %04x%s ", ptcw, | ||
5877 | (ptcw & PHY_TXC_SHORT_HDR) ? " short" : ""); | ||
5878 | pr_debug("PhyCtl_1: %04x ", ptcw_1); | ||
5879 | pr_debug("PhyCtl_1_Fbr: %04x\n", ptcw_1_Fbr); | ||
5880 | pr_debug("PhyCtl_1_Rts: %04x ", ptcw_1_Rts); | ||
5881 | pr_debug("PhyCtl_1_Fbr_Rts: %04x\n", ptcw_1_FbrRts); | ||
5882 | pr_debug("MainRates: %04x ", mainrates); | ||
5883 | pr_debug("XtraFrameTypes: %04x ", xtraft); | ||
5884 | pr_debug("\n"); | ||
5885 | |||
5886 | print_hex_dump_bytes("SecIV:", DUMP_PREFIX_OFFSET, iv, sizeof(txh->IV)); | ||
5887 | print_hex_dump_bytes("RA:", DUMP_PREFIX_OFFSET, | ||
5888 | ra, sizeof(txh->TxFrameRA)); | ||
5889 | |||
5890 | pr_debug("Fb FES Time: %04x ", tfestfb); | ||
5891 | print_hex_dump_bytes("Fb RTS PLCP:", DUMP_PREFIX_OFFSET, | ||
5892 | rtspfb, sizeof(txh->RTSPLCPFallback)); | ||
5893 | pr_debug("RTS DUR: %04x ", rtsdfb); | ||
5894 | print_hex_dump_bytes("PLCP:", DUMP_PREFIX_OFFSET, | ||
5895 | fragpfb, sizeof(txh->FragPLCPFallback)); | ||
5896 | pr_debug("DUR: %04x", fragdfb); | ||
5897 | pr_debug("\n"); | ||
5898 | |||
5899 | pr_debug("MModeLen: %04x ", mmodelen); | ||
5900 | pr_debug("MModeFbrLen: %04x\n", mmodefbrlen); | ||
5901 | |||
5902 | pr_debug("FrameID: %04x\n", tfid); | ||
5903 | pr_debug("TxStatus: %04x\n", txs); | ||
5904 | |||
5905 | pr_debug("MaxNumMpdu: %04x\n", mnmpdu); | ||
5906 | pr_debug("MaxAggbyte: %04x\n", mabyte); | ||
5907 | pr_debug("MaxAggbyte_fb: %04x\n", mabyte_f); | ||
5908 | pr_debug("MinByte: %04x\n", mmbyte); | ||
5909 | |||
5910 | print_hex_dump_bytes("RTS PLCP:", DUMP_PREFIX_OFFSET, | ||
5911 | rtsph, sizeof(txh->RTSPhyHeader)); | ||
5912 | print_hex_dump_bytes("RTS Frame:", DUMP_PREFIX_OFFSET, | ||
5913 | (u8 *)&rts, sizeof(txh->rts_frame)); | ||
5914 | pr_debug("\n"); | ||
5915 | } | ||
5916 | #endif /* defined(DEBUG) */ | ||
5917 | |||
5918 | #if defined(DEBUG) | ||
5919 | static int | ||
5920 | brcms_c_format_flags(const struct brcms_c_bit_desc *bd, u32 flags, char *buf, | ||
5921 | int len) | ||
5922 | { | ||
5923 | int i; | ||
5924 | char *p = buf; | ||
5925 | char hexstr[16]; | ||
5926 | int slen = 0, nlen = 0; | ||
5927 | u32 bit; | ||
5928 | const char *name; | ||
5929 | |||
5930 | if (len < 2 || !buf) | ||
5931 | return 0; | ||
5932 | |||
5933 | buf[0] = '\0'; | ||
5934 | |||
5935 | for (i = 0; flags != 0; i++) { | ||
5936 | bit = bd[i].bit; | ||
5937 | name = bd[i].name; | ||
5938 | if (bit == 0 && flags != 0) { | ||
5939 | /* print any unnamed bits */ | ||
5940 | snprintf(hexstr, 16, "0x%X", flags); | ||
5941 | name = hexstr; | ||
5942 | flags = 0; /* exit loop */ | ||
5943 | } else if ((flags & bit) == 0) | ||
5944 | continue; | ||
5945 | flags &= ~bit; | ||
5946 | nlen = strlen(name); | ||
5947 | slen += nlen; | ||
5948 | /* count btwn flag space */ | ||
5949 | if (flags != 0) | ||
5950 | slen += 1; | ||
5951 | /* need NULL char as well */ | ||
5952 | if (len <= slen) | ||
5953 | break; | ||
5954 | /* copy NULL char but don't count it */ | ||
5955 | strncpy(p, name, nlen + 1); | ||
5956 | p += nlen; | ||
5957 | /* copy btwn flag space and NULL char */ | ||
5958 | if (flags != 0) | ||
5959 | p += snprintf(p, 2, " "); | ||
5960 | len -= slen; | ||
5961 | } | ||
5962 | |||
5963 | /* indicate the str was too short */ | ||
5964 | if (flags != 0) { | ||
5965 | if (len < 2) | ||
5966 | p -= 2 - len; /* overwrite last char */ | ||
5967 | p += snprintf(p, 2, ">"); | ||
5968 | } | ||
5969 | |||
5970 | return (int)(p - buf); | ||
5971 | } | ||
5972 | #endif /* defined(DEBUG) */ | ||
5973 | |||
5974 | #if defined(DEBUG) | ||
5975 | void brcms_c_print_rxh(struct d11rxhdr *rxh) | ||
5976 | { | ||
5977 | u16 len = rxh->RxFrameSize; | ||
5978 | u16 phystatus_0 = rxh->PhyRxStatus_0; | ||
5979 | u16 phystatus_1 = rxh->PhyRxStatus_1; | ||
5980 | u16 phystatus_2 = rxh->PhyRxStatus_2; | ||
5981 | u16 phystatus_3 = rxh->PhyRxStatus_3; | ||
5982 | u16 macstatus1 = rxh->RxStatus1; | ||
5983 | u16 macstatus2 = rxh->RxStatus2; | ||
5984 | char flagstr[64]; | ||
5985 | char lenbuf[20]; | ||
5986 | static const struct brcms_c_bit_desc macstat_flags[] = { | ||
5987 | {RXS_FCSERR, "FCSErr"}, | ||
5988 | {RXS_RESPFRAMETX, "Reply"}, | ||
5989 | {RXS_PBPRES, "PADDING"}, | ||
5990 | {RXS_DECATMPT, "DeCr"}, | ||
5991 | {RXS_DECERR, "DeCrErr"}, | ||
5992 | {RXS_BCNSENT, "Bcn"}, | ||
5993 | {0, NULL} | ||
5994 | }; | ||
5995 | |||
5996 | brcmu_dbg_hex_dump(rxh, sizeof(struct d11rxhdr), "Raw RxDesc:\n"); | ||
5997 | |||
5998 | brcms_c_format_flags(macstat_flags, macstatus1, flagstr, 64); | ||
5999 | |||
6000 | snprintf(lenbuf, sizeof(lenbuf), "0x%x", len); | ||
6001 | |||
6002 | pr_debug("RxFrameSize: %6s (%d)%s\n", lenbuf, len, | ||
6003 | (rxh->PhyRxStatus_0 & PRXS0_SHORTH) ? " short preamble" : ""); | ||
6004 | pr_debug("RxPHYStatus: %04x %04x %04x %04x\n", | ||
6005 | phystatus_0, phystatus_1, phystatus_2, phystatus_3); | ||
6006 | pr_debug("RxMACStatus: %x %s\n", macstatus1, flagstr); | ||
6007 | pr_debug("RXMACaggtype: %x\n", | ||
6008 | (macstatus2 & RXS_AGGTYPE_MASK)); | ||
6009 | pr_debug("RxTSFTime: %04x\n", rxh->RxTSFTime); | ||
6010 | } | ||
6011 | #endif /* defined(DEBUG) */ | ||
6012 | |||
6013 | u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) | 5698 | u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) |
6014 | { | 5699 | { |
6015 | u16 table_ptr; | 5700 | u16 table_ptr; |
@@ -6033,86 +5718,6 @@ u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) | |||
6033 | return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2)); | 5718 | return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2)); |
6034 | } | 5719 | } |
6035 | 5720 | ||
6036 | static bool | ||
6037 | brcms_c_prec_enq_head(struct brcms_c_info *wlc, struct pktq *q, | ||
6038 | struct sk_buff *pkt, int prec, bool head) | ||
6039 | { | ||
6040 | struct sk_buff *p; | ||
6041 | int eprec = -1; /* precedence to evict from */ | ||
6042 | |||
6043 | /* Determine precedence from which to evict packet, if any */ | ||
6044 | if (pktq_pfull(q, prec)) | ||
6045 | eprec = prec; | ||
6046 | else if (pktq_full(q)) { | ||
6047 | p = brcmu_pktq_peek_tail(q, &eprec); | ||
6048 | if (eprec > prec) { | ||
6049 | wiphy_err(wlc->wiphy, "%s: Failing: eprec %d > prec %d" | ||
6050 | "\n", __func__, eprec, prec); | ||
6051 | return false; | ||
6052 | } | ||
6053 | } | ||
6054 | |||
6055 | /* Evict if needed */ | ||
6056 | if (eprec >= 0) { | ||
6057 | bool discard_oldest; | ||
6058 | |||
6059 | discard_oldest = ac_bitmap_tst(0, eprec); | ||
6060 | |||
6061 | /* Refuse newer packet unless configured to discard oldest */ | ||
6062 | if (eprec == prec && !discard_oldest) { | ||
6063 | wiphy_err(wlc->wiphy, "%s: No where to go, prec == %d" | ||
6064 | "\n", __func__, prec); | ||
6065 | return false; | ||
6066 | } | ||
6067 | |||
6068 | /* Evict packet according to discard policy */ | ||
6069 | p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) : | ||
6070 | brcmu_pktq_pdeq_tail(q, eprec); | ||
6071 | brcmu_pkt_buf_free_skb(p); | ||
6072 | } | ||
6073 | |||
6074 | /* Enqueue */ | ||
6075 | if (head) | ||
6076 | p = brcmu_pktq_penq_head(q, prec, pkt); | ||
6077 | else | ||
6078 | p = brcmu_pktq_penq(q, prec, pkt); | ||
6079 | |||
6080 | return true; | ||
6081 | } | ||
6082 | |||
6083 | /* | ||
6084 | * Attempts to queue a packet onto a multiple-precedence queue, | ||
6085 | * if necessary evicting a lower precedence packet from the queue. | ||
6086 | * | ||
6087 | * 'prec' is the precedence number that has already been mapped | ||
6088 | * from the packet priority. | ||
6089 | * | ||
6090 | * Returns true if packet consumed (queued), false if not. | ||
6091 | */ | ||
6092 | static bool brcms_c_prec_enq(struct brcms_c_info *wlc, struct pktq *q, | ||
6093 | struct sk_buff *pkt, int prec) | ||
6094 | { | ||
6095 | return brcms_c_prec_enq_head(wlc, q, pkt, prec, false); | ||
6096 | } | ||
6097 | |||
6098 | void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb, | ||
6099 | struct sk_buff *sdu, uint prec) | ||
6100 | { | ||
6101 | struct brcms_txq_info *qi = wlc->pkt_queue; /* Check me */ | ||
6102 | struct pktq *q = &qi->q; | ||
6103 | int prio; | ||
6104 | |||
6105 | prio = sdu->priority; | ||
6106 | |||
6107 | if (!brcms_c_prec_enq(wlc, q, sdu, prec)) { | ||
6108 | /* | ||
6109 | * we might hit this condtion in case | ||
6110 | * packet flooding from mac80211 stack | ||
6111 | */ | ||
6112 | brcmu_pkt_buf_free_skb(sdu); | ||
6113 | } | ||
6114 | } | ||
6115 | |||
6116 | /* | 5721 | /* |
6117 | * bcmc_fid_generate: | 5722 | * bcmc_fid_generate: |
6118 | * Generate frame ID for a BCMC packet. The frag field is not used | 5723 | * Generate frame ID for a BCMC packet. The frag field is not used |
@@ -6140,8 +5745,6 @@ brcms_c_calc_ack_time(struct brcms_c_info *wlc, u32 rspec, | |||
6140 | { | 5745 | { |
6141 | uint dur = 0; | 5746 | uint dur = 0; |
6142 | 5747 | ||
6143 | BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d\n", | ||
6144 | wlc->pub->unit, rspec, preamble_type); | ||
6145 | /* | 5748 | /* |
6146 | * Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that | 5749 | * Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that |
6147 | * is less than or equal to the rate of the immediately previous | 5750 | * is less than or equal to the rate of the immediately previous |
@@ -6159,8 +5762,6 @@ static uint | |||
6159 | brcms_c_calc_cts_time(struct brcms_c_info *wlc, u32 rspec, | 5762 | brcms_c_calc_cts_time(struct brcms_c_info *wlc, u32 rspec, |
6160 | u8 preamble_type) | 5763 | u8 preamble_type) |
6161 | { | 5764 | { |
6162 | BCMMSG(wlc->wiphy, "wl%d: ratespec 0x%x, preamble_type %d\n", | ||
6163 | wlc->pub->unit, rspec, preamble_type); | ||
6164 | return brcms_c_calc_ack_time(wlc, rspec, preamble_type); | 5765 | return brcms_c_calc_ack_time(wlc, rspec, preamble_type); |
6165 | } | 5766 | } |
6166 | 5767 | ||
@@ -6168,8 +5769,6 @@ static uint | |||
6168 | brcms_c_calc_ba_time(struct brcms_c_info *wlc, u32 rspec, | 5769 | brcms_c_calc_ba_time(struct brcms_c_info *wlc, u32 rspec, |
6169 | u8 preamble_type) | 5770 | u8 preamble_type) |
6170 | { | 5771 | { |
6171 | BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, " | ||
6172 | "preamble_type %d\n", wlc->pub->unit, rspec, preamble_type); | ||
6173 | /* | 5772 | /* |
6174 | * Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that | 5773 | * Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that |
6175 | * is less than or equal to the rate of the immediately previous | 5774 | * is less than or equal to the rate of the immediately previous |
@@ -6223,9 +5822,6 @@ brcms_c_calc_frame_len(struct brcms_c_info *wlc, u32 ratespec, | |||
6223 | uint nsyms, mac_len, Ndps, kNdps; | 5822 | uint nsyms, mac_len, Ndps, kNdps; |
6224 | uint rate = rspec2rate(ratespec); | 5823 | uint rate = rspec2rate(ratespec); |
6225 | 5824 | ||
6226 | BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d, dur %d\n", | ||
6227 | wlc->pub->unit, ratespec, preamble_type, dur); | ||
6228 | |||
6229 | if (is_mcs_rate(ratespec)) { | 5825 | if (is_mcs_rate(ratespec)) { |
6230 | uint mcs = ratespec & RSPEC_RATE_MASK; | 5826 | uint mcs = ratespec & RSPEC_RATE_MASK; |
6231 | int tot_streams = mcs_2_txstreams(mcs) + rspec_stc(ratespec); | 5827 | int tot_streams = mcs_2_txstreams(mcs) + rspec_stc(ratespec); |
@@ -6292,7 +5888,7 @@ static bool brcms_c_valid_rate(struct brcms_c_info *wlc, u32 rspec, int band, | |||
6292 | return true; | 5888 | return true; |
6293 | error: | 5889 | error: |
6294 | if (verbose) | 5890 | if (verbose) |
6295 | wiphy_err(wlc->wiphy, "wl%d: valid_rate: rate spec 0x%x " | 5891 | brcms_err(wlc->hw->d11core, "wl%d: valid_rate: rate spec 0x%x " |
6296 | "not in hw_rateset\n", wlc->pub->unit, rspec); | 5892 | "not in hw_rateset\n", wlc->pub->unit, rspec); |
6297 | 5893 | ||
6298 | return false; | 5894 | return false; |
@@ -6302,6 +5898,7 @@ static u32 | |||
6302 | mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, | 5898 | mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, |
6303 | u32 int_val) | 5899 | u32 int_val) |
6304 | { | 5900 | { |
5901 | struct bcma_device *core = wlc->hw->d11core; | ||
6305 | u8 stf = (int_val & NRATE_STF_MASK) >> NRATE_STF_SHIFT; | 5902 | u8 stf = (int_val & NRATE_STF_MASK) >> NRATE_STF_SHIFT; |
6306 | u8 rate = int_val & NRATE_RATE_MASK; | 5903 | u8 rate = int_val & NRATE_RATE_MASK; |
6307 | u32 rspec; | 5904 | u32 rspec; |
@@ -6318,7 +5915,7 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, | |||
6318 | if ((wlc->pub->_n_enab & SUPPORT_11N) && ismcs) { | 5915 | if ((wlc->pub->_n_enab & SUPPORT_11N) && ismcs) { |
6319 | /* mcs only allowed when nmode */ | 5916 | /* mcs only allowed when nmode */ |
6320 | if (stf > PHY_TXC1_MODE_SDM) { | 5917 | if (stf > PHY_TXC1_MODE_SDM) { |
6321 | wiphy_err(wlc->wiphy, "wl%d: %s: Invalid stf\n", | 5918 | brcms_err(core, "wl%d: %s: Invalid stf\n", |
6322 | wlc->pub->unit, __func__); | 5919 | wlc->pub->unit, __func__); |
6323 | bcmerror = -EINVAL; | 5920 | bcmerror = -EINVAL; |
6324 | goto done; | 5921 | goto done; |
@@ -6329,8 +5926,8 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, | |||
6329 | if (!CHSPEC_IS40(wlc->home_chanspec) || | 5926 | if (!CHSPEC_IS40(wlc->home_chanspec) || |
6330 | ((stf != PHY_TXC1_MODE_SISO) | 5927 | ((stf != PHY_TXC1_MODE_SISO) |
6331 | && (stf != PHY_TXC1_MODE_CDD))) { | 5928 | && (stf != PHY_TXC1_MODE_CDD))) { |
6332 | wiphy_err(wlc->wiphy, "wl%d: %s: Invalid mcs " | 5929 | brcms_err(core, "wl%d: %s: Invalid mcs 32\n", |
6333 | "32\n", wlc->pub->unit, __func__); | 5930 | wlc->pub->unit, __func__); |
6334 | bcmerror = -EINVAL; | 5931 | bcmerror = -EINVAL; |
6335 | goto done; | 5932 | goto done; |
6336 | } | 5933 | } |
@@ -6338,9 +5935,9 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, | |||
6338 | } else if (rate > HIGHEST_SINGLE_STREAM_MCS) { | 5935 | } else if (rate > HIGHEST_SINGLE_STREAM_MCS) { |
6339 | /* mcs > 7 must use stf SDM */ | 5936 | /* mcs > 7 must use stf SDM */ |
6340 | if (stf != PHY_TXC1_MODE_SDM) { | 5937 | if (stf != PHY_TXC1_MODE_SDM) { |
6341 | BCMMSG(wlc->wiphy, "wl%d: enabling " | 5938 | brcms_dbg_mac80211(core, "wl%d: enabling " |
6342 | "SDM mode for mcs %d\n", | 5939 | "SDM mode for mcs %d\n", |
6343 | wlc->pub->unit, rate); | 5940 | wlc->pub->unit, rate); |
6344 | stf = PHY_TXC1_MODE_SDM; | 5941 | stf = PHY_TXC1_MODE_SDM; |
6345 | } | 5942 | } |
6346 | } else { | 5943 | } else { |
@@ -6351,15 +5948,15 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, | |||
6351 | if ((stf > PHY_TXC1_MODE_STBC) || | 5948 | if ((stf > PHY_TXC1_MODE_STBC) || |
6352 | (!BRCMS_STBC_CAP_PHY(wlc) | 5949 | (!BRCMS_STBC_CAP_PHY(wlc) |
6353 | && (stf == PHY_TXC1_MODE_STBC))) { | 5950 | && (stf == PHY_TXC1_MODE_STBC))) { |
6354 | wiphy_err(wlc->wiphy, "wl%d: %s: Invalid STBC" | 5951 | brcms_err(core, "wl%d: %s: Invalid STBC\n", |
6355 | "\n", wlc->pub->unit, __func__); | 5952 | wlc->pub->unit, __func__); |
6356 | bcmerror = -EINVAL; | 5953 | bcmerror = -EINVAL; |
6357 | goto done; | 5954 | goto done; |
6358 | } | 5955 | } |
6359 | } | 5956 | } |
6360 | } else if (is_ofdm_rate(rate)) { | 5957 | } else if (is_ofdm_rate(rate)) { |
6361 | if ((stf != PHY_TXC1_MODE_CDD) && (stf != PHY_TXC1_MODE_SISO)) { | 5958 | if ((stf != PHY_TXC1_MODE_CDD) && (stf != PHY_TXC1_MODE_SISO)) { |
6362 | wiphy_err(wlc->wiphy, "wl%d: %s: Invalid OFDM\n", | 5959 | brcms_err(core, "wl%d: %s: Invalid OFDM\n", |
6363 | wlc->pub->unit, __func__); | 5960 | wlc->pub->unit, __func__); |
6364 | bcmerror = -EINVAL; | 5961 | bcmerror = -EINVAL; |
6365 | goto done; | 5962 | goto done; |
@@ -6367,20 +5964,20 @@ mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, | |||
6367 | } else if (is_cck_rate(rate)) { | 5964 | } else if (is_cck_rate(rate)) { |
6368 | if ((cur_band->bandtype != BRCM_BAND_2G) | 5965 | if ((cur_band->bandtype != BRCM_BAND_2G) |
6369 | || (stf != PHY_TXC1_MODE_SISO)) { | 5966 | || (stf != PHY_TXC1_MODE_SISO)) { |
6370 | wiphy_err(wlc->wiphy, "wl%d: %s: Invalid CCK\n", | 5967 | brcms_err(core, "wl%d: %s: Invalid CCK\n", |
6371 | wlc->pub->unit, __func__); | 5968 | wlc->pub->unit, __func__); |
6372 | bcmerror = -EINVAL; | 5969 | bcmerror = -EINVAL; |
6373 | goto done; | 5970 | goto done; |
6374 | } | 5971 | } |
6375 | } else { | 5972 | } else { |
6376 | wiphy_err(wlc->wiphy, "wl%d: %s: Unknown rate type\n", | 5973 | brcms_err(core, "wl%d: %s: Unknown rate type\n", |
6377 | wlc->pub->unit, __func__); | 5974 | wlc->pub->unit, __func__); |
6378 | bcmerror = -EINVAL; | 5975 | bcmerror = -EINVAL; |
6379 | goto done; | 5976 | goto done; |
6380 | } | 5977 | } |
6381 | /* make sure multiple antennae are available for non-siso rates */ | 5978 | /* make sure multiple antennae are available for non-siso rates */ |
6382 | if ((stf != PHY_TXC1_MODE_SISO) && (wlc->stf->txstreams == 1)) { | 5979 | if ((stf != PHY_TXC1_MODE_SISO) && (wlc->stf->txstreams == 1)) { |
6383 | wiphy_err(wlc->wiphy, "wl%d: %s: SISO antenna but !SISO " | 5980 | brcms_err(core, "wl%d: %s: SISO antenna but !SISO " |
6384 | "request\n", wlc->pub->unit, __func__); | 5981 | "request\n", wlc->pub->unit, __func__); |
6385 | bcmerror = -EINVAL; | 5982 | bcmerror = -EINVAL; |
6386 | goto done; | 5983 | goto done; |
@@ -6449,7 +6046,7 @@ static void brcms_c_cck_plcp_set(struct brcms_c_info *wlc, int rate_500, | |||
6449 | break; | 6046 | break; |
6450 | 6047 | ||
6451 | default: | 6048 | default: |
6452 | wiphy_err(wlc->wiphy, | 6049 | brcms_err(wlc->hw->d11core, |
6453 | "brcms_c_cck_plcp_set: unsupported rate %d\n", | 6050 | "brcms_c_cck_plcp_set: unsupported rate %d\n", |
6454 | rate_500); | 6051 | rate_500); |
6455 | rate_500 = BRCM_RATE_1M; | 6052 | rate_500 = BRCM_RATE_1M; |
@@ -6582,7 +6179,7 @@ static u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, u32 rspec) | |||
6582 | bw = rspec_get_bw(rspec); | 6179 | bw = rspec_get_bw(rspec); |
6583 | /* 10Mhz is not supported yet */ | 6180 | /* 10Mhz is not supported yet */ |
6584 | if (bw < PHY_TXC1_BW_20MHZ) { | 6181 | if (bw < PHY_TXC1_BW_20MHZ) { |
6585 | wiphy_err(wlc->wiphy, "phytxctl1_calc: bw %d is " | 6182 | brcms_err(wlc->hw->d11core, "phytxctl1_calc: bw %d is " |
6586 | "not supported yet, set to 20L\n", bw); | 6183 | "not supported yet, set to 20L\n", bw); |
6587 | bw = PHY_TXC1_BW_20MHZ; | 6184 | bw = PHY_TXC1_BW_20MHZ; |
6588 | } | 6185 | } |
@@ -6609,7 +6206,7 @@ static u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, u32 rspec) | |||
6609 | /* get the phyctl byte from rate phycfg table */ | 6206 | /* get the phyctl byte from rate phycfg table */ |
6610 | phycfg = brcms_c_rate_legacy_phyctl(rspec2rate(rspec)); | 6207 | phycfg = brcms_c_rate_legacy_phyctl(rspec2rate(rspec)); |
6611 | if (phycfg == -1) { | 6208 | if (phycfg == -1) { |
6612 | wiphy_err(wlc->wiphy, "phytxctl1_calc: wrong " | 6209 | brcms_err(wlc->hw->d11core, "phytxctl1_calc: wrong " |
6613 | "legacy OFDM/CCK rate\n"); | 6210 | "legacy OFDM/CCK rate\n"); |
6614 | phycfg = 0; | 6211 | phycfg = 0; |
6615 | } | 6212 | } |
@@ -6689,8 +6286,9 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, | |||
6689 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { | 6286 | if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { |
6690 | /* non-AP STA should never use BCMC queue */ | 6287 | /* non-AP STA should never use BCMC queue */ |
6691 | if (queue == TX_BCMC_FIFO) { | 6288 | if (queue == TX_BCMC_FIFO) { |
6692 | wiphy_err(wlc->wiphy, "wl%d: %s: ASSERT queue == " | 6289 | brcms_err(wlc->hw->d11core, |
6693 | "TX_BCMC!\n", wlc->pub->unit, __func__); | 6290 | "wl%d: %s: ASSERT queue == TX_BCMC!\n", |
6291 | wlc->pub->unit, __func__); | ||
6694 | frameid = bcmc_fid_generate(wlc, NULL, txh); | 6292 | frameid = bcmc_fid_generate(wlc, NULL, txh); |
6695 | } else { | 6293 | } else { |
6696 | /* Increment the counter for first fragment */ | 6294 | /* Increment the counter for first fragment */ |
@@ -6860,7 +6458,8 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, | |||
6860 | 6458 | ||
6861 | if ((txrate[k]->flags & IEEE80211_TX_RC_MCS) | 6459 | if ((txrate[k]->flags & IEEE80211_TX_RC_MCS) |
6862 | && (!is_mcs_rate(rspec[k]))) { | 6460 | && (!is_mcs_rate(rspec[k]))) { |
6863 | wiphy_err(wlc->wiphy, "wl%d: %s: IEEE80211_TX_" | 6461 | brcms_err(wlc->hw->d11core, |
6462 | "wl%d: %s: IEEE80211_TX_" | ||
6864 | "RC_MCS != is_mcs_rate(rspec)\n", | 6463 | "RC_MCS != is_mcs_rate(rspec)\n", |
6865 | wlc->pub->unit, __func__); | 6464 | wlc->pub->unit, __func__); |
6866 | } | 6465 | } |
@@ -7254,14 +6853,16 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, | |||
7254 | wlc->fragthresh[queue] = | 6853 | wlc->fragthresh[queue] = |
7255 | (u16) newfragthresh; | 6854 | (u16) newfragthresh; |
7256 | } else { | 6855 | } else { |
7257 | wiphy_err(wlc->wiphy, "wl%d: %s txop invalid " | 6856 | brcms_err(wlc->hw->d11core, |
6857 | "wl%d: %s txop invalid " | ||
7258 | "for rate %d\n", | 6858 | "for rate %d\n", |
7259 | wlc->pub->unit, fifo_names[queue], | 6859 | wlc->pub->unit, fifo_names[queue], |
7260 | rspec2rate(rspec[0])); | 6860 | rspec2rate(rspec[0])); |
7261 | } | 6861 | } |
7262 | 6862 | ||
7263 | if (dur > wlc->edcf_txop[ac]) | 6863 | if (dur > wlc->edcf_txop[ac]) |
7264 | wiphy_err(wlc->wiphy, "wl%d: %s: %s txop " | 6864 | brcms_err(wlc->hw->d11core, |
6865 | "wl%d: %s: %s txop " | ||
7265 | "exceeded phylen %d/%d dur %d/%d\n", | 6866 | "exceeded phylen %d/%d dur %d/%d\n", |
7266 | wlc->pub->unit, __func__, | 6867 | wlc->pub->unit, __func__, |
7267 | fifo_names[queue], | 6868 | fifo_names[queue], |
@@ -7273,79 +6874,33 @@ brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, | |||
7273 | return 0; | 6874 | return 0; |
7274 | } | 6875 | } |
7275 | 6876 | ||
7276 | void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, | 6877 | static int brcms_c_tx(struct brcms_c_info *wlc, struct sk_buff *skb) |
7277 | struct ieee80211_hw *hw) | ||
7278 | { | 6878 | { |
7279 | u8 prio; | 6879 | struct dma_pub *dma; |
7280 | uint fifo; | 6880 | int fifo, ret = -ENOSPC; |
7281 | struct scb *scb = &wlc->pri_scb; | 6881 | struct d11txh *txh; |
7282 | struct ieee80211_hdr *d11_header = (struct ieee80211_hdr *)(sdu->data); | 6882 | u16 frameid = INVALIDFID; |
7283 | |||
7284 | /* | ||
7285 | * 802.11 standard requires management traffic | ||
7286 | * to go at highest priority | ||
7287 | */ | ||
7288 | prio = ieee80211_is_data(d11_header->frame_control) ? sdu->priority : | ||
7289 | MAXPRIO; | ||
7290 | fifo = prio2fifo[prio]; | ||
7291 | if (brcms_c_d11hdrs_mac80211(wlc, hw, sdu, scb, 0, 1, fifo, 0)) | ||
7292 | return; | ||
7293 | brcms_c_txq_enq(wlc, scb, sdu, BRCMS_PRIO_TO_PREC(prio)); | ||
7294 | brcms_c_send_q(wlc); | ||
7295 | } | ||
7296 | |||
7297 | void brcms_c_send_q(struct brcms_c_info *wlc) | ||
7298 | { | ||
7299 | struct sk_buff *pkt[DOT11_MAXNUMFRAGS]; | ||
7300 | int prec; | ||
7301 | u16 prec_map; | ||
7302 | int err = 0, i, count; | ||
7303 | uint fifo; | ||
7304 | struct brcms_txq_info *qi = wlc->pkt_queue; | ||
7305 | struct pktq *q = &qi->q; | ||
7306 | struct ieee80211_tx_info *tx_info; | ||
7307 | |||
7308 | prec_map = wlc->tx_prec_map; | ||
7309 | 6883 | ||
7310 | /* Send all the enq'd pkts that we can. | 6884 | fifo = brcms_ac_to_fifo(skb_get_queue_mapping(skb)); |
7311 | * Dequeue packets with precedence with empty HW fifo only | 6885 | dma = wlc->hw->di[fifo]; |
7312 | */ | 6886 | txh = (struct d11txh *)(skb->data); |
7313 | while (prec_map && (pkt[0] = brcmu_pktq_mdeq(q, prec_map, &prec))) { | ||
7314 | tx_info = IEEE80211_SKB_CB(pkt[0]); | ||
7315 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { | ||
7316 | err = brcms_c_sendampdu(wlc->ampdu, qi, pkt, prec); | ||
7317 | } else { | ||
7318 | count = 1; | ||
7319 | err = brcms_c_prep_pdu(wlc, pkt[0], &fifo); | ||
7320 | if (!err) { | ||
7321 | for (i = 0; i < count; i++) | ||
7322 | brcms_c_txfifo(wlc, fifo, pkt[i], true, | ||
7323 | 1); | ||
7324 | } | ||
7325 | } | ||
7326 | 6887 | ||
7327 | if (err == -EBUSY) { | 6888 | if (dma->txavail == 0) { |
7328 | brcmu_pktq_penq_head(q, prec, pkt[0]); | 6889 | /* |
7329 | /* | 6890 | * We sometimes get a frame from mac80211 after stopping |
7330 | * If send failed due to any other reason than a | 6891 | * the queues. This only ever seems to be a single frame |
7331 | * change in HW FIFO condition, quit. Otherwise, | 6892 | * and is seems likely to be a race. TX_HEADROOM should |
7332 | * read the new prec_map! | 6893 | * ensure that we have enough space to handle these stray |
7333 | */ | 6894 | * packets, so warn if there isn't. If we're out of space |
7334 | if (prec_map == wlc->tx_prec_map) | 6895 | * in the tx ring and the tx queue isn't stopped then |
7335 | break; | 6896 | * we've really got a bug; warn loudly if that happens. |
7336 | prec_map = wlc->tx_prec_map; | 6897 | */ |
7337 | } | 6898 | brcms_warn(wlc->hw->d11core, |
6899 | "Received frame for tx with no space in DMA ring\n"); | ||
6900 | WARN_ON(!ieee80211_queue_stopped(wlc->pub->ieee_hw, | ||
6901 | skb_get_queue_mapping(skb))); | ||
6902 | return -ENOSPC; | ||
7338 | } | 6903 | } |
7339 | } | ||
7340 | |||
7341 | void | ||
7342 | brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p, | ||
7343 | bool commit, s8 txpktpend) | ||
7344 | { | ||
7345 | u16 frameid = INVALIDFID; | ||
7346 | struct d11txh *txh; | ||
7347 | |||
7348 | txh = (struct d11txh *) (p->data); | ||
7349 | 6904 | ||
7350 | /* When a BC/MC frame is being committed to the BCMC fifo | 6905 | /* When a BC/MC frame is being committed to the BCMC fifo |
7351 | * via DMA (NOT PIO), update ucode or BSS info as appropriate. | 6906 | * via DMA (NOT PIO), update ucode or BSS info as appropriate. |
@@ -7353,16 +6908,6 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p, | |||
7353 | if (fifo == TX_BCMC_FIFO) | 6908 | if (fifo == TX_BCMC_FIFO) |
7354 | frameid = le16_to_cpu(txh->TxFrameID); | 6909 | frameid = le16_to_cpu(txh->TxFrameID); |
7355 | 6910 | ||
7356 | /* | ||
7357 | * Bump up pending count for if not using rpc. If rpc is | ||
7358 | * used, this will be handled in brcms_b_txfifo() | ||
7359 | */ | ||
7360 | if (commit) { | ||
7361 | wlc->core->txpktpend[fifo] += txpktpend; | ||
7362 | BCMMSG(wlc->wiphy, "pktpend inc %d to %d\n", | ||
7363 | txpktpend, wlc->core->txpktpend[fifo]); | ||
7364 | } | ||
7365 | |||
7366 | /* Commit BCMC sequence number in the SHM frame ID location */ | 6911 | /* Commit BCMC sequence number in the SHM frame ID location */ |
7367 | if (frameid != INVALIDFID) { | 6912 | if (frameid != INVALIDFID) { |
7368 | /* | 6913 | /* |
@@ -7372,8 +6917,52 @@ brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p, | |||
7372 | brcms_b_write_shm(wlc->hw, M_BCMC_FID, frameid); | 6917 | brcms_b_write_shm(wlc->hw, M_BCMC_FID, frameid); |
7373 | } | 6918 | } |
7374 | 6919 | ||
7375 | if (dma_txfast(wlc->hw->di[fifo], p, commit) < 0) | 6920 | ret = brcms_c_txfifo(wlc, fifo, skb); |
6921 | /* | ||
6922 | * The only reason for brcms_c_txfifo to fail is because | ||
6923 | * there weren't any DMA descriptors, but we've already | ||
6924 | * checked for that. So if it does fail yell loudly. | ||
6925 | */ | ||
6926 | WARN_ON_ONCE(ret); | ||
6927 | |||
6928 | return ret; | ||
6929 | } | ||
6930 | |||
6931 | void brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, | ||
6932 | struct ieee80211_hw *hw) | ||
6933 | { | ||
6934 | uint fifo; | ||
6935 | struct scb *scb = &wlc->pri_scb; | ||
6936 | |||
6937 | fifo = brcms_ac_to_fifo(skb_get_queue_mapping(sdu)); | ||
6938 | if (brcms_c_d11hdrs_mac80211(wlc, hw, sdu, scb, 0, 1, fifo, 0)) | ||
6939 | return; | ||
6940 | if (brcms_c_tx(wlc, sdu)) | ||
6941 | dev_kfree_skb_any(sdu); | ||
6942 | } | ||
6943 | |||
6944 | int | ||
6945 | brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p) | ||
6946 | { | ||
6947 | struct dma_pub *dma = wlc->hw->di[fifo]; | ||
6948 | int ret; | ||
6949 | u16 queue; | ||
6950 | |||
6951 | ret = dma_txfast(wlc, dma, p); | ||
6952 | if (ret < 0) | ||
7376 | wiphy_err(wlc->wiphy, "txfifo: fatal, toss frames !!!\n"); | 6953 | wiphy_err(wlc->wiphy, "txfifo: fatal, toss frames !!!\n"); |
6954 | |||
6955 | /* | ||
6956 | * Stop queue if DMA ring is full. Reserve some free descriptors, | ||
6957 | * as we sometimes receive a frame from mac80211 after the queues | ||
6958 | * are stopped. | ||
6959 | */ | ||
6960 | queue = skb_get_queue_mapping(p); | ||
6961 | if (dma->txavail <= TX_HEADROOM && fifo < TX_BCMC_FIFO && | ||
6962 | !ieee80211_queue_stopped(wlc->pub->ieee_hw, queue)) | ||
6963 | ieee80211_stop_queue(wlc->pub->ieee_hw, queue); | ||
6964 | |||
6965 | return ret; | ||
7377 | } | 6966 | } |
7378 | 6967 | ||
7379 | u32 | 6968 | u32 |
@@ -7423,19 +7012,6 @@ brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec, | |||
7423 | return rts_rspec; | 7012 | return rts_rspec; |
7424 | } | 7013 | } |
7425 | 7014 | ||
7426 | void | ||
7427 | brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo, s8 txpktpend) | ||
7428 | { | ||
7429 | wlc->core->txpktpend[fifo] -= txpktpend; | ||
7430 | BCMMSG(wlc->wiphy, "pktpend dec %d to %d\n", txpktpend, | ||
7431 | wlc->core->txpktpend[fifo]); | ||
7432 | |||
7433 | /* There is more room; mark precedences related to this FIFO sendable */ | ||
7434 | wlc->tx_prec_map |= wlc->fifo2prec_map[fifo]; | ||
7435 | |||
7436 | /* figure out which bsscfg is being worked on... */ | ||
7437 | } | ||
7438 | |||
7439 | /* Update beacon listen interval in shared memory */ | 7015 | /* Update beacon listen interval in shared memory */ |
7440 | static void brcms_c_bcn_li_upd(struct brcms_c_info *wlc) | 7016 | static void brcms_c_bcn_li_upd(struct brcms_c_info *wlc) |
7441 | { | 7017 | { |
@@ -7508,7 +7084,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7508 | 7084 | ||
7509 | /* fill in TSF and flag its presence */ | 7085 | /* fill in TSF and flag its presence */ |
7510 | rx_status->mactime = brcms_c_recover_tsf64(wlc, rxh); | 7086 | rx_status->mactime = brcms_c_recover_tsf64(wlc, rxh); |
7511 | rx_status->flag |= RX_FLAG_MACTIME_MPDU; | 7087 | rx_status->flag |= RX_FLAG_MACTIME_START; |
7512 | 7088 | ||
7513 | channel = BRCMS_CHAN_CHANNEL(rxh->RxChan); | 7089 | channel = BRCMS_CHAN_CHANNEL(rxh->RxChan); |
7514 | 7090 | ||
@@ -7571,7 +7147,8 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7571 | rx_status->rate_idx = 11; | 7147 | rx_status->rate_idx = 11; |
7572 | break; | 7148 | break; |
7573 | default: | 7149 | default: |
7574 | wiphy_err(wlc->wiphy, "%s: Unknown rate\n", __func__); | 7150 | brcms_err(wlc->hw->d11core, |
7151 | "%s: Unknown rate\n", __func__); | ||
7575 | } | 7152 | } |
7576 | 7153 | ||
7577 | /* | 7154 | /* |
@@ -7590,7 +7167,7 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7590 | } else if (is_ofdm_rate(rspec)) { | 7167 | } else if (is_ofdm_rate(rspec)) { |
7591 | rx_status->flag |= RX_FLAG_SHORTPRE; | 7168 | rx_status->flag |= RX_FLAG_SHORTPRE; |
7592 | } else { | 7169 | } else { |
7593 | wiphy_err(wlc->wiphy, "%s: Unknown modulation\n", | 7170 | brcms_err(wlc->hw->d11core, "%s: Unknown modulation\n", |
7594 | __func__); | 7171 | __func__); |
7595 | } | 7172 | } |
7596 | } | 7173 | } |
@@ -7600,12 +7177,12 @@ prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7600 | 7177 | ||
7601 | if (rxh->RxStatus1 & RXS_DECERR) { | 7178 | if (rxh->RxStatus1 & RXS_DECERR) { |
7602 | rx_status->flag |= RX_FLAG_FAILED_PLCP_CRC; | 7179 | rx_status->flag |= RX_FLAG_FAILED_PLCP_CRC; |
7603 | wiphy_err(wlc->wiphy, "%s: RX_FLAG_FAILED_PLCP_CRC\n", | 7180 | brcms_err(wlc->hw->d11core, "%s: RX_FLAG_FAILED_PLCP_CRC\n", |
7604 | __func__); | 7181 | __func__); |
7605 | } | 7182 | } |
7606 | if (rxh->RxStatus1 & RXS_FCSERR) { | 7183 | if (rxh->RxStatus1 & RXS_FCSERR) { |
7607 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; | 7184 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; |
7608 | wiphy_err(wlc->wiphy, "%s: RX_FLAG_FAILED_FCS_CRC\n", | 7185 | brcms_err(wlc->hw->d11core, "%s: RX_FLAG_FAILED_FCS_CRC\n", |
7609 | __func__); | 7186 | __func__); |
7610 | } | 7187 | } |
7611 | } | 7188 | } |
@@ -7649,9 +7226,6 @@ brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, | |||
7649 | { | 7226 | { |
7650 | uint nsyms, len = 0, kNdps; | 7227 | uint nsyms, len = 0, kNdps; |
7651 | 7228 | ||
7652 | BCMMSG(wlc->wiphy, "wl%d: rate %d, len%d\n", | ||
7653 | wlc->pub->unit, rspec2rate(ratespec), mac_len); | ||
7654 | |||
7655 | if (is_mcs_rate(ratespec)) { | 7229 | if (is_mcs_rate(ratespec)) { |
7656 | uint mcs = ratespec & RSPEC_RATE_MASK; | 7230 | uint mcs = ratespec & RSPEC_RATE_MASK; |
7657 | int tot_streams = (mcs_2_txstreams(mcs) + 1) + | 7231 | int tot_streams = (mcs_2_txstreams(mcs) + 1) + |
@@ -7883,35 +7457,6 @@ void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend) | |||
7883 | brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend); | 7457 | brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend); |
7884 | } | 7458 | } |
7885 | 7459 | ||
7886 | /* prepares pdu for transmission. returns BCM error codes */ | ||
7887 | int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, uint *fifop) | ||
7888 | { | ||
7889 | uint fifo; | ||
7890 | struct d11txh *txh; | ||
7891 | struct ieee80211_hdr *h; | ||
7892 | struct scb *scb; | ||
7893 | |||
7894 | txh = (struct d11txh *) (pdu->data); | ||
7895 | h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); | ||
7896 | |||
7897 | /* get the pkt queue info. This was put at brcms_c_sendctl or | ||
7898 | * brcms_c_send for PDU */ | ||
7899 | fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK; | ||
7900 | |||
7901 | scb = NULL; | ||
7902 | |||
7903 | *fifop = fifo; | ||
7904 | |||
7905 | /* return if insufficient dma resources */ | ||
7906 | if (*wlc->core->txavail[fifo] < MAX_DMA_SEGS) { | ||
7907 | /* Mark precedences related to this FIFO, unsendable */ | ||
7908 | /* A fifo is full. Clear precedences related to that FIFO */ | ||
7909 | wlc->tx_prec_map &= ~(wlc->fifo2prec_map[fifo]); | ||
7910 | return -EBUSY; | ||
7911 | } | ||
7912 | return 0; | ||
7913 | } | ||
7914 | |||
7915 | int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, | 7460 | int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, |
7916 | uint *blocks) | 7461 | uint *blocks) |
7917 | { | 7462 | { |
@@ -7977,13 +7522,15 @@ int brcms_c_get_curband(struct brcms_c_info *wlc) | |||
7977 | void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop) | 7522 | void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop) |
7978 | { | 7523 | { |
7979 | int timeout = 20; | 7524 | int timeout = 20; |
7525 | int i; | ||
7980 | 7526 | ||
7981 | /* flush packet queue when requested */ | 7527 | /* Kick DMA to send any pending AMPDU */ |
7982 | if (drop) | 7528 | for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) |
7983 | brcmu_pktq_flush(&wlc->pkt_queue->q, false, NULL, NULL); | 7529 | if (wlc->hw->di[i]) |
7530 | dma_txflush(wlc->hw->di[i]); | ||
7984 | 7531 | ||
7985 | /* wait for queue and DMA fifos to run dry */ | 7532 | /* wait for queue and DMA fifos to run dry */ |
7986 | while (!pktq_empty(&wlc->pkt_queue->q) || brcms_txpktpendtot(wlc) > 0) { | 7533 | while (brcms_txpktpendtot(wlc) > 0) { |
7987 | brcms_msleep(wlc->wl, 1); | 7534 | brcms_msleep(wlc->wl, 1); |
7988 | 7535 | ||
7989 | if (--timeout == 0) | 7536 | if (--timeout == 0) |
@@ -8032,8 +7579,6 @@ static void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p) | |||
8032 | uint len; | 7579 | uint len; |
8033 | bool is_amsdu; | 7580 | bool is_amsdu; |
8034 | 7581 | ||
8035 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | ||
8036 | |||
8037 | /* frame starts with rxhdr */ | 7582 | /* frame starts with rxhdr */ |
8038 | rxh = (struct d11rxhdr *) (p->data); | 7583 | rxh = (struct d11rxhdr *) (p->data); |
8039 | 7584 | ||
@@ -8043,8 +7588,9 @@ static void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p) | |||
8043 | /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */ | 7588 | /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */ |
8044 | if (rxh->RxStatus1 & RXS_PBPRES) { | 7589 | if (rxh->RxStatus1 & RXS_PBPRES) { |
8045 | if (p->len < 2) { | 7590 | if (p->len < 2) { |
8046 | wiphy_err(wlc->wiphy, "wl%d: recv: rcvd runt of " | 7591 | brcms_err(wlc->hw->d11core, |
8047 | "len %d\n", wlc->pub->unit, p->len); | 7592 | "wl%d: recv: rcvd runt of len %d\n", |
7593 | wlc->pub->unit, p->len); | ||
8048 | goto toss; | 7594 | goto toss; |
8049 | } | 7595 | } |
8050 | skb_pull(p, 2); | 7596 | skb_pull(p, 2); |
@@ -8089,7 +7635,6 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) | |||
8089 | uint n = 0; | 7635 | uint n = 0; |
8090 | uint bound_limit = bound ? RXBND : -1; | 7636 | uint bound_limit = bound ? RXBND : -1; |
8091 | 7637 | ||
8092 | BCMMSG(wlc_hw->wlc->wiphy, "wl%d\n", wlc_hw->unit); | ||
8093 | skb_queue_head_init(&recv_frames); | 7638 | skb_queue_head_init(&recv_frames); |
8094 | 7639 | ||
8095 | /* gather received frames */ | 7640 | /* gather received frames */ |
@@ -8140,10 +7685,9 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) | |||
8140 | u32 macintstatus; | 7685 | u32 macintstatus; |
8141 | struct brcms_hardware *wlc_hw = wlc->hw; | 7686 | struct brcms_hardware *wlc_hw = wlc->hw; |
8142 | struct bcma_device *core = wlc_hw->d11core; | 7687 | struct bcma_device *core = wlc_hw->d11core; |
8143 | struct wiphy *wiphy = wlc->wiphy; | ||
8144 | 7688 | ||
8145 | if (brcms_deviceremoved(wlc)) { | 7689 | if (brcms_deviceremoved(wlc)) { |
8146 | wiphy_err(wiphy, "wl%d: %s: dead chip\n", wlc_hw->unit, | 7690 | brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, |
8147 | __func__); | 7691 | __func__); |
8148 | brcms_down(wlc->wl); | 7692 | brcms_down(wlc->wl); |
8149 | return false; | 7693 | return false; |
@@ -8153,8 +7697,8 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) | |||
8153 | macintstatus = wlc->macintstatus; | 7697 | macintstatus = wlc->macintstatus; |
8154 | wlc->macintstatus = 0; | 7698 | wlc->macintstatus = 0; |
8155 | 7699 | ||
8156 | BCMMSG(wlc->wiphy, "wl%d: macintstatus 0x%x\n", | 7700 | brcms_dbg_int(core, "wl%d: macintstatus 0x%x\n", |
8157 | wlc_hw->unit, macintstatus); | 7701 | wlc_hw->unit, macintstatus); |
8158 | 7702 | ||
8159 | WARN_ON(macintstatus & MI_PRQ); /* PRQ Interrupt in non-MBSS */ | 7703 | WARN_ON(macintstatus & MI_PRQ); /* PRQ Interrupt in non-MBSS */ |
8160 | 7704 | ||
@@ -8164,7 +7708,7 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) | |||
8164 | if (brcms_b_txstatus(wlc->hw, bounded, &fatal)) | 7708 | if (brcms_b_txstatus(wlc->hw, bounded, &fatal)) |
8165 | wlc->macintstatus |= MI_TFS; | 7709 | wlc->macintstatus |= MI_TFS; |
8166 | if (fatal) { | 7710 | if (fatal) { |
8167 | wiphy_err(wiphy, "MI_TFS: fatal\n"); | 7711 | brcms_err(core, "MI_TFS: fatal\n"); |
8168 | goto fatal; | 7712 | goto fatal; |
8169 | } | 7713 | } |
8170 | } | 7714 | } |
@@ -8174,7 +7718,7 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) | |||
8174 | 7718 | ||
8175 | /* ATIM window end */ | 7719 | /* ATIM window end */ |
8176 | if (macintstatus & MI_ATIMWINEND) { | 7720 | if (macintstatus & MI_ATIMWINEND) { |
8177 | BCMMSG(wlc->wiphy, "end of ATIM window\n"); | 7721 | brcms_dbg_info(core, "end of ATIM window\n"); |
8178 | bcma_set32(core, D11REGOFFS(maccommand), wlc->qvalid); | 7722 | bcma_set32(core, D11REGOFFS(maccommand), wlc->qvalid); |
8179 | wlc->qvalid = 0; | 7723 | wlc->qvalid = 0; |
8180 | } | 7724 | } |
@@ -8192,7 +7736,7 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) | |||
8192 | wlc_phy_noise_sample_intr(wlc_hw->band->pi); | 7736 | wlc_phy_noise_sample_intr(wlc_hw->band->pi); |
8193 | 7737 | ||
8194 | if (macintstatus & MI_GP0) { | 7738 | if (macintstatus & MI_GP0) { |
8195 | wiphy_err(wiphy, "wl%d: PSM microcode watchdog fired at %d " | 7739 | brcms_err(core, "wl%d: PSM microcode watchdog fired at %d " |
8196 | "(seconds). Resetting.\n", wlc_hw->unit, wlc_hw->now); | 7740 | "(seconds). Resetting.\n", wlc_hw->unit, wlc_hw->now); |
8197 | 7741 | ||
8198 | printk_once("%s : PSM Watchdog, chipid 0x%x, chiprev 0x%x\n", | 7742 | printk_once("%s : PSM Watchdog, chipid 0x%x, chiprev 0x%x\n", |
@@ -8206,15 +7750,11 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) | |||
8206 | bcma_write32(core, D11REGOFFS(gptimer), 0); | 7750 | bcma_write32(core, D11REGOFFS(gptimer), 0); |
8207 | 7751 | ||
8208 | if (macintstatus & MI_RFDISABLE) { | 7752 | if (macintstatus & MI_RFDISABLE) { |
8209 | BCMMSG(wlc->wiphy, "wl%d: BMAC Detected a change on the" | 7753 | brcms_dbg_info(core, "wl%d: BMAC Detected a change on the" |
8210 | " RF Disable Input\n", wlc_hw->unit); | 7754 | " RF Disable Input\n", wlc_hw->unit); |
8211 | brcms_rfkill_set_hw_state(wlc->wl); | 7755 | brcms_rfkill_set_hw_state(wlc->wl); |
8212 | } | 7756 | } |
8213 | 7757 | ||
8214 | /* send any enq'd tx packets. Just makes sure to jump start tx */ | ||
8215 | if (!pktq_empty(&wlc->pkt_queue->q)) | ||
8216 | brcms_c_send_q(wlc); | ||
8217 | |||
8218 | /* it isn't done and needs to be resched if macintstatus is non-zero */ | 7758 | /* it isn't done and needs to be resched if macintstatus is non-zero */ |
8219 | return wlc->macintstatus != 0; | 7759 | return wlc->macintstatus != 0; |
8220 | 7760 | ||
@@ -8229,7 +7769,7 @@ void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx) | |||
8229 | struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; | 7769 | struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; |
8230 | u16 chanspec; | 7770 | u16 chanspec; |
8231 | 7771 | ||
8232 | BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit); | 7772 | brcms_dbg_info(core, "wl%d\n", wlc->pub->unit); |
8233 | 7773 | ||
8234 | chanspec = ch20mhz_chspec(ch->hw_value); | 7774 | chanspec = ch20mhz_chspec(ch->hw_value); |
8235 | 7775 | ||
@@ -8286,9 +7826,6 @@ void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx) | |||
8286 | bcma_set16(core, D11REGOFFS(ifs_ctl), IFS_USEEDCF); | 7826 | bcma_set16(core, D11REGOFFS(ifs_ctl), IFS_USEEDCF); |
8287 | brcms_c_edcf_setparams(wlc, false); | 7827 | brcms_c_edcf_setparams(wlc, false); |
8288 | 7828 | ||
8289 | /* Init precedence maps for empty FIFOs */ | ||
8290 | brcms_c_tx_prec_map_init(wlc); | ||
8291 | |||
8292 | /* read the ucode version if we have not yet done so */ | 7829 | /* read the ucode version if we have not yet done so */ |
8293 | if (wlc->ucode_rev == 0) { | 7830 | if (wlc->ucode_rev == 0) { |
8294 | wlc->ucode_rev = | 7831 | wlc->ucode_rev = |
@@ -8303,9 +7840,6 @@ void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx) | |||
8303 | if (mute_tx) | 7840 | if (mute_tx) |
8304 | brcms_b_mute(wlc->hw, true); | 7841 | brcms_b_mute(wlc->hw, true); |
8305 | 7842 | ||
8306 | /* clear tx flow control */ | ||
8307 | brcms_c_txflowcontrol_reset(wlc); | ||
8308 | |||
8309 | /* enable the RF Disable Delay timer */ | 7843 | /* enable the RF Disable Delay timer */ |
8310 | bcma_write32(core, D11REGOFFS(rfdisabledly), RFDISABLE_DEFAULT); | 7844 | bcma_write32(core, D11REGOFFS(rfdisabledly), RFDISABLE_DEFAULT); |
8311 | 7845 | ||
@@ -8464,15 +7998,6 @@ brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit, | |||
8464 | * Complete the wlc default state initializations.. | 7998 | * Complete the wlc default state initializations.. |
8465 | */ | 7999 | */ |
8466 | 8000 | ||
8467 | /* allocate our initial queue */ | ||
8468 | wlc->pkt_queue = brcms_c_txq_alloc(wlc); | ||
8469 | if (wlc->pkt_queue == NULL) { | ||
8470 | wiphy_err(wl->wiphy, "wl%d: %s: failed to malloc tx queue\n", | ||
8471 | unit, __func__); | ||
8472 | err = 100; | ||
8473 | goto fail; | ||
8474 | } | ||
8475 | |||
8476 | wlc->bsscfg->wlc = wlc; | 8001 | wlc->bsscfg->wlc = wlc; |
8477 | 8002 | ||
8478 | wlc->mimoft = FT_HT; | 8003 | wlc->mimoft = FT_HT; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.h b/drivers/net/wireless/brcm80211/brcmsmac/main.h index 8debc74c54e1..fb447747c2c6 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h | |||
@@ -101,9 +101,6 @@ | |||
101 | 101 | ||
102 | #define DATA_BLOCK_TX_SUPR (1 << 4) | 102 | #define DATA_BLOCK_TX_SUPR (1 << 4) |
103 | 103 | ||
104 | /* 802.1D Priority to TX FIFO number for wme */ | ||
105 | extern const u8 prio2fifo[]; | ||
106 | |||
107 | /* Ucode MCTL_WAKE override bits */ | 104 | /* Ucode MCTL_WAKE override bits */ |
108 | #define BRCMS_WAKE_OVERRIDE_CLKCTL 0x01 | 105 | #define BRCMS_WAKE_OVERRIDE_CLKCTL 0x01 |
109 | #define BRCMS_WAKE_OVERRIDE_PHYREG 0x02 | 106 | #define BRCMS_WAKE_OVERRIDE_PHYREG 0x02 |
@@ -242,7 +239,6 @@ struct brcms_core { | |||
242 | 239 | ||
243 | /* fifo */ | 240 | /* fifo */ |
244 | uint *txavail[NFIFO]; /* # tx descriptors available */ | 241 | uint *txavail[NFIFO]; /* # tx descriptors available */ |
245 | s16 txpktpend[NFIFO]; /* tx admission control */ | ||
246 | 242 | ||
247 | struct macstat *macstat_snapshot; /* mac hw prev read values */ | 243 | struct macstat *macstat_snapshot; /* mac hw prev read values */ |
248 | }; | 244 | }; |
@@ -382,19 +378,6 @@ struct brcms_hardware { | |||
382 | */ | 378 | */ |
383 | }; | 379 | }; |
384 | 380 | ||
385 | /* TX Queue information | ||
386 | * | ||
387 | * Each flow of traffic out of the device has a TX Queue with independent | ||
388 | * flow control. Several interfaces may be associated with a single TX Queue | ||
389 | * if they belong to the same flow of traffic from the device. For multi-channel | ||
390 | * operation there are independent TX Queues for each channel. | ||
391 | */ | ||
392 | struct brcms_txq_info { | ||
393 | struct brcms_txq_info *next; | ||
394 | struct pktq q; | ||
395 | uint stopped; /* tx flow control bits */ | ||
396 | }; | ||
397 | |||
398 | /* | 381 | /* |
399 | * Principal common driver data structure. | 382 | * Principal common driver data structure. |
400 | * | 383 | * |
@@ -435,11 +418,8 @@ struct brcms_txq_info { | |||
435 | * WDlast: last time wlc_watchdog() was called. | 418 | * WDlast: last time wlc_watchdog() was called. |
436 | * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac. | 419 | * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac. |
437 | * wme_retries: per-AC retry limits. | 420 | * wme_retries: per-AC retry limits. |
438 | * tx_prec_map: Precedence map based on HW FIFO space. | ||
439 | * fifo2prec_map[NFIFO]: pointer to fifo2_prec map based on WME. | ||
440 | * bsscfg: set of BSS configurations, idx 0 is default and always valid. | 421 | * bsscfg: set of BSS configurations, idx 0 is default and always valid. |
441 | * cfg: the primary bsscfg (can be AP or STA). | 422 | * cfg: the primary bsscfg (can be AP or STA). |
442 | * tx_queues: common TX Queue list. | ||
443 | * modulecb: | 423 | * modulecb: |
444 | * mimoft: SIGN or 11N. | 424 | * mimoft: SIGN or 11N. |
445 | * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode. | 425 | * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode. |
@@ -469,7 +449,6 @@ struct brcms_txq_info { | |||
469 | * tempsense_lasttime; | 449 | * tempsense_lasttime; |
470 | * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM. | 450 | * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM. |
471 | * tx_duty_cycle_cck: maximum allowed duty cycle for CCK. | 451 | * tx_duty_cycle_cck: maximum allowed duty cycle for CCK. |
472 | * pkt_queue: txq for transmit packets. | ||
473 | * wiphy: | 452 | * wiphy: |
474 | * pri_scb: primary Station Control Block | 453 | * pri_scb: primary Station Control Block |
475 | */ | 454 | */ |
@@ -533,14 +512,9 @@ struct brcms_c_info { | |||
533 | u16 edcf_txop[IEEE80211_NUM_ACS]; | 512 | u16 edcf_txop[IEEE80211_NUM_ACS]; |
534 | 513 | ||
535 | u16 wme_retries[IEEE80211_NUM_ACS]; | 514 | u16 wme_retries[IEEE80211_NUM_ACS]; |
536 | u16 tx_prec_map; | ||
537 | u16 fifo2prec_map[NFIFO]; | ||
538 | 515 | ||
539 | struct brcms_bss_cfg *bsscfg; | 516 | struct brcms_bss_cfg *bsscfg; |
540 | 517 | ||
541 | /* tx queue */ | ||
542 | struct brcms_txq_info *tx_queues; | ||
543 | |||
544 | struct modulecb *modulecb; | 518 | struct modulecb *modulecb; |
545 | 519 | ||
546 | u8 mimoft; | 520 | u8 mimoft; |
@@ -585,7 +559,6 @@ struct brcms_c_info { | |||
585 | u16 tx_duty_cycle_ofdm; | 559 | u16 tx_duty_cycle_ofdm; |
586 | u16 tx_duty_cycle_cck; | 560 | u16 tx_duty_cycle_cck; |
587 | 561 | ||
588 | struct brcms_txq_info *pkt_queue; | ||
589 | struct wiphy *wiphy; | 562 | struct wiphy *wiphy; |
590 | struct scb pri_scb; | 563 | struct scb pri_scb; |
591 | }; | 564 | }; |
@@ -637,30 +610,13 @@ struct brcms_bss_cfg { | |||
637 | struct brcms_bss_info *current_bss; | 610 | struct brcms_bss_info *current_bss; |
638 | }; | 611 | }; |
639 | 612 | ||
640 | extern void brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, | 613 | extern int brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, |
641 | struct sk_buff *p, | 614 | struct sk_buff *p); |
642 | bool commit, s8 txpktpend); | ||
643 | extern void brcms_c_txfifo_complete(struct brcms_c_info *wlc, uint fifo, | ||
644 | s8 txpktpend); | ||
645 | extern void brcms_c_txq_enq(struct brcms_c_info *wlc, struct scb *scb, | ||
646 | struct sk_buff *sdu, uint prec); | ||
647 | extern void brcms_c_print_txstatus(struct tx_status *txs); | ||
648 | extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, | 615 | extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, |
649 | uint *blocks); | 616 | uint *blocks); |
650 | 617 | ||
651 | #if defined(DEBUG) | ||
652 | extern void brcms_c_print_txdesc(struct d11txh *txh); | ||
653 | #else | ||
654 | static inline void brcms_c_print_txdesc(struct d11txh *txh) | ||
655 | { | ||
656 | } | ||
657 | #endif | ||
658 | |||
659 | extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); | 618 | extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); |
660 | extern void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags); | 619 | extern void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags); |
661 | extern void brcms_c_send_q(struct brcms_c_info *wlc); | ||
662 | extern int brcms_c_prep_pdu(struct brcms_c_info *wlc, struct sk_buff *pdu, | ||
663 | uint *fifo); | ||
664 | extern u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, | 620 | extern u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, |
665 | uint mac_len); | 621 | uint mac_len); |
666 | extern u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, | 622 | extern u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pub.h b/drivers/net/wireless/brcm80211/brcmsmac/pub.h index 5855f4fd16dc..0148dec104f0 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h | |||
@@ -200,43 +200,6 @@ enum wlc_par_id { | |||
200 | /* WL11N Support */ | 200 | /* WL11N Support */ |
201 | #define AMPDU_AGG_HOST 1 | 201 | #define AMPDU_AGG_HOST 1 |
202 | 202 | ||
203 | /* pri is priority encoded in the packet. This maps the Packet priority to | ||
204 | * enqueue precedence as defined in wlc_prec_map | ||
205 | */ | ||
206 | extern const u8 wlc_prio2prec_map[]; | ||
207 | #define BRCMS_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7] | ||
208 | |||
209 | #define BRCMS_PREC_COUNT 16 /* Max precedence level implemented */ | ||
210 | |||
211 | /* Mask to describe all precedence levels */ | ||
212 | #define BRCMS_PREC_BMP_ALL MAXBITVAL(BRCMS_PREC_COUNT) | ||
213 | |||
214 | /* | ||
215 | * This maps priority to one precedence higher - Used by PS-Poll response | ||
216 | * packets to simulate enqueue-at-head operation, but still maintain the | ||
217 | * order on the queue | ||
218 | */ | ||
219 | #define BRCMS_PRIO_TO_HI_PREC(pri) min(BRCMS_PRIO_TO_PREC(pri) + 1,\ | ||
220 | BRCMS_PREC_COUNT - 1) | ||
221 | |||
222 | /* Define a bitmap of precedences comprised by each AC */ | ||
223 | #define BRCMS_PREC_BMP_AC_BE (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BE)) | \ | ||
224 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \ | ||
225 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_EE)) | \ | ||
226 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_EE))) | ||
227 | #define BRCMS_PREC_BMP_AC_BK (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_BK)) | \ | ||
228 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \ | ||
229 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NONE)) | \ | ||
230 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NONE))) | ||
231 | #define BRCMS_PREC_BMP_AC_VI (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_CL)) | \ | ||
232 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \ | ||
233 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VI)) | \ | ||
234 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VI))) | ||
235 | #define BRCMS_PREC_BMP_AC_VO (NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_VO)) | \ | ||
236 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \ | ||
237 | NBITVAL(BRCMS_PRIO_TO_PREC(PRIO_8021D_NC)) | \ | ||
238 | NBITVAL(BRCMS_PRIO_TO_HI_PREC(PRIO_8021D_NC))) | ||
239 | |||
240 | /* network protection config */ | 203 | /* network protection config */ |
241 | #define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */ | 204 | #define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */ |
242 | #define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */ | 205 | #define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */ |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/stf.c b/drivers/net/wireless/brcm80211/brcmsmac/stf.c index ed1d1aa71d2d..dd9162722495 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/stf.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/stf.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "channel.h" | 23 | #include "channel.h" |
24 | #include "main.h" | 24 | #include "main.h" |
25 | #include "stf.h" | 25 | #include "stf.h" |
26 | #include "debug.h" | ||
26 | 27 | ||
27 | #define MIN_SPATIAL_EXPANSION 0 | 28 | #define MIN_SPATIAL_EXPANSION 0 |
28 | #define MAX_SPATIAL_EXPANSION 1 | 29 | #define MAX_SPATIAL_EXPANSION 1 |
@@ -160,8 +161,8 @@ bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val) | |||
160 | static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, | 161 | static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, |
161 | u8 core_mask) | 162 | u8 core_mask) |
162 | { | 163 | { |
163 | BCMMSG(wlc->wiphy, "wl%d: Nsts %d core_mask %x\n", | 164 | brcms_dbg_ht(wlc->hw->d11core, "wl%d: Nsts %d core_mask %x\n", |
164 | wlc->pub->unit, Nsts, core_mask); | 165 | wlc->pub->unit, Nsts, core_mask); |
165 | 166 | ||
166 | if (hweight8(core_mask) > wlc->stf->txstreams) | 167 | if (hweight8(core_mask) > wlc->stf->txstreams) |
167 | core_mask = 0; | 168 | core_mask = 0; |
@@ -194,7 +195,8 @@ static int brcms_c_stf_spatial_policy_set(struct brcms_c_info *wlc, int val) | |||
194 | int i; | 195 | int i; |
195 | u8 core_mask = 0; | 196 | u8 core_mask = 0; |
196 | 197 | ||
197 | BCMMSG(wlc->wiphy, "wl%d: val %x\n", wlc->pub->unit, val); | 198 | brcms_dbg_ht(wlc->hw->d11core, "wl%d: val %x\n", wlc->pub->unit, |
199 | val); | ||
198 | 200 | ||
199 | wlc->stf->spatial_policy = (s8) val; | 201 | wlc->stf->spatial_policy = (s8) val; |
200 | for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) { | 202 | for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/types.h b/drivers/net/wireless/brcm80211/brcmsmac/types.h index e11ae83111e4..ae1f3ad40d45 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/types.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/types.h | |||
@@ -246,7 +246,7 @@ | |||
246 | 246 | ||
247 | #define BCMMSG(dev, fmt, args...) \ | 247 | #define BCMMSG(dev, fmt, args...) \ |
248 | do { \ | 248 | do { \ |
249 | if (brcm_msg_level & LOG_TRACE_VAL) \ | 249 | if (brcm_msg_level & BRCM_DL_INFO) \ |
250 | wiphy_err(dev, "%s: " fmt, __func__, ##args); \ | 250 | wiphy_err(dev, "%s: " fmt, __func__, ##args); \ |
251 | } while (0) | 251 | } while (0) |
252 | 252 | ||
@@ -281,7 +281,6 @@ struct ieee80211_tx_queue_params; | |||
281 | struct brcms_info; | 281 | struct brcms_info; |
282 | struct brcms_c_info; | 282 | struct brcms_c_info; |
283 | struct brcms_hardware; | 283 | struct brcms_hardware; |
284 | struct brcms_txq_info; | ||
285 | struct brcms_band; | 284 | struct brcms_band; |
286 | struct dma_pub; | 285 | struct dma_pub; |
287 | struct si_pub; | 286 | struct si_pub; |