Lines Matching refs:ring

32 struct b43legacy_dmadesc32 *op32_idx2desc(struct b43legacy_dmaring *ring,  in op32_idx2desc()  argument
38 *meta = &(ring->meta[slot]); in op32_idx2desc()
39 desc = ring->descbase; in op32_idx2desc()
45 static void op32_fill_descriptor(struct b43legacy_dmaring *ring, in op32_fill_descriptor() argument
50 struct b43legacy_dmadesc32 *descbase = ring->descbase; in op32_fill_descriptor()
57 B43legacy_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); in op32_fill_descriptor()
62 addr |= ring->dev->dma.translation; in op32_fill_descriptor()
63 ctl = (bufsize - ring->frameoffset) in op32_fill_descriptor()
65 if (slot == ring->nr_slots - 1) in op32_fill_descriptor()
80 static void op32_poke_tx(struct b43legacy_dmaring *ring, int slot) in op32_poke_tx() argument
82 b43legacy_dma_write(ring, B43legacy_DMA32_TXINDEX, in op32_poke_tx()
86 static void op32_tx_suspend(struct b43legacy_dmaring *ring) in op32_tx_suspend() argument
88 b43legacy_dma_write(ring, B43legacy_DMA32_TXCTL, in op32_tx_suspend()
89 b43legacy_dma_read(ring, B43legacy_DMA32_TXCTL) in op32_tx_suspend()
93 static void op32_tx_resume(struct b43legacy_dmaring *ring) in op32_tx_resume() argument
95 b43legacy_dma_write(ring, B43legacy_DMA32_TXCTL, in op32_tx_resume()
96 b43legacy_dma_read(ring, B43legacy_DMA32_TXCTL) in op32_tx_resume()
100 static int op32_get_current_rxslot(struct b43legacy_dmaring *ring) in op32_get_current_rxslot() argument
104 val = b43legacy_dma_read(ring, B43legacy_DMA32_RXSTATUS); in op32_get_current_rxslot()
110 static void op32_set_current_rxslot(struct b43legacy_dmaring *ring, in op32_set_current_rxslot() argument
113 b43legacy_dma_write(ring, B43legacy_DMA32_RXINDEX, in op32_set_current_rxslot()
117 static inline int free_slots(struct b43legacy_dmaring *ring) in free_slots() argument
119 return (ring->nr_slots - ring->used_slots); in free_slots()
122 static inline int next_slot(struct b43legacy_dmaring *ring, int slot) in next_slot() argument
124 B43legacy_WARN_ON(!(slot >= -1 && slot <= ring->nr_slots - 1)); in next_slot()
125 if (slot == ring->nr_slots - 1) in next_slot()
131 static void update_max_used_slots(struct b43legacy_dmaring *ring, in update_max_used_slots() argument
134 if (current_used_slots <= ring->max_used_slots) in update_max_used_slots()
136 ring->max_used_slots = current_used_slots; in update_max_used_slots()
137 if (b43legacy_debug(ring->dev, B43legacy_DBG_DMAVERBOSE)) in update_max_used_slots()
138 b43legacydbg(ring->dev->wl, in update_max_used_slots()
140 ring->max_used_slots, in update_max_used_slots()
141 ring->tx ? "TX" : "RX", in update_max_used_slots()
142 ring->index); in update_max_used_slots()
146 void update_max_used_slots(struct b43legacy_dmaring *ring, in update_max_used_slots() argument
153 int request_slot(struct b43legacy_dmaring *ring) in request_slot() argument
157 B43legacy_WARN_ON(!ring->tx); in request_slot()
158 B43legacy_WARN_ON(ring->stopped); in request_slot()
159 B43legacy_WARN_ON(free_slots(ring) == 0); in request_slot()
161 slot = next_slot(ring, ring->current_slot); in request_slot()
162 ring->current_slot = slot; in request_slot()
163 ring->used_slots++; in request_slot()
165 update_max_used_slots(ring, ring->used_slots); in request_slot()
175 struct b43legacy_dmaring *ring; in priority_to_txring() local
186 ring = dev->dma.tx_ring3; in priority_to_txring()
189 ring = dev->dma.tx_ring2; in priority_to_txring()
192 ring = dev->dma.tx_ring1; in priority_to_txring()
195 ring = dev->dma.tx_ring0; in priority_to_txring()
198 ring = dev->dma.tx_ring4; in priority_to_txring()
201 ring = dev->dma.tx_ring5; in priority_to_txring()
205 return ring; in priority_to_txring()
226 dma_addr_t map_descbuffer(struct b43legacy_dmaring *ring, in map_descbuffer() argument
234 dmaaddr = dma_map_single(ring->dev->dev->dma_dev, in map_descbuffer()
238 dmaaddr = dma_map_single(ring->dev->dev->dma_dev, in map_descbuffer()
246 void unmap_descbuffer(struct b43legacy_dmaring *ring, in unmap_descbuffer() argument
252 dma_unmap_single(ring->dev->dev->dma_dev, in unmap_descbuffer()
256 dma_unmap_single(ring->dev->dev->dma_dev, in unmap_descbuffer()
262 void sync_descbuffer_for_cpu(struct b43legacy_dmaring *ring, in sync_descbuffer_for_cpu() argument
266 B43legacy_WARN_ON(ring->tx); in sync_descbuffer_for_cpu()
268 dma_sync_single_for_cpu(ring->dev->dev->dma_dev, in sync_descbuffer_for_cpu()
273 void sync_descbuffer_for_device(struct b43legacy_dmaring *ring, in sync_descbuffer_for_device() argument
277 B43legacy_WARN_ON(ring->tx); in sync_descbuffer_for_device()
279 dma_sync_single_for_device(ring->dev->dev->dma_dev, in sync_descbuffer_for_device()
284 void free_descriptor_buffer(struct b43legacy_dmaring *ring, in free_descriptor_buffer() argument
297 static int alloc_ringmemory(struct b43legacy_dmaring *ring) in alloc_ringmemory() argument
300 ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, in alloc_ringmemory()
302 &(ring->dmabase), GFP_KERNEL); in alloc_ringmemory()
303 if (!ring->descbase) in alloc_ringmemory()
309 static void free_ringmemory(struct b43legacy_dmaring *ring) in free_ringmemory() argument
311 dma_free_coherent(ring->dev->dev->dma_dev, B43legacy_DMA_RINGMEMSIZE, in free_ringmemory()
312 ring->descbase, ring->dmabase); in free_ringmemory()
390 static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring, in b43legacy_dma_mapping_error() argument
395 if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr))) in b43legacy_dma_mapping_error()
398 switch (ring->type) { in b43legacy_dma_mapping_error()
414 unmap_descbuffer(ring, addr, buffersize, dma_to_device); in b43legacy_dma_mapping_error()
419 static int setup_rx_descbuffer(struct b43legacy_dmaring *ring, in setup_rx_descbuffer() argument
429 B43legacy_WARN_ON(ring->tx); in setup_rx_descbuffer()
431 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); in setup_rx_descbuffer()
434 dmaaddr = map_descbuffer(ring, skb->data, in setup_rx_descbuffer()
435 ring->rx_buffersize, 0); in setup_rx_descbuffer()
436 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { in setup_rx_descbuffer()
442 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); in setup_rx_descbuffer()
445 dmaaddr = map_descbuffer(ring, skb->data, in setup_rx_descbuffer()
446 ring->rx_buffersize, 0); in setup_rx_descbuffer()
449 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { in setup_rx_descbuffer()
456 op32_fill_descriptor(ring, desc, dmaaddr, ring->rx_buffersize, 0, 0, 0); in setup_rx_descbuffer()
469 static int alloc_initial_descbuffers(struct b43legacy_dmaring *ring) in alloc_initial_descbuffers() argument
476 for (i = 0; i < ring->nr_slots; i++) { in alloc_initial_descbuffers()
477 desc = op32_idx2desc(ring, i, &meta); in alloc_initial_descbuffers()
479 err = setup_rx_descbuffer(ring, desc, meta, GFP_KERNEL); in alloc_initial_descbuffers()
481 b43legacyerr(ring->dev->wl, in alloc_initial_descbuffers()
487 ring->used_slots = ring->nr_slots; in alloc_initial_descbuffers()
494 desc = op32_idx2desc(ring, i, &meta); in alloc_initial_descbuffers()
496 unmap_descbuffer(ring, meta->dmaaddr, ring->rx_buffersize, 0); in alloc_initial_descbuffers()
506 static int dmacontroller_setup(struct b43legacy_dmaring *ring) in dmacontroller_setup() argument
511 u32 trans = ring->dev->dma.translation; in dmacontroller_setup()
512 u32 ringbase = (u32)(ring->dmabase); in dmacontroller_setup()
514 if (ring->tx) { in dmacontroller_setup()
520 b43legacy_dma_write(ring, B43legacy_DMA32_TXCTL, value); in dmacontroller_setup()
521 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, in dmacontroller_setup()
525 err = alloc_initial_descbuffers(ring); in dmacontroller_setup()
531 value = (ring->frameoffset << in dmacontroller_setup()
536 b43legacy_dma_write(ring, B43legacy_DMA32_RXCTL, value); in dmacontroller_setup()
537 b43legacy_dma_write(ring, B43legacy_DMA32_RXRING, in dmacontroller_setup()
540 b43legacy_dma_write(ring, B43legacy_DMA32_RXINDEX, 200); in dmacontroller_setup()
548 static void dmacontroller_cleanup(struct b43legacy_dmaring *ring) in dmacontroller_cleanup() argument
550 if (ring->tx) { in dmacontroller_cleanup()
551 b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base, in dmacontroller_cleanup()
552 ring->type); in dmacontroller_cleanup()
553 b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0); in dmacontroller_cleanup()
555 b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base, in dmacontroller_cleanup()
556 ring->type); in dmacontroller_cleanup()
557 b43legacy_dma_write(ring, B43legacy_DMA32_RXRING, 0); in dmacontroller_cleanup()
561 static void free_all_descbuffers(struct b43legacy_dmaring *ring) in free_all_descbuffers() argument
566 if (!ring->used_slots) in free_all_descbuffers()
568 for (i = 0; i < ring->nr_slots; i++) { in free_all_descbuffers()
569 op32_idx2desc(ring, i, &meta); in free_all_descbuffers()
572 B43legacy_WARN_ON(!ring->tx); in free_all_descbuffers()
575 if (ring->tx) in free_all_descbuffers()
576 unmap_descbuffer(ring, meta->dmaaddr, in free_all_descbuffers()
579 unmap_descbuffer(ring, meta->dmaaddr, in free_all_descbuffers()
580 ring->rx_buffersize, 0); in free_all_descbuffers()
581 free_descriptor_buffer(ring, meta, 0); in free_all_descbuffers()
608 struct b43legacy_dmaring *ring; in b43legacy_setup_dmaring() local
613 ring = kzalloc(sizeof(*ring), GFP_KERNEL); in b43legacy_setup_dmaring()
614 if (!ring) in b43legacy_setup_dmaring()
616 ring->type = type; in b43legacy_setup_dmaring()
617 ring->dev = dev; in b43legacy_setup_dmaring()
623 ring->meta = kcalloc(nr_slots, sizeof(struct b43legacy_dmadesc_meta), in b43legacy_setup_dmaring()
625 if (!ring->meta) in b43legacy_setup_dmaring()
628 ring->txhdr_cache = kcalloc(nr_slots, in b43legacy_setup_dmaring()
631 if (!ring->txhdr_cache) in b43legacy_setup_dmaring()
635 dma_test = dma_map_single(dev->dev->dma_dev, ring->txhdr_cache, in b43legacy_setup_dmaring()
639 if (b43legacy_dma_mapping_error(ring, dma_test, in b43legacy_setup_dmaring()
642 kfree(ring->txhdr_cache); in b43legacy_setup_dmaring()
643 ring->txhdr_cache = kcalloc(nr_slots, in b43legacy_setup_dmaring()
646 if (!ring->txhdr_cache) in b43legacy_setup_dmaring()
650 ring->txhdr_cache, in b43legacy_setup_dmaring()
654 if (b43legacy_dma_mapping_error(ring, dma_test, in b43legacy_setup_dmaring()
664 ring->nr_slots = nr_slots; in b43legacy_setup_dmaring()
665 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index); in b43legacy_setup_dmaring()
666 ring->index = controller_index; in b43legacy_setup_dmaring()
668 ring->tx = true; in b43legacy_setup_dmaring()
669 ring->current_slot = -1; in b43legacy_setup_dmaring()
671 if (ring->index == 0) { in b43legacy_setup_dmaring()
672 ring->rx_buffersize = B43legacy_DMA0_RX_BUFFERSIZE; in b43legacy_setup_dmaring()
673 ring->frameoffset = B43legacy_DMA0_RX_FRAMEOFFSET; in b43legacy_setup_dmaring()
674 } else if (ring->index == 3) { in b43legacy_setup_dmaring()
675 ring->rx_buffersize = B43legacy_DMA3_RX_BUFFERSIZE; in b43legacy_setup_dmaring()
676 ring->frameoffset = B43legacy_DMA3_RX_FRAMEOFFSET; in b43legacy_setup_dmaring()
681 ring->last_injected_overflow = jiffies; in b43legacy_setup_dmaring()
684 err = alloc_ringmemory(ring); in b43legacy_setup_dmaring()
687 err = dmacontroller_setup(ring); in b43legacy_setup_dmaring()
692 return ring; in b43legacy_setup_dmaring()
695 free_ringmemory(ring); in b43legacy_setup_dmaring()
697 kfree(ring->txhdr_cache); in b43legacy_setup_dmaring()
699 kfree(ring->meta); in b43legacy_setup_dmaring()
701 kfree(ring); in b43legacy_setup_dmaring()
702 ring = NULL; in b43legacy_setup_dmaring()
707 static void b43legacy_destroy_dmaring(struct b43legacy_dmaring *ring) in b43legacy_destroy_dmaring() argument
709 if (!ring) in b43legacy_destroy_dmaring()
712 b43legacydbg(ring->dev->wl, "DMA-%u 0x%04X (%s) max used slots:" in b43legacy_destroy_dmaring()
713 " %d/%d\n", (unsigned int)(ring->type), ring->mmio_base, in b43legacy_destroy_dmaring()
714 (ring->tx) ? "TX" : "RX", ring->max_used_slots, in b43legacy_destroy_dmaring()
715 ring->nr_slots); in b43legacy_destroy_dmaring()
719 dmacontroller_cleanup(ring); in b43legacy_destroy_dmaring()
720 free_all_descbuffers(ring); in b43legacy_destroy_dmaring()
721 free_ringmemory(ring); in b43legacy_destroy_dmaring()
723 kfree(ring->txhdr_cache); in b43legacy_destroy_dmaring()
724 kfree(ring->meta); in b43legacy_destroy_dmaring()
725 kfree(ring); in b43legacy_destroy_dmaring()
758 struct b43legacy_dmaring *ring; in b43legacy_dma_init() local
779 ring = b43legacy_setup_dmaring(dev, 0, 1, type); in b43legacy_dma_init()
780 if (!ring) in b43legacy_dma_init()
782 dma->tx_ring0 = ring; in b43legacy_dma_init()
784 ring = b43legacy_setup_dmaring(dev, 1, 1, type); in b43legacy_dma_init()
785 if (!ring) in b43legacy_dma_init()
787 dma->tx_ring1 = ring; in b43legacy_dma_init()
789 ring = b43legacy_setup_dmaring(dev, 2, 1, type); in b43legacy_dma_init()
790 if (!ring) in b43legacy_dma_init()
792 dma->tx_ring2 = ring; in b43legacy_dma_init()
794 ring = b43legacy_setup_dmaring(dev, 3, 1, type); in b43legacy_dma_init()
795 if (!ring) in b43legacy_dma_init()
797 dma->tx_ring3 = ring; in b43legacy_dma_init()
799 ring = b43legacy_setup_dmaring(dev, 4, 1, type); in b43legacy_dma_init()
800 if (!ring) in b43legacy_dma_init()
802 dma->tx_ring4 = ring; in b43legacy_dma_init()
804 ring = b43legacy_setup_dmaring(dev, 5, 1, type); in b43legacy_dma_init()
805 if (!ring) in b43legacy_dma_init()
807 dma->tx_ring5 = ring; in b43legacy_dma_init()
810 ring = b43legacy_setup_dmaring(dev, 0, 0, type); in b43legacy_dma_init()
811 if (!ring) in b43legacy_dma_init()
813 dma->rx_ring0 = ring; in b43legacy_dma_init()
816 ring = b43legacy_setup_dmaring(dev, 3, 0, type); in b43legacy_dma_init()
817 if (!ring) in b43legacy_dma_init()
819 dma->rx_ring3 = ring; in b43legacy_dma_init()
852 static u16 generate_cookie(struct b43legacy_dmaring *ring, in generate_cookie() argument
863 switch (ring->index) { in generate_cookie()
895 struct b43legacy_dmaring *ring = NULL; in parse_cookie() local
899 ring = dma->tx_ring0; in parse_cookie()
902 ring = dma->tx_ring1; in parse_cookie()
905 ring = dma->tx_ring2; in parse_cookie()
908 ring = dma->tx_ring3; in parse_cookie()
911 ring = dma->tx_ring4; in parse_cookie()
914 ring = dma->tx_ring5; in parse_cookie()
920 B43legacy_WARN_ON(!(ring && *slot >= 0 && *slot < ring->nr_slots)); in parse_cookie()
922 return ring; in parse_cookie()
925 static int dma_tx_fragment(struct b43legacy_dmaring *ring, in dma_tx_fragment() argument
941 old_top_slot = ring->current_slot; in dma_tx_fragment()
942 old_used_slots = ring->used_slots; in dma_tx_fragment()
945 slot = request_slot(ring); in dma_tx_fragment()
946 desc = op32_idx2desc(ring, slot, &meta_hdr); in dma_tx_fragment()
949 header = &(ring->txhdr_cache[slot * sizeof( in dma_tx_fragment()
951 err = b43legacy_generate_txhdr(ring->dev, header, in dma_tx_fragment()
953 generate_cookie(ring, slot)); in dma_tx_fragment()
955 ring->current_slot = old_top_slot; in dma_tx_fragment()
956 ring->used_slots = old_used_slots; in dma_tx_fragment()
960 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, in dma_tx_fragment()
962 if (b43legacy_dma_mapping_error(ring, meta_hdr->dmaaddr, in dma_tx_fragment()
964 ring->current_slot = old_top_slot; in dma_tx_fragment()
965 ring->used_slots = old_used_slots; in dma_tx_fragment()
968 op32_fill_descriptor(ring, desc, meta_hdr->dmaaddr, in dma_tx_fragment()
972 slot = request_slot(ring); in dma_tx_fragment()
973 desc = op32_idx2desc(ring, slot, &meta); in dma_tx_fragment()
979 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); in dma_tx_fragment()
981 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { in dma_tx_fragment()
984 ring->current_slot = old_top_slot; in dma_tx_fragment()
985 ring->used_slots = old_used_slots; in dma_tx_fragment()
1000 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); in dma_tx_fragment()
1001 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { in dma_tx_fragment()
1002 ring->current_slot = old_top_slot; in dma_tx_fragment()
1003 ring->used_slots = old_used_slots; in dma_tx_fragment()
1009 op32_fill_descriptor(ring, desc, meta->dmaaddr, in dma_tx_fragment()
1014 op32_poke_tx(ring, next_slot(ring, slot)); in dma_tx_fragment()
1020 unmap_descbuffer(ring, meta_hdr->dmaaddr, in dma_tx_fragment()
1026 int should_inject_overflow(struct b43legacy_dmaring *ring) in should_inject_overflow() argument
1029 if (unlikely(b43legacy_debug(ring->dev, in should_inject_overflow()
1035 next_overflow = ring->last_injected_overflow + HZ; in should_inject_overflow()
1037 ring->last_injected_overflow = jiffies; in should_inject_overflow()
1038 b43legacydbg(ring->dev->wl, in should_inject_overflow()
1040 "DMA controller %d\n", ring->index); in should_inject_overflow()
1051 struct b43legacy_dmaring *ring; in b43legacy_dma_tx() local
1054 ring = priority_to_txring(dev, skb_get_queue_mapping(skb)); in b43legacy_dma_tx()
1055 B43legacy_WARN_ON(!ring->tx); in b43legacy_dma_tx()
1057 if (unlikely(ring->stopped)) { in b43legacy_dma_tx()
1067 if (WARN_ON(free_slots(ring) < SLOTS_PER_PACKET)) { in b43legacy_dma_tx()
1076 err = dma_tx_fragment(ring, &skb); in b43legacy_dma_tx()
1087 if ((free_slots(ring) < SLOTS_PER_PACKET) || in b43legacy_dma_tx()
1088 should_inject_overflow(ring)) { in b43legacy_dma_tx()
1093 ring->stopped = true; in b43legacy_dma_tx()
1096 ring->index); in b43legacy_dma_tx()
1104 struct b43legacy_dmaring *ring; in b43legacy_dma_handle_txstatus() local
1110 ring = parse_cookie(dev, status->cookie, &slot); in b43legacy_dma_handle_txstatus()
1111 if (unlikely(!ring)) in b43legacy_dma_handle_txstatus()
1113 B43legacy_WARN_ON(!ring->tx); in b43legacy_dma_handle_txstatus()
1118 firstused = ring->current_slot - ring->used_slots + 1; in b43legacy_dma_handle_txstatus()
1120 firstused = ring->nr_slots + firstused; in b43legacy_dma_handle_txstatus()
1127 ring->index, firstused, slot); in b43legacy_dma_handle_txstatus()
1132 B43legacy_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); in b43legacy_dma_handle_txstatus()
1133 op32_idx2desc(ring, slot, &meta); in b43legacy_dma_handle_txstatus()
1136 unmap_descbuffer(ring, meta->dmaaddr, in b43legacy_dma_handle_txstatus()
1139 unmap_descbuffer(ring, meta->dmaaddr, in b43legacy_dma_handle_txstatus()
1194 ring->used_slots--; in b43legacy_dma_handle_txstatus()
1198 slot = next_slot(ring, slot); in b43legacy_dma_handle_txstatus()
1201 if (ring->stopped) { in b43legacy_dma_handle_txstatus()
1202 B43legacy_WARN_ON(free_slots(ring) < SLOTS_PER_PACKET); in b43legacy_dma_handle_txstatus()
1203 ring->stopped = false; in b43legacy_dma_handle_txstatus()
1206 if (dev->wl->tx_queue_stopped[ring->queue_prio]) { in b43legacy_dma_handle_txstatus()
1207 dev->wl->tx_queue_stopped[ring->queue_prio] = 0; in b43legacy_dma_handle_txstatus()
1211 ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); in b43legacy_dma_handle_txstatus()
1214 ring->index); in b43legacy_dma_handle_txstatus()
1220 static void dma_rx(struct b43legacy_dmaring *ring, in dma_rx() argument
1231 desc = op32_idx2desc(ring, *slot, &meta); in dma_rx()
1233 sync_descbuffer_for_cpu(ring, meta->dmaaddr, ring->rx_buffersize); in dma_rx()
1236 if (ring->index == 3) { in dma_rx()
1249 b43legacy_handle_hwtxstatus(ring->dev, hw); in dma_rx()
1251 sync_descbuffer_for_device(ring, meta->dmaaddr, in dma_rx()
1252 ring->rx_buffersize); in dma_rx()
1268 sync_descbuffer_for_device(ring, meta->dmaaddr, in dma_rx()
1269 ring->rx_buffersize); in dma_rx()
1273 if (unlikely(len > ring->rx_buffersize)) { in dma_rx()
1283 desc = op32_idx2desc(ring, *slot, &meta); in dma_rx()
1285 sync_descbuffer_for_device(ring, meta->dmaaddr, in dma_rx()
1286 ring->rx_buffersize); in dma_rx()
1287 *slot = next_slot(ring, *slot); in dma_rx()
1289 tmp -= ring->rx_buffersize; in dma_rx()
1293 b43legacyerr(ring->dev->wl, "DMA RX buffer too small " in dma_rx()
1295 len, ring->rx_buffersize, cnt); in dma_rx()
1300 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); in dma_rx()
1302 b43legacydbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer()" in dma_rx()
1304 sync_descbuffer_for_device(ring, dmaaddr, in dma_rx()
1305 ring->rx_buffersize); in dma_rx()
1309 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); in dma_rx()
1310 skb_put(skb, len + ring->frameoffset); in dma_rx()
1311 skb_pull(skb, ring->frameoffset); in dma_rx()
1313 b43legacy_rx(ring->dev, skb, rxhdr); in dma_rx()
1318 void b43legacy_dma_rx(struct b43legacy_dmaring *ring) in b43legacy_dma_rx() argument
1324 B43legacy_WARN_ON(ring->tx); in b43legacy_dma_rx()
1325 current_slot = op32_get_current_rxslot(ring); in b43legacy_dma_rx()
1327 ring->nr_slots)); in b43legacy_dma_rx()
1329 slot = ring->current_slot; in b43legacy_dma_rx()
1330 for (; slot != current_slot; slot = next_slot(ring, slot)) { in b43legacy_dma_rx()
1331 dma_rx(ring, &slot); in b43legacy_dma_rx()
1332 update_max_used_slots(ring, ++used_slots); in b43legacy_dma_rx()
1334 op32_set_current_rxslot(ring, slot); in b43legacy_dma_rx()
1335 ring->current_slot = slot; in b43legacy_dma_rx()
1338 static void b43legacy_dma_tx_suspend_ring(struct b43legacy_dmaring *ring) in b43legacy_dma_tx_suspend_ring() argument
1340 B43legacy_WARN_ON(!ring->tx); in b43legacy_dma_tx_suspend_ring()
1341 op32_tx_suspend(ring); in b43legacy_dma_tx_suspend_ring()
1344 static void b43legacy_dma_tx_resume_ring(struct b43legacy_dmaring *ring) in b43legacy_dma_tx_resume_ring() argument
1346 B43legacy_WARN_ON(!ring->tx); in b43legacy_dma_tx_resume_ring()
1347 op32_tx_resume(ring); in b43legacy_dma_tx_resume_ring()