Lines Matching full:ring
39 struct ath11k_dbring *ring, in ath11k_dbring_bufs_replenish() argument
51 srng = &ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_bufs_replenish()
58 ptr_aligned = PTR_ALIGN(ptr_unaligned, ring->buf_align); in ath11k_dbring_bufs_replenish()
59 ath11k_dbring_fill_magic_value(ar, ptr_aligned, ring->buf_sz); in ath11k_dbring_bufs_replenish()
60 paddr = dma_map_single(ab->dev, ptr_aligned, ring->buf_sz, in ath11k_dbring_bufs_replenish()
67 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
68 buf_id = idr_alloc(&ring->bufs_idr, buff, 0, ring->bufs_max, GFP_ATOMIC); in ath11k_dbring_bufs_replenish()
69 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
94 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
95 idr_remove(&ring->bufs_idr, buf_id); in ath11k_dbring_bufs_replenish()
96 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_bufs_replenish()
98 dma_unmap_single(ab->dev, paddr, ring->buf_sz, in ath11k_dbring_bufs_replenish()
106 struct ath11k_dbring *ring, in ath11k_dbring_fill_bufs() argument
115 srng = &ar->ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_fill_bufs()
120 req_entries = min(num_free, ring->bufs_max); in ath11k_dbring_fill_bufs()
122 align = ring->buf_align; in ath11k_dbring_fill_bufs()
123 size = ring->buf_sz + align - 1; in ath11k_dbring_fill_bufs()
135 ret = ath11k_dbring_bufs_replenish(ar, ring, buff, id); in ath11k_dbring_fill_bufs()
137 ath11k_warn(ar->ab, "failed to replenish db ring num_remain %d req_ent %d\n", in ath11k_dbring_fill_bufs()
152 struct ath11k_dbring *ring, in ath11k_dbring_wmi_cfg_setup() argument
161 param.pdev_id = DP_SW2HW_MACID(ring->pdev_id); in ath11k_dbring_wmi_cfg_setup()
163 param.base_paddr_lo = lower_32_bits(ring->refill_srng.paddr); in ath11k_dbring_wmi_cfg_setup()
164 param.base_paddr_hi = upper_32_bits(ring->refill_srng.paddr); in ath11k_dbring_wmi_cfg_setup()
165 param.head_idx_paddr_lo = lower_32_bits(ring->hp_addr); in ath11k_dbring_wmi_cfg_setup()
166 param.head_idx_paddr_hi = upper_32_bits(ring->hp_addr); in ath11k_dbring_wmi_cfg_setup()
167 param.tail_idx_paddr_lo = lower_32_bits(ring->tp_addr); in ath11k_dbring_wmi_cfg_setup()
168 param.tail_idx_paddr_hi = upper_32_bits(ring->tp_addr); in ath11k_dbring_wmi_cfg_setup()
169 param.num_elems = ring->bufs_max; in ath11k_dbring_wmi_cfg_setup()
170 param.buf_size = ring->buf_sz; in ath11k_dbring_wmi_cfg_setup()
171 param.num_resp_per_event = ring->num_resp_per_event; in ath11k_dbring_wmi_cfg_setup()
172 param.event_timeout_ms = ring->event_timeout_ms; in ath11k_dbring_wmi_cfg_setup()
176 ath11k_warn(ar->ab, "failed to setup db ring cfg\n"); in ath11k_dbring_wmi_cfg_setup()
183 int ath11k_dbring_set_cfg(struct ath11k *ar, struct ath11k_dbring *ring, in ath11k_dbring_set_cfg() argument
188 if (WARN_ON(!ring)) in ath11k_dbring_set_cfg()
191 ring->num_resp_per_event = num_resp_per_event; in ath11k_dbring_set_cfg()
192 ring->event_timeout_ms = event_timeout_ms; in ath11k_dbring_set_cfg()
193 ring->handler = handler; in ath11k_dbring_set_cfg()
199 struct ath11k_dbring *ring, in ath11k_dbring_buf_setup() argument
206 srng = &ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_buf_setup()
207 ring->bufs_max = ring->refill_srng.size / in ath11k_dbring_buf_setup()
210 ring->buf_sz = db_cap->min_buf_sz; in ath11k_dbring_buf_setup()
211 ring->buf_align = db_cap->min_buf_align; in ath11k_dbring_buf_setup()
212 ring->pdev_id = db_cap->pdev_id; in ath11k_dbring_buf_setup()
213 ring->hp_addr = ath11k_hal_srng_get_hp_addr(ar->ab, srng); in ath11k_dbring_buf_setup()
214 ring->tp_addr = ath11k_hal_srng_get_tp_addr(ar->ab, srng); in ath11k_dbring_buf_setup()
216 ret = ath11k_dbring_fill_bufs(ar, ring, db_cap->id); in ath11k_dbring_buf_setup()
221 int ath11k_dbring_srng_setup(struct ath11k *ar, struct ath11k_dbring *ring, in ath11k_dbring_srng_setup() argument
226 ret = ath11k_dp_srng_setup(ar->ab, &ring->refill_srng, HAL_RXDMA_DIR_BUF, in ath11k_dbring_srng_setup()
236 ath11k_dp_srng_cleanup(ar->ab, &ring->refill_srng); in ath11k_dbring_srng_setup()
268 struct ath11k_dbring *ring; in ath11k_dbring_buffer_release_event() local
309 ring = ath11k_spectral_get_dbring(ar); in ath11k_dbring_buffer_release_event()
312 ring = NULL; in ath11k_dbring_buffer_release_event()
318 if (!ring) { in ath11k_dbring_buffer_release_event()
323 srng = &ab->hal.srng_list[ring->refill_srng.ring_id]; in ath11k_dbring_buffer_release_event()
325 size = ring->buf_sz + ring->buf_align - 1; in ath11k_dbring_buffer_release_event()
341 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_buffer_release_event()
342 buff = idr_find(&ring->bufs_idr, buf_id); in ath11k_dbring_buffer_release_event()
344 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_buffer_release_event()
347 idr_remove(&ring->bufs_idr, buf_id); in ath11k_dbring_buffer_release_event()
348 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_buffer_release_event()
350 dma_unmap_single(ab->dev, buff->paddr, ring->buf_sz, in ath11k_dbring_buffer_release_event()
356 if (ring->handler) { in ath11k_dbring_buffer_release_event()
359 ring->buf_align); in ath11k_dbring_buffer_release_event()
360 handler_data.data_sz = ring->buf_sz; in ath11k_dbring_buffer_release_event()
362 ring->handler(ar, &handler_data); in ath11k_dbring_buffer_release_event()
367 ath11k_dbring_bufs_replenish(ar, ring, buff, module_id); in ath11k_dbring_buffer_release_event()
378 void ath11k_dbring_srng_cleanup(struct ath11k *ar, struct ath11k_dbring *ring) in ath11k_dbring_srng_cleanup() argument
380 ath11k_dp_srng_cleanup(ar->ab, &ring->refill_srng); in ath11k_dbring_srng_cleanup()
383 void ath11k_dbring_buf_cleanup(struct ath11k *ar, struct ath11k_dbring *ring) in ath11k_dbring_buf_cleanup() argument
388 spin_lock_bh(&ring->idr_lock); in ath11k_dbring_buf_cleanup()
389 idr_for_each_entry(&ring->bufs_idr, buff, buf_id) { in ath11k_dbring_buf_cleanup()
390 idr_remove(&ring->bufs_idr, buf_id); in ath11k_dbring_buf_cleanup()
392 ring->buf_sz, DMA_FROM_DEVICE); in ath11k_dbring_buf_cleanup()
397 idr_destroy(&ring->bufs_idr); in ath11k_dbring_buf_cleanup()
398 spin_unlock_bh(&ring->idr_lock); in ath11k_dbring_buf_cleanup()