Lines Matching refs:queue
22 static void tx_start(struct b43legacy_pioqueue *queue) in tx_start() argument
24 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_start()
28 static void tx_octet(struct b43legacy_pioqueue *queue, in tx_octet() argument
31 if (queue->need_workarounds) { in tx_octet()
32 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, octet); in tx_octet()
33 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_octet()
36 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_octet()
38 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, octet); in tx_octet()
63 static void tx_data(struct b43legacy_pioqueue *queue, in tx_data() argument
71 if (queue->need_workarounds) { in tx_data()
74 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, data); in tx_data()
76 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_data()
82 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, data); in tx_data()
85 tx_octet(queue, packet[octets - in tx_data()
89 static void tx_complete(struct b43legacy_pioqueue *queue, in tx_complete() argument
92 if (queue->need_workarounds) { in tx_complete()
93 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, in tx_complete()
95 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_complete()
99 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_complete()
103 static u16 generate_cookie(struct b43legacy_pioqueue *queue, in generate_cookie() argument
113 switch (queue->mmio_base) { in generate_cookie()
141 struct b43legacy_pioqueue *queue = NULL; in parse_cookie() local
146 queue = pio->queue0; in parse_cookie()
149 queue = pio->queue1; in parse_cookie()
152 queue = pio->queue2; in parse_cookie()
155 queue = pio->queue3; in parse_cookie()
163 *packet = &(queue->tx_packets_cache[packetindex]); in parse_cookie()
165 return queue; in parse_cookie()
172 static int pio_tx_write_fragment(struct b43legacy_pioqueue *queue, in pio_tx_write_fragment() argument
185 err = b43legacy_generate_txhdr(queue->dev, in pio_tx_write_fragment()
188 generate_cookie(queue, packet)); in pio_tx_write_fragment()
192 tx_start(queue); in pio_tx_write_fragment()
194 if (queue->need_workarounds) in pio_tx_write_fragment()
196 tx_data(queue, txhdr, (u8 *)skb->data, octets); in pio_tx_write_fragment()
197 tx_complete(queue, skb); in pio_tx_write_fragment()
205 struct b43legacy_pioqueue *queue = packet->queue; in free_txpacket() local
213 list_move(&packet->list, &queue->txfree); in free_txpacket()
214 queue->nr_txfree++; in free_txpacket()
219 struct b43legacy_pioqueue *queue = packet->queue; in pio_tx_packet() local
225 if (queue->tx_devq_size < octets) { in pio_tx_packet()
226 b43legacywarn(queue->dev->wl, "PIO queue too small. " in pio_tx_packet()
232 B43legacy_WARN_ON(queue->tx_devq_packets > in pio_tx_packet()
234 B43legacy_WARN_ON(queue->tx_devq_used > queue->tx_devq_size); in pio_tx_packet()
239 if (queue->tx_devq_packets == B43legacy_PIO_MAXTXDEVQPACKETS) in pio_tx_packet()
241 if (queue->tx_devq_used + octets > queue->tx_devq_size) in pio_tx_packet()
244 err = pio_tx_write_fragment(queue, skb, packet, in pio_tx_packet()
256 queue->tx_devq_packets++; in pio_tx_packet()
257 queue->tx_devq_used += octets; in pio_tx_packet()
262 list_move_tail(&packet->list, &queue->txrunning); in pio_tx_packet()
269 struct b43legacy_pioqueue *queue = from_tasklet(queue, t, txtask); in tx_tasklet() local
270 struct b43legacy_wldev *dev = queue->dev; in tx_tasklet()
277 if (queue->tx_frozen) in tx_tasklet()
279 txctl = b43legacy_pio_read(queue, B43legacy_PIO_TXCTL); in tx_tasklet()
283 list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) { in tx_tasklet()
299 static void setup_txqueues(struct b43legacy_pioqueue *queue) in setup_txqueues() argument
304 queue->nr_txfree = B43legacy_PIO_MAXTXPACKETS; in setup_txqueues()
306 packet = &(queue->tx_packets_cache[i]); in setup_txqueues()
308 packet->queue = queue; in setup_txqueues()
311 list_add(&packet->list, &queue->txfree); in setup_txqueues()
319 struct b43legacy_pioqueue *queue; in b43legacy_setup_pioqueue() local
323 queue = kzalloc(sizeof(*queue), GFP_KERNEL); in b43legacy_setup_pioqueue()
324 if (!queue) in b43legacy_setup_pioqueue()
327 queue->dev = dev; in b43legacy_setup_pioqueue()
328 queue->mmio_base = pio_mmio_base; in b43legacy_setup_pioqueue()
329 queue->need_workarounds = (dev->dev->id.revision < 3); in b43legacy_setup_pioqueue()
331 INIT_LIST_HEAD(&queue->txfree); in b43legacy_setup_pioqueue()
332 INIT_LIST_HEAD(&queue->txqueue); in b43legacy_setup_pioqueue()
333 INIT_LIST_HEAD(&queue->txrunning); in b43legacy_setup_pioqueue()
334 tasklet_setup(&queue->txtask, tx_tasklet); in b43legacy_setup_pioqueue()
340 qsize = b43legacy_read16(dev, queue->mmio_base in b43legacy_setup_pioqueue()
354 queue->tx_devq_size = qsize; in b43legacy_setup_pioqueue()
356 setup_txqueues(queue); in b43legacy_setup_pioqueue()
359 return queue; in b43legacy_setup_pioqueue()
362 kfree(queue); in b43legacy_setup_pioqueue()
363 queue = NULL; in b43legacy_setup_pioqueue()
367 static void cancel_transfers(struct b43legacy_pioqueue *queue) in cancel_transfers() argument
371 tasklet_kill(&queue->txtask); in cancel_transfers()
373 list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list) in cancel_transfers()
375 list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) in cancel_transfers()
379 static void b43legacy_destroy_pioqueue(struct b43legacy_pioqueue *queue) in b43legacy_destroy_pioqueue() argument
381 if (!queue) in b43legacy_destroy_pioqueue()
384 cancel_transfers(queue); in b43legacy_destroy_pioqueue()
385 kfree(queue); in b43legacy_destroy_pioqueue()
409 struct b43legacy_pioqueue *queue; in b43legacy_pio_init() local
412 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO1_BASE); in b43legacy_pio_init()
413 if (!queue) in b43legacy_pio_init()
415 pio->queue0 = queue; in b43legacy_pio_init()
417 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO2_BASE); in b43legacy_pio_init()
418 if (!queue) in b43legacy_pio_init()
420 pio->queue1 = queue; in b43legacy_pio_init()
422 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO3_BASE); in b43legacy_pio_init()
423 if (!queue) in b43legacy_pio_init()
425 pio->queue2 = queue; in b43legacy_pio_init()
427 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO4_BASE); in b43legacy_pio_init()
428 if (!queue) in b43legacy_pio_init()
430 pio->queue3 = queue; in b43legacy_pio_init()
455 struct b43legacy_pioqueue *queue = dev->pio.queue1; in b43legacy_pio_tx() local
458 B43legacy_WARN_ON(queue->tx_suspended); in b43legacy_pio_tx()
459 B43legacy_WARN_ON(list_empty(&queue->txfree)); in b43legacy_pio_tx()
461 packet = list_entry(queue->txfree.next, struct b43legacy_pio_txpacket, in b43legacy_pio_tx()
465 list_move_tail(&packet->list, &queue->txqueue); in b43legacy_pio_tx()
466 queue->nr_txfree--; in b43legacy_pio_tx()
467 B43legacy_WARN_ON(queue->nr_txfree >= B43legacy_PIO_MAXTXPACKETS); in b43legacy_pio_tx()
469 tasklet_schedule(&queue->txtask); in b43legacy_pio_tx()
477 struct b43legacy_pioqueue *queue; in b43legacy_pio_handle_txstatus() local
482 queue = parse_cookie(dev, status->cookie, &packet); in b43legacy_pio_handle_txstatus()
483 B43legacy_WARN_ON(!queue); in b43legacy_pio_handle_txstatus()
488 queue->tx_devq_packets--; in b43legacy_pio_handle_txstatus()
489 queue->tx_devq_used -= (packet->skb->len + in b43legacy_pio_handle_txstatus()
531 if (!list_empty(&queue->txqueue)) in b43legacy_pio_handle_txstatus()
532 tasklet_schedule(&queue->txtask); in b43legacy_pio_handle_txstatus()
535 static void pio_rx_error(struct b43legacy_pioqueue *queue, in pio_rx_error() argument
541 b43legacyerr(queue->dev->wl, "PIO RX error: %s\n", error); in pio_rx_error()
542 b43legacy_pio_write(queue, B43legacy_PIO_RXCTL, in pio_rx_error()
545 B43legacy_WARN_ON(queue->mmio_base != B43legacy_MMIO_PIO1_BASE); in pio_rx_error()
548 b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in pio_rx_error()
553 void b43legacy_pio_rx(struct b43legacy_pioqueue *queue) in b43legacy_pio_rx() argument
564 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL); in b43legacy_pio_rx()
567 b43legacy_pio_write(queue, B43legacy_PIO_RXCTL, in b43legacy_pio_rx()
571 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL); in b43legacy_pio_rx()
576 b43legacydbg(queue->dev->wl, "PIO RX timed out\n"); in b43legacy_pio_rx()
580 len = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
582 pio_rx_error(queue, 0, "len > 0x700"); in b43legacy_pio_rx()
585 if (unlikely(len == 0 && queue->mmio_base != in b43legacy_pio_rx()
587 pio_rx_error(queue, 0, "len == 0"); in b43legacy_pio_rx()
591 if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE) in b43legacy_pio_rx()
596 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
602 pio_rx_error(queue, in b43legacy_pio_rx()
603 (queue->mmio_base == B43legacy_MMIO_PIO1_BASE), in b43legacy_pio_rx()
607 if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE) { in b43legacy_pio_rx()
612 b43legacy_handle_hwtxstatus(queue->dev, hw); in b43legacy_pio_rx()
619 pio_rx_error(queue, 1, "OOM"); in b43legacy_pio_rx()
624 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
628 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
631 b43legacy_rx(queue->dev, skb, rxhdr); in b43legacy_pio_rx()
634 void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue) in b43legacy_pio_tx_suspend() argument
636 b43legacy_power_saving_ctl_bits(queue->dev, -1, 1); in b43legacy_pio_tx_suspend()
637 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in b43legacy_pio_tx_suspend()
638 b43legacy_pio_read(queue, B43legacy_PIO_TXCTL) in b43legacy_pio_tx_suspend()
642 void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue) in b43legacy_pio_tx_resume() argument
644 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in b43legacy_pio_tx_resume()
645 b43legacy_pio_read(queue, B43legacy_PIO_TXCTL) in b43legacy_pio_tx_resume()
647 b43legacy_power_saving_ctl_bits(queue->dev, -1, -1); in b43legacy_pio_tx_resume()
648 tasklet_schedule(&queue->txtask); in b43legacy_pio_tx_resume()