Lines Matching full:ring

10 					struct ath11k_dbring *ring,  in ath11k_dbring_bufs_replenish()  argument
22 srng = &ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_bufs_replenish()
29 ptr_aligned = PTR_ALIGN(ptr_unaligned, ring->buf_align); in ath11k_dbring_bufs_replenish()
30 paddr = dma_map_single(ab->dev, ptr_aligned, ring->buf_sz, in ath11k_dbring_bufs_replenish()
37 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
38 buf_id = idr_alloc(&ring->bufs_idr, buff, 0, ring->bufs_max, gfp); in ath11k_dbring_bufs_replenish()
39 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
63 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
64 idr_remove(&ring->bufs_idr, buf_id); in ath11k_dbring_bufs_replenish()
65 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
67 dma_unmap_single(ab->dev, paddr, ring->buf_sz, in ath11k_dbring_bufs_replenish()
75 struct ath11k_dbring *ring, in ath11k_dbring_fill_bufs() argument
84 srng = &ar->ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_fill_bufs()
89 req_entries = min(num_free, ring->bufs_max); in ath11k_dbring_fill_bufs()
91 align = ring->buf_align; in ath11k_dbring_fill_bufs()
92 size = sizeof(*buff) + ring->buf_sz + align - 1; in ath11k_dbring_fill_bufs()
99 ret = ath11k_dbring_bufs_replenish(ar, ring, buff, gfp); in ath11k_dbring_fill_bufs()
101 ath11k_warn(ar->ab, "failed to replenish db ring num_remain %d req_ent %d\n", in ath11k_dbring_fill_bufs()
115 struct ath11k_dbring *ring, in ath11k_dbring_wmi_cfg_setup() argument
124 param.pdev_id = DP_SW2HW_MACID(ring->pdev_id); in ath11k_dbring_wmi_cfg_setup()
126 param.base_paddr_lo = lower_32_bits(ring->refill_srng.paddr); in ath11k_dbring_wmi_cfg_setup()
127 param.base_paddr_hi = upper_32_bits(ring->refill_srng.paddr); in ath11k_dbring_wmi_cfg_setup()
128 param.head_idx_paddr_lo = lower_32_bits(ring->hp_addr); in ath11k_dbring_wmi_cfg_setup()
129 param.head_idx_paddr_hi = upper_32_bits(ring->hp_addr); in ath11k_dbring_wmi_cfg_setup()
130 param.tail_idx_paddr_lo = lower_32_bits(ring->tp_addr); in ath11k_dbring_wmi_cfg_setup()
131 param.tail_idx_paddr_hi = upper_32_bits(ring->tp_addr); in ath11k_dbring_wmi_cfg_setup()
132 param.num_elems = ring->bufs_max; in ath11k_dbring_wmi_cfg_setup()
133 param.buf_size = ring->buf_sz; in ath11k_dbring_wmi_cfg_setup()
134 param.num_resp_per_event = ring->num_resp_per_event; in ath11k_dbring_wmi_cfg_setup()
135 param.event_timeout_ms = ring->event_timeout_ms; in ath11k_dbring_wmi_cfg_setup()
139 ath11k_warn(ar->ab, "failed to setup db ring cfg\n"); in ath11k_dbring_wmi_cfg_setup()
146 int ath11k_dbring_set_cfg(struct ath11k *ar, struct ath11k_dbring *ring, in ath11k_dbring_set_cfg() argument
151 if (WARN_ON(!ring)) in ath11k_dbring_set_cfg()
154 ring->num_resp_per_event = num_resp_per_event; in ath11k_dbring_set_cfg()
155 ring->event_timeout_ms = event_timeout_ms; in ath11k_dbring_set_cfg()
156 ring->handler = handler; in ath11k_dbring_set_cfg()
162 struct ath11k_dbring *ring, in ath11k_dbring_buf_setup() argument
169 srng = &ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_buf_setup()
170 ring->bufs_max = ring->refill_srng.size / in ath11k_dbring_buf_setup()
173 ring->buf_sz = db_cap->min_buf_sz; in ath11k_dbring_buf_setup()
174 ring->buf_align = db_cap->min_buf_align; in ath11k_dbring_buf_setup()
175 ring->pdev_id = db_cap->pdev_id; in ath11k_dbring_buf_setup()
176 ring->hp_addr = ath11k_hal_srng_get_hp_addr(ar->ab, srng); in ath11k_dbring_buf_setup()
177 ring->tp_addr = ath11k_hal_srng_get_tp_addr(ar->ab, srng); in ath11k_dbring_buf_setup()
179 ret = ath11k_dbring_fill_bufs(ar, ring, GFP_KERNEL); in ath11k_dbring_buf_setup()
184 int ath11k_dbring_srng_setup(struct ath11k *ar, struct ath11k_dbring *ring, in ath11k_dbring_srng_setup() argument
189 ret = ath11k_dp_srng_setup(ar->ab, &ring->refill_srng, HAL_RXDMA_DIR_BUF, in ath11k_dbring_srng_setup()
199 ath11k_dp_srng_cleanup(ar->ab, &ring->refill_srng); in ath11k_dbring_srng_setup()
231 struct ath11k_dbring *ring; in ath11k_dbring_buffer_release_event() local
271 ring = ath11k_spectral_get_dbring(ar); in ath11k_dbring_buffer_release_event()
274 ring = NULL; in ath11k_dbring_buffer_release_event()
280 if (!ring) { in ath11k_dbring_buffer_release_event()
285 srng = &ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_buffer_release_event()
287 size = sizeof(*buff) + ring->buf_sz + ring->buf_align - 1; in ath11k_dbring_buffer_release_event()
303 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_buffer_release_event()
304 buff = idr_find(&ring->bufs_idr, buf_id); in ath11k_dbring_buffer_release_event()
306 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_buffer_release_event()
309 idr_remove(&ring->bufs_idr, buf_id); in ath11k_dbring_buffer_release_event()
310 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_buffer_release_event()
312 dma_unmap_single(ab->dev, buff->paddr, ring->buf_sz, in ath11k_dbring_buffer_release_event()
315 if (ring->handler) { in ath11k_dbring_buffer_release_event()
318 ring->buf_align); in ath11k_dbring_buffer_release_event()
319 handler_data.data_sz = ring->buf_sz; in ath11k_dbring_buffer_release_event()
321 ring->handler(ar, &handler_data); in ath11k_dbring_buffer_release_event()
325 ath11k_dbring_bufs_replenish(ar, ring, buff, GFP_ATOMIC); in ath11k_dbring_buffer_release_event()
336 void ath11k_dbring_srng_cleanup(struct ath11k *ar, struct ath11k_dbring *ring) in ath11k_dbring_srng_cleanup() argument
338 ath11k_dp_srng_cleanup(ar->ab, &ring->refill_srng); in ath11k_dbring_srng_cleanup()
341 void ath11k_dbring_buf_cleanup(struct ath11k *ar, struct ath11k_dbring *ring) in ath11k_dbring_buf_cleanup() argument
346 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_buf_cleanup()
347 idr_for_each_entry(&ring->bufs_idr, buff, buf_id) { in ath11k_dbring_buf_cleanup()
348 idr_remove(&ring->bufs_idr, buf_id); in ath11k_dbring_buf_cleanup()
350 ring->buf_sz, DMA_FROM_DEVICE); in ath11k_dbring_buf_cleanup()
354 idr_destroy(&ring->bufs_idr); in ath11k_dbring_buf_cleanup()
355 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_buf_cleanup()