Lines Matching +full:pio +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 PIO Transmission
14 #include "pio.h"
31 if (queue->need_workarounds) { in tx_octet()
55 i -= txhdr_size; in tx_get_next_word()
71 if (queue->need_workarounds) { in tx_data()
79 while (i < octets - 1) { in tx_data()
85 tx_octet(queue, packet[octets - in tx_data()
86 sizeof(struct b43legacy_txhdr_fw3) - 1]); in tx_data()
92 if (queue->need_workarounds) { in tx_complete()
94 skb->data[skb->len - 1]); in tx_complete()
109 /* We use the upper 4 bits for the PIO in generate_cookie()
113 switch (queue->mmio_base) { in generate_cookie()
140 struct b43legacy_pio *pio = &dev->pio; 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()
184 B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0); in pio_tx_write_fragment()
185 err = b43legacy_generate_txhdr(queue->dev, in pio_tx_write_fragment()
186 txhdr, skb->data, skb->len, in pio_tx_write_fragment()
193 octets = skb->len + txhdr_size; in pio_tx_write_fragment()
194 if (queue->need_workarounds) in pio_tx_write_fragment()
195 octets--; in pio_tx_write_fragment()
196 tx_data(queue, txhdr, (u8 *)skb->data, octets); in pio_tx_write_fragment()
205 struct b43legacy_pioqueue *queue = packet->queue; in free_txpacket()
207 if (packet->skb) { in free_txpacket()
209 dev_kfree_skb_irq(packet->skb); in free_txpacket()
211 dev_kfree_skb(packet->skb); in free_txpacket()
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()
220 struct sk_buff *skb = packet->skb; in pio_tx_packet()
224 octets = (u16)skb->len + sizeof(struct b43legacy_txhdr_fw3); in pio_tx_packet()
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()
240 return -EBUSY; in pio_tx_packet()
241 if (queue->tx_devq_used + octets > queue->tx_devq_size) in pio_tx_packet()
242 return -EBUSY; in pio_tx_packet()
246 if (unlikely(err == -ENOKEY)) { 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()
270 struct b43legacy_wldev *dev = queue->dev; in tx_tasklet()
276 spin_lock_irqsave(&dev->wl->irq_lock, flags); in tx_tasklet()
277 if (queue->tx_frozen) in tx_tasklet()
283 list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) { in tx_tasklet()
296 spin_unlock_irqrestore(&dev->wl->irq_lock, flags); in tx_tasklet()
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()
309 INIT_LIST_HEAD(&packet->list); in setup_txqueues()
311 list_add(&packet->list, &queue->txfree); in setup_txqueues()
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()
343 b43legacyerr(dev->wl, "This card does not support PIO " in b43legacy_setup_pioqueue()
344 "operation mode. Please use DMA mode " in b43legacy_setup_pioqueue()
345 "(module parameter pio=0).\n"); in b43legacy_setup_pioqueue()
349 b43legacyerr(dev->wl, "PIO tx device-queue too small (%u)\n", in b43legacy_setup_pioqueue()
353 qsize -= B43legacy_PIO_TXQADJUST; in b43legacy_setup_pioqueue()
354 queue->tx_devq_size = qsize; in b43legacy_setup_pioqueue()
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()
390 struct b43legacy_pio *pio; in b43legacy_pio_free() local
394 pio = &dev->pio; in b43legacy_pio_free()
396 b43legacy_destroy_pioqueue(pio->queue3); in b43legacy_pio_free()
397 pio->queue3 = NULL; in b43legacy_pio_free()
398 b43legacy_destroy_pioqueue(pio->queue2); in b43legacy_pio_free()
399 pio->queue2 = NULL; in b43legacy_pio_free()
400 b43legacy_destroy_pioqueue(pio->queue1); in b43legacy_pio_free()
401 pio->queue1 = NULL; in b43legacy_pio_free()
402 b43legacy_destroy_pioqueue(pio->queue0); in b43legacy_pio_free()
403 pio->queue0 = NULL; in b43legacy_pio_free()
408 struct b43legacy_pio *pio = &dev->pio; in b43legacy_pio_init() local
410 int err = -ENOMEM; in b43legacy_pio_init()
415 pio->queue0 = queue; in b43legacy_pio_init()
420 pio->queue1 = queue; in b43legacy_pio_init()
425 pio->queue2 = queue; in b43legacy_pio_init()
430 pio->queue3 = queue; in b43legacy_pio_init()
432 if (dev->dev->id.revision < 3) in b43legacy_pio_init()
433 dev->irq_mask |= B43legacy_IRQ_PIO_WORKAROUND; in b43legacy_pio_init()
435 b43legacydbg(dev->wl, "PIO initialized\n"); in b43legacy_pio_init()
441 b43legacy_destroy_pioqueue(pio->queue2); in b43legacy_pio_init()
442 pio->queue2 = NULL; in b43legacy_pio_init()
444 b43legacy_destroy_pioqueue(pio->queue1); in b43legacy_pio_init()
445 pio->queue1 = NULL; in b43legacy_pio_init()
447 b43legacy_destroy_pioqueue(pio->queue0); in b43legacy_pio_init()
448 pio->queue0 = NULL; in b43legacy_pio_init()
455 struct b43legacy_pioqueue *queue = dev->pio.queue1; in b43legacy_pio_tx()
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()
463 packet->skb = skb; 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()
482 queue = parse_cookie(dev, status->cookie, &packet); in b43legacy_pio_handle_txstatus()
485 if (!packet->skb) 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()
492 info = IEEE80211_SKB_CB(packet->skb); in b43legacy_pio_handle_txstatus()
497 retry_limit = info->status.rates[0].count; in b43legacy_pio_handle_txstatus()
500 if (status->acked) in b43legacy_pio_handle_txstatus()
501 info->flags |= IEEE80211_TX_STAT_ACK; in b43legacy_pio_handle_txstatus()
503 if (status->rts_count > dev->wl->hw->conf.short_frame_max_tx_count) { in b43legacy_pio_handle_txstatus()
511 info->status.rates[0].count = 0; in b43legacy_pio_handle_txstatus()
512 info->status.rates[1].count = status->frame_count; in b43legacy_pio_handle_txstatus()
514 if (status->frame_count > retry_limit) { in b43legacy_pio_handle_txstatus()
515 info->status.rates[0].count = retry_limit; in b43legacy_pio_handle_txstatus()
516 info->status.rates[1].count = status->frame_count - in b43legacy_pio_handle_txstatus()
520 info->status.rates[0].count = status->frame_count; in b43legacy_pio_handle_txstatus()
521 info->status.rates[1].idx = -1; in b43legacy_pio_handle_txstatus()
524 ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb); in b43legacy_pio_handle_txstatus()
525 packet->skb = NULL; 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()
541 b43legacyerr(queue->dev->wl, "PIO RX error: %s\n", error); in pio_rx_error()
545 B43legacy_WARN_ON(queue->mmio_base != B43legacy_MMIO_PIO1_BASE); in pio_rx_error()
576 b43legacydbg(queue->dev->wl, "PIO RX timed out\n"); in b43legacy_pio_rx()
585 if (unlikely(len == 0 && queue->mmio_base != in b43legacy_pio_rx()
591 if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE) in b43legacy_pio_rx()
600 macstat = le16_to_cpu(rxhdr->mac_status); 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()
623 for (i = 0; i < len - 1; i += 2) { in b43legacy_pio_rx()
625 *((__le16 *)(skb->data + i)) = cpu_to_le16(tmp); in b43legacy_pio_rx()
629 skb->data[len - 1] = (tmp & 0x00FF); in b43legacy_pio_rx()
631 b43legacy_rx(queue->dev, skb, rxhdr); in b43legacy_pio_rx()
636 b43legacy_power_saving_ctl_bits(queue->dev, -1, 1); in b43legacy_pio_tx_suspend()
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()
653 struct b43legacy_pio *pio; in b43legacy_pio_freeze_txqueues() local
656 pio = &dev->pio; in b43legacy_pio_freeze_txqueues()
657 pio->queue0->tx_frozen = 1; in b43legacy_pio_freeze_txqueues()
658 pio->queue1->tx_frozen = 1; in b43legacy_pio_freeze_txqueues()
659 pio->queue2->tx_frozen = 1; in b43legacy_pio_freeze_txqueues()
660 pio->queue3->tx_frozen = 1; in b43legacy_pio_freeze_txqueues()
665 struct b43legacy_pio *pio; in b43legacy_pio_thaw_txqueues() local
668 pio = &dev->pio; in b43legacy_pio_thaw_txqueues()
669 pio->queue0->tx_frozen = 0; in b43legacy_pio_thaw_txqueues()
670 pio->queue1->tx_frozen = 0; in b43legacy_pio_thaw_txqueues()
671 pio->queue2->tx_frozen = 0; in b43legacy_pio_thaw_txqueues()
672 pio->queue3->tx_frozen = 0; in b43legacy_pio_thaw_txqueues()
673 if (!list_empty(&pio->queue0->txqueue)) in b43legacy_pio_thaw_txqueues()
674 tasklet_schedule(&pio->queue0->txtask); in b43legacy_pio_thaw_txqueues()
675 if (!list_empty(&pio->queue1->txqueue)) in b43legacy_pio_thaw_txqueues()
676 tasklet_schedule(&pio->queue1->txtask); in b43legacy_pio_thaw_txqueues()
677 if (!list_empty(&pio->queue2->txqueue)) in b43legacy_pio_thaw_txqueues()
678 tasklet_schedule(&pio->queue2->txtask); in b43legacy_pio_thaw_txqueues()
679 if (!list_empty(&pio->queue3->txqueue)) in b43legacy_pio_thaw_txqueues()
680 tasklet_schedule(&pio->queue3->txtask); in b43legacy_pio_thaw_txqueues()