Lines Matching refs:queue

35 static void tx_start(struct b43legacy_pioqueue *queue)  in tx_start()  argument
37 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_start()
41 static void tx_octet(struct b43legacy_pioqueue *queue, in tx_octet() argument
44 if (queue->need_workarounds) { in tx_octet()
45 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, octet); in tx_octet()
46 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_octet()
49 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_octet()
51 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, octet); in tx_octet()
76 static void tx_data(struct b43legacy_pioqueue *queue, in tx_data() argument
84 if (queue->need_workarounds) { in tx_data()
87 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, data); in tx_data()
89 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_data()
95 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, data); in tx_data()
98 tx_octet(queue, packet[octets - in tx_data()
102 static void tx_complete(struct b43legacy_pioqueue *queue, in tx_complete() argument
105 if (queue->need_workarounds) { in tx_complete()
106 b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, in tx_complete()
108 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_complete()
112 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in tx_complete()
116 static u16 generate_cookie(struct b43legacy_pioqueue *queue, in generate_cookie() argument
126 switch (queue->mmio_base) { in generate_cookie()
154 struct b43legacy_pioqueue *queue = NULL; in parse_cookie() local
159 queue = pio->queue0; in parse_cookie()
162 queue = pio->queue1; in parse_cookie()
165 queue = pio->queue2; in parse_cookie()
168 queue = pio->queue3; in parse_cookie()
176 *packet = &(queue->tx_packets_cache[packetindex]); in parse_cookie()
178 return queue; in parse_cookie()
185 static int pio_tx_write_fragment(struct b43legacy_pioqueue *queue, in pio_tx_write_fragment() argument
198 err = b43legacy_generate_txhdr(queue->dev, in pio_tx_write_fragment()
201 generate_cookie(queue, packet)); in pio_tx_write_fragment()
205 tx_start(queue); in pio_tx_write_fragment()
207 if (queue->need_workarounds) in pio_tx_write_fragment()
209 tx_data(queue, txhdr, (u8 *)skb->data, octets); in pio_tx_write_fragment()
210 tx_complete(queue, skb); in pio_tx_write_fragment()
218 struct b43legacy_pioqueue *queue = packet->queue; in free_txpacket() local
226 list_move(&packet->list, &queue->txfree); in free_txpacket()
227 queue->nr_txfree++; in free_txpacket()
232 struct b43legacy_pioqueue *queue = packet->queue; in pio_tx_packet() local
238 if (queue->tx_devq_size < octets) { in pio_tx_packet()
239 b43legacywarn(queue->dev->wl, "PIO queue too small. " in pio_tx_packet()
245 B43legacy_WARN_ON(queue->tx_devq_packets > in pio_tx_packet()
247 B43legacy_WARN_ON(queue->tx_devq_used > queue->tx_devq_size); in pio_tx_packet()
252 if (queue->tx_devq_packets == B43legacy_PIO_MAXTXDEVQPACKETS) in pio_tx_packet()
254 if (queue->tx_devq_used + octets > queue->tx_devq_size) in pio_tx_packet()
257 err = pio_tx_write_fragment(queue, skb, packet, in pio_tx_packet()
269 queue->tx_devq_packets++; in pio_tx_packet()
270 queue->tx_devq_used += octets; in pio_tx_packet()
275 list_move_tail(&packet->list, &queue->txrunning); in pio_tx_packet()
282 struct b43legacy_pioqueue *queue = (struct b43legacy_pioqueue *)d; in tx_tasklet() local
283 struct b43legacy_wldev *dev = queue->dev; in tx_tasklet()
290 if (queue->tx_frozen) in tx_tasklet()
292 txctl = b43legacy_pio_read(queue, B43legacy_PIO_TXCTL); in tx_tasklet()
296 list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) { in tx_tasklet()
312 static void setup_txqueues(struct b43legacy_pioqueue *queue) in setup_txqueues() argument
317 queue->nr_txfree = B43legacy_PIO_MAXTXPACKETS; in setup_txqueues()
319 packet = &(queue->tx_packets_cache[i]); in setup_txqueues()
321 packet->queue = queue; in setup_txqueues()
324 list_add(&packet->list, &queue->txfree); in setup_txqueues()
332 struct b43legacy_pioqueue *queue; in b43legacy_setup_pioqueue() local
336 queue = kzalloc(sizeof(*queue), GFP_KERNEL); in b43legacy_setup_pioqueue()
337 if (!queue) in b43legacy_setup_pioqueue()
340 queue->dev = dev; in b43legacy_setup_pioqueue()
341 queue->mmio_base = pio_mmio_base; in b43legacy_setup_pioqueue()
342 queue->need_workarounds = (dev->dev->id.revision < 3); in b43legacy_setup_pioqueue()
344 INIT_LIST_HEAD(&queue->txfree); in b43legacy_setup_pioqueue()
345 INIT_LIST_HEAD(&queue->txqueue); in b43legacy_setup_pioqueue()
346 INIT_LIST_HEAD(&queue->txrunning); in b43legacy_setup_pioqueue()
347 tasklet_init(&queue->txtask, tx_tasklet, in b43legacy_setup_pioqueue()
348 (unsigned long)queue); in b43legacy_setup_pioqueue()
354 qsize = b43legacy_read16(dev, queue->mmio_base in b43legacy_setup_pioqueue()
368 queue->tx_devq_size = qsize; in b43legacy_setup_pioqueue()
370 setup_txqueues(queue); in b43legacy_setup_pioqueue()
373 return queue; in b43legacy_setup_pioqueue()
376 kfree(queue); in b43legacy_setup_pioqueue()
377 queue = NULL; in b43legacy_setup_pioqueue()
381 static void cancel_transfers(struct b43legacy_pioqueue *queue) in cancel_transfers() argument
385 tasklet_kill(&queue->txtask); in cancel_transfers()
387 list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list) in cancel_transfers()
389 list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) in cancel_transfers()
393 static void b43legacy_destroy_pioqueue(struct b43legacy_pioqueue *queue) in b43legacy_destroy_pioqueue() argument
395 if (!queue) in b43legacy_destroy_pioqueue()
398 cancel_transfers(queue); in b43legacy_destroy_pioqueue()
399 kfree(queue); in b43legacy_destroy_pioqueue()
423 struct b43legacy_pioqueue *queue; in b43legacy_pio_init() local
426 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO1_BASE); in b43legacy_pio_init()
427 if (!queue) in b43legacy_pio_init()
429 pio->queue0 = queue; in b43legacy_pio_init()
431 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO2_BASE); in b43legacy_pio_init()
432 if (!queue) in b43legacy_pio_init()
434 pio->queue1 = queue; in b43legacy_pio_init()
436 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO3_BASE); in b43legacy_pio_init()
437 if (!queue) in b43legacy_pio_init()
439 pio->queue2 = queue; in b43legacy_pio_init()
441 queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO4_BASE); in b43legacy_pio_init()
442 if (!queue) in b43legacy_pio_init()
444 pio->queue3 = queue; in b43legacy_pio_init()
469 struct b43legacy_pioqueue *queue = dev->pio.queue1; in b43legacy_pio_tx() local
472 B43legacy_WARN_ON(queue->tx_suspended); in b43legacy_pio_tx()
473 B43legacy_WARN_ON(list_empty(&queue->txfree)); in b43legacy_pio_tx()
475 packet = list_entry(queue->txfree.next, struct b43legacy_pio_txpacket, in b43legacy_pio_tx()
479 list_move_tail(&packet->list, &queue->txqueue); in b43legacy_pio_tx()
480 queue->nr_txfree--; in b43legacy_pio_tx()
481 B43legacy_WARN_ON(queue->nr_txfree >= B43legacy_PIO_MAXTXPACKETS); in b43legacy_pio_tx()
483 tasklet_schedule(&queue->txtask); in b43legacy_pio_tx()
491 struct b43legacy_pioqueue *queue; in b43legacy_pio_handle_txstatus() local
496 queue = parse_cookie(dev, status->cookie, &packet); in b43legacy_pio_handle_txstatus()
497 B43legacy_WARN_ON(!queue); in b43legacy_pio_handle_txstatus()
502 queue->tx_devq_packets--; in b43legacy_pio_handle_txstatus()
503 queue->tx_devq_used -= (packet->skb->len + in b43legacy_pio_handle_txstatus()
545 if (!list_empty(&queue->txqueue)) in b43legacy_pio_handle_txstatus()
546 tasklet_schedule(&queue->txtask); in b43legacy_pio_handle_txstatus()
549 static void pio_rx_error(struct b43legacy_pioqueue *queue, in pio_rx_error() argument
555 b43legacyerr(queue->dev->wl, "PIO RX error: %s\n", error); in pio_rx_error()
556 b43legacy_pio_write(queue, B43legacy_PIO_RXCTL, in pio_rx_error()
559 B43legacy_WARN_ON(queue->mmio_base != B43legacy_MMIO_PIO1_BASE); in pio_rx_error()
562 b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in pio_rx_error()
567 void b43legacy_pio_rx(struct b43legacy_pioqueue *queue) in b43legacy_pio_rx() argument
578 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL); in b43legacy_pio_rx()
581 b43legacy_pio_write(queue, B43legacy_PIO_RXCTL, in b43legacy_pio_rx()
585 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL); in b43legacy_pio_rx()
590 b43legacydbg(queue->dev->wl, "PIO RX timed out\n"); in b43legacy_pio_rx()
594 len = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
596 pio_rx_error(queue, 0, "len > 0x700"); in b43legacy_pio_rx()
599 if (unlikely(len == 0 && queue->mmio_base != in b43legacy_pio_rx()
601 pio_rx_error(queue, 0, "len == 0"); in b43legacy_pio_rx()
605 if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE) in b43legacy_pio_rx()
610 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
616 pio_rx_error(queue, in b43legacy_pio_rx()
617 (queue->mmio_base == B43legacy_MMIO_PIO1_BASE), in b43legacy_pio_rx()
621 if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE) { in b43legacy_pio_rx()
626 b43legacy_handle_hwtxstatus(queue->dev, hw); in b43legacy_pio_rx()
633 pio_rx_error(queue, 1, "OOM"); in b43legacy_pio_rx()
638 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
642 tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); in b43legacy_pio_rx()
645 b43legacy_rx(queue->dev, skb, rxhdr); in b43legacy_pio_rx()
648 void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue) in b43legacy_pio_tx_suspend() argument
650 b43legacy_power_saving_ctl_bits(queue->dev, -1, 1); in b43legacy_pio_tx_suspend()
651 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in b43legacy_pio_tx_suspend()
652 b43legacy_pio_read(queue, B43legacy_PIO_TXCTL) in b43legacy_pio_tx_suspend()
656 void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue) in b43legacy_pio_tx_resume() argument
658 b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, in b43legacy_pio_tx_resume()
659 b43legacy_pio_read(queue, B43legacy_PIO_TXCTL) in b43legacy_pio_tx_resume()
661 b43legacy_power_saving_ctl_bits(queue->dev, -1, -1); in b43legacy_pio_tx_resume()
662 tasklet_schedule(&queue->txtask); in b43legacy_pio_tx_resume()