Lines Matching refs:q
24 static u16 generate_cookie(struct b43_pio_txqueue *q, in generate_cookie() argument
37 cookie = (((u16)q->index + 1) << 12); in generate_cookie()
49 struct b43_pio_txqueue *q = NULL; in parse_cookie() local
54 q = pio->tx_queue_AC_BK; in parse_cookie()
57 q = pio->tx_queue_AC_BE; in parse_cookie()
60 q = pio->tx_queue_AC_VI; in parse_cookie()
63 q = pio->tx_queue_AC_VO; in parse_cookie()
66 q = pio->tx_queue_mcast; in parse_cookie()
69 if (B43_WARN_ON(!q)) in parse_cookie()
72 if (B43_WARN_ON(pack_index >= ARRAY_SIZE(q->packets))) in parse_cookie()
74 *pack = &q->packets[pack_index]; in parse_cookie()
76 return q; in parse_cookie()
126 struct b43_pio_txqueue *q; in b43_setup_pioqueue_tx() local
130 q = kzalloc(sizeof(*q), GFP_KERNEL); in b43_setup_pioqueue_tx()
131 if (!q) in b43_setup_pioqueue_tx()
133 q->dev = dev; in b43_setup_pioqueue_tx()
134 q->rev = dev->dev->core_rev; in b43_setup_pioqueue_tx()
135 q->mmio_base = index_to_pioqueue_base(dev, index) + in b43_setup_pioqueue_tx()
137 q->index = index; in b43_setup_pioqueue_tx()
139 q->free_packet_slots = B43_PIO_MAX_NR_TXPACKETS; in b43_setup_pioqueue_tx()
140 if (q->rev >= 8) { in b43_setup_pioqueue_tx()
141 q->buffer_size = 1920; //FIXME this constant is wrong. in b43_setup_pioqueue_tx()
143 q->buffer_size = b43_piotx_read16(q, B43_PIO_TXQBUFSIZE); in b43_setup_pioqueue_tx()
144 q->buffer_size -= 80; in b43_setup_pioqueue_tx()
147 INIT_LIST_HEAD(&q->packets_list); in b43_setup_pioqueue_tx()
148 for (i = 0; i < ARRAY_SIZE(q->packets); i++) { in b43_setup_pioqueue_tx()
149 p = &(q->packets[i]); in b43_setup_pioqueue_tx()
152 p->queue = q; in b43_setup_pioqueue_tx()
153 list_add(&p->list, &q->packets_list); in b43_setup_pioqueue_tx()
156 return q; in b43_setup_pioqueue_tx()
162 struct b43_pio_rxqueue *q; in b43_setup_pioqueue_rx() local
164 q = kzalloc(sizeof(*q), GFP_KERNEL); in b43_setup_pioqueue_rx()
165 if (!q) in b43_setup_pioqueue_rx()
167 q->dev = dev; in b43_setup_pioqueue_rx()
168 q->rev = dev->dev->core_rev; in b43_setup_pioqueue_rx()
169 q->mmio_base = index_to_pioqueue_base(dev, index) + in b43_setup_pioqueue_rx()
175 return q; in b43_setup_pioqueue_rx()
178 static void b43_pio_cancel_tx_packets(struct b43_pio_txqueue *q) in b43_pio_cancel_tx_packets() argument
183 for (i = 0; i < ARRAY_SIZE(q->packets); i++) { in b43_pio_cancel_tx_packets()
184 pack = &(q->packets[i]); in b43_pio_cancel_tx_packets()
186 ieee80211_free_txskb(q->dev->wl->hw, pack->skb); in b43_pio_cancel_tx_packets()
192 static void b43_destroy_pioqueue_tx(struct b43_pio_txqueue *q, in b43_destroy_pioqueue_tx() argument
195 if (!q) in b43_destroy_pioqueue_tx()
197 b43_pio_cancel_tx_packets(q); in b43_destroy_pioqueue_tx()
198 kfree(q); in b43_destroy_pioqueue_tx()
201 static void b43_destroy_pioqueue_rx(struct b43_pio_rxqueue *q, in b43_destroy_pioqueue_rx() argument
204 if (!q) in b43_destroy_pioqueue_rx()
206 kfree(q); in b43_destroy_pioqueue_rx()
290 struct b43_pio_txqueue *q; in select_queue_by_priority() local
299 q = dev->pio.tx_queue_AC_VO; in select_queue_by_priority()
302 q = dev->pio.tx_queue_AC_VI; in select_queue_by_priority()
305 q = dev->pio.tx_queue_AC_BE; in select_queue_by_priority()
308 q = dev->pio.tx_queue_AC_BK; in select_queue_by_priority()
312 q = dev->pio.tx_queue_AC_BE; in select_queue_by_priority()
314 return q; in select_queue_by_priority()
317 static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q, in tx_write_2byte_queue() argument
322 struct b43_wldev *dev = q->dev; in tx_write_2byte_queue()
327 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); in tx_write_2byte_queue()
330 q->mmio_base + B43_PIO_TXDATA, in tx_write_2byte_queue()
338 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); in tx_write_2byte_queue()
342 q->mmio_base + B43_PIO_TXDATA, in tx_write_2byte_queue()
352 struct b43_pio_txqueue *q = pack->queue; in pio_tx_frame_2byte_queue() local
357 ctl = b43_piotx_read16(q, B43_PIO_TXCTL); in pio_tx_frame_2byte_queue()
362 ctl = tx_write_2byte_queue(q, ctl, hdr, hdrlen); in pio_tx_frame_2byte_queue()
364 ctl = tx_write_2byte_queue(q, ctl, frame, frame_len); in pio_tx_frame_2byte_queue()
367 b43_piotx_write16(q, B43_PIO_TXCTL, ctl); in pio_tx_frame_2byte_queue()
370 static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q, in tx_write_4byte_queue() argument
375 struct b43_wldev *dev = q->dev; in tx_write_4byte_queue()
381 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); in tx_write_4byte_queue()
384 q->mmio_base + B43_PIO8_TXDATA, in tx_write_4byte_queue()
410 b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); in tx_write_4byte_queue()
412 q->mmio_base + B43_PIO8_TXDATA, in tx_write_4byte_queue()
422 struct b43_pio_txqueue *q = pack->queue; in pio_tx_frame_4byte_queue() local
427 ctl = b43_piotx_read32(q, B43_PIO8_TXCTL); in pio_tx_frame_4byte_queue()
432 ctl = tx_write_4byte_queue(q, ctl, hdr, hdrlen); in pio_tx_frame_4byte_queue()
434 ctl = tx_write_4byte_queue(q, ctl, frame, frame_len); in pio_tx_frame_4byte_queue()
437 b43_piotx_write32(q, B43_PIO_TXCTL, ctl); in pio_tx_frame_4byte_queue()
440 static int pio_tx_frame(struct b43_pio_txqueue *q, in pio_tx_frame() argument
443 struct b43_wldev *dev = q->dev; in pio_tx_frame()
452 B43_WARN_ON(list_empty(&q->packets_list)); in pio_tx_frame()
453 pack = list_entry(q->packets_list.next, in pio_tx_frame()
456 cookie = generate_cookie(q, pack); in pio_tx_frame()
473 if (q->rev >= 8) in pio_tx_frame()
483 q->buffer_used += roundup(skb->len + hdrlen, 4); in pio_tx_frame()
484 q->free_packet_slots -= 1; in pio_tx_frame()
491 struct b43_pio_txqueue *q; in b43_pio_tx() local
501 q = dev->pio.tx_queue_mcast; in b43_pio_tx()
507 q = select_queue_by_priority(dev, skb_get_queue_mapping(skb)); in b43_pio_tx()
513 if (unlikely(total_len > q->buffer_size)) { in b43_pio_tx()
518 if (unlikely(q->free_packet_slots == 0)) { in b43_pio_tx()
523 B43_WARN_ON(q->buffer_used > q->buffer_size); in b43_pio_tx()
525 if (total_len > (q->buffer_size - q->buffer_used)) { in b43_pio_tx()
529 q->stopped = true; in b43_pio_tx()
536 q->queue_prio = skb_get_queue_mapping(skb); in b43_pio_tx()
538 err = pio_tx_frame(q, skb); in b43_pio_tx()
551 B43_WARN_ON(q->buffer_used > q->buffer_size); in b43_pio_tx()
552 if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) || in b43_pio_tx()
553 (q->free_packet_slots == 0)) { in b43_pio_tx()
556 q->stopped = true; in b43_pio_tx()
566 struct b43_pio_txqueue *q; in b43_pio_handle_txstatus() local
571 q = parse_cookie(dev, status->cookie, &pack); in b43_pio_handle_txstatus()
572 if (unlikely(!q)) in b43_pio_handle_txstatus()
582 q->buffer_used -= total_len; in b43_pio_handle_txstatus()
583 q->free_packet_slots += 1; in b43_pio_handle_txstatus()
587 list_add(&pack->list, &q->packets_list); in b43_pio_handle_txstatus()
589 if (q->stopped) { in b43_pio_handle_txstatus()
590 ieee80211_wake_queue(dev->wl->hw, q->queue_prio); in b43_pio_handle_txstatus()
591 q->stopped = false; in b43_pio_handle_txstatus()
596 static bool pio_rx_frame(struct b43_pio_rxqueue *q) in pio_rx_frame() argument
598 struct b43_wldev *dev = q->dev; in pio_rx_frame()
622 if (q->rev >= 8) { in pio_rx_frame()
625 ctl = b43_piorx_read32(q, B43_PIO8_RXCTL); in pio_rx_frame()
628 b43_piorx_write32(q, B43_PIO8_RXCTL, in pio_rx_frame()
631 ctl = b43_piorx_read32(q, B43_PIO8_RXCTL); in pio_rx_frame()
639 ctl = b43_piorx_read16(q, B43_PIO_RXCTL); in pio_rx_frame()
642 b43_piorx_write16(q, B43_PIO_RXCTL, in pio_rx_frame()
645 ctl = b43_piorx_read16(q, B43_PIO_RXCTL); in pio_rx_frame()
651 b43dbg(q->dev->wl, "PIO RX timed out\n"); in pio_rx_frame()
656 if (q->rev >= 8) { in pio_rx_frame()
658 q->mmio_base + B43_PIO8_RXDATA, in pio_rx_frame()
662 q->mmio_base + B43_PIO_RXDATA, in pio_rx_frame()
686 if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) { in pio_rx_frame()
704 if (q->rev >= 8) { in pio_rx_frame()
706 q->mmio_base + B43_PIO8_RXDATA, in pio_rx_frame()
714 q->mmio_base + B43_PIO8_RXDATA, in pio_rx_frame()
733 q->mmio_base + B43_PIO_RXDATA, in pio_rx_frame()
741 q->mmio_base + B43_PIO_RXDATA, in pio_rx_frame()
747 b43_rx(q->dev, skb, rxhdr); in pio_rx_frame()
753 b43dbg(q->dev->wl, "PIO RX error: %s\n", err_msg); in pio_rx_frame()
754 if (q->rev >= 8) in pio_rx_frame()
755 b43_piorx_write32(q, B43_PIO8_RXCTL, B43_PIO8_RXCTL_DATARDY); in pio_rx_frame()
757 b43_piorx_write16(q, B43_PIO_RXCTL, B43_PIO_RXCTL_DATARDY); in pio_rx_frame()
762 void b43_pio_rx(struct b43_pio_rxqueue *q) in b43_pio_rx() argument
768 stop = !pio_rx_frame(q); in b43_pio_rx()
777 static void b43_pio_tx_suspend_queue(struct b43_pio_txqueue *q) in b43_pio_tx_suspend_queue() argument
779 if (q->rev >= 8) { in b43_pio_tx_suspend_queue()
780 b43_piotx_write32(q, B43_PIO8_TXCTL, in b43_pio_tx_suspend_queue()
781 b43_piotx_read32(q, B43_PIO8_TXCTL) in b43_pio_tx_suspend_queue()
784 b43_piotx_write16(q, B43_PIO_TXCTL, in b43_pio_tx_suspend_queue()
785 b43_piotx_read16(q, B43_PIO_TXCTL) in b43_pio_tx_suspend_queue()
790 static void b43_pio_tx_resume_queue(struct b43_pio_txqueue *q) in b43_pio_tx_resume_queue() argument
792 if (q->rev >= 8) { in b43_pio_tx_resume_queue()
793 b43_piotx_write32(q, B43_PIO8_TXCTL, in b43_pio_tx_resume_queue()
794 b43_piotx_read32(q, B43_PIO8_TXCTL) in b43_pio_tx_resume_queue()
797 b43_piotx_write16(q, B43_PIO_TXCTL, in b43_pio_tx_resume_queue()
798 b43_piotx_read16(q, B43_PIO_TXCTL) in b43_pio_tx_resume_queue()