Lines Matching full:ab
198 static void ath11k_ce_stop_shadow_timers(struct ath11k_base *ab) in ath11k_ce_stop_shadow_timers() argument
202 if (!ab->hw_params.supports_shadow_regs) in ath11k_ce_stop_shadow_timers()
205 for (i = 0; i < ab->hw_params.ce_count; i++) in ath11k_ce_stop_shadow_timers()
207 ath11k_dp_shadow_stop_timer(ab, &ab->ce.hp_timer[i]); in ath11k_ce_stop_shadow_timers()
213 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_buf_enqueue_pipe() local
221 lockdep_assert_held(&ab->ce.ce_lock); in ath11k_ce_rx_buf_enqueue_pipe()
225 srng = &ab->hal.srng_list[ring->hal_ring_id]; in ath11k_ce_rx_buf_enqueue_pipe()
229 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_rx_buf_enqueue_pipe()
231 if (unlikely(ath11k_hal_srng_src_num_free(ab, srng, false) < 1)) { in ath11k_ce_rx_buf_enqueue_pipe()
236 desc = ath11k_hal_srng_src_get_next_entry(ab, srng); in ath11k_ce_rx_buf_enqueue_pipe()
252 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_rx_buf_enqueue_pipe()
261 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_post_pipe() local
269 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_rx_post_pipe()
279 paddr = dma_map_single(ab->dev, skb->data, in ath11k_ce_rx_post_pipe()
282 if (unlikely(dma_mapping_error(ab->dev, paddr))) { in ath11k_ce_rx_post_pipe()
283 ath11k_warn(ab, "failed to dma map ce rx buf\n"); in ath11k_ce_rx_post_pipe()
294 ath11k_warn(ab, "failed to enqueue rx buf: %d\n", ret); in ath11k_ce_rx_post_pipe()
295 dma_unmap_single(ab->dev, paddr, in ath11k_ce_rx_post_pipe()
304 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_rx_post_pipe()
311 struct ath11k_base *ab = pipe->ab; in ath11k_ce_completed_recv_next() local
318 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_recv_next()
323 srng = &ab->hal.srng_list[pipe->status_ring->hal_ring_id]; in ath11k_ce_completed_recv_next()
327 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_completed_recv_next()
329 desc = ath11k_hal_srng_dst_get_next_entry(ab, srng); in ath11k_ce_completed_recv_next()
349 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_completed_recv_next()
353 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_recv_next()
360 struct ath11k_base *ab = pipe->ab; in ath11k_ce_recv_process_cb() local
369 dma_unmap_single(ab->dev, ATH11K_SKB_RXCB(skb)->paddr, in ath11k_ce_recv_process_cb()
373 ath11k_warn(ab, "rxed more than expected (nbytes %d, max %d)", in ath11k_ce_recv_process_cb()
384 ath11k_dbg(ab, ATH11K_DBG_AHB, "rx ce pipe %d len %d\n", in ath11k_ce_recv_process_cb()
386 pipe->recv_cb(ab, skb); in ath11k_ce_recv_process_cb()
391 ath11k_warn(ab, "failed to post rx buf to pipe: %d err: %d\n", in ath11k_ce_recv_process_cb()
393 mod_timer(&ab->rx_replenish_retry, in ath11k_ce_recv_process_cb()
400 struct ath11k_base *ab = pipe->ab; in ath11k_ce_completed_send_next() local
407 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_send_next()
412 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath11k_ce_completed_send_next()
416 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_completed_send_next()
418 desc = ath11k_hal_srng_src_reap_next(ab, srng); in ath11k_ce_completed_send_next()
434 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_send_next()
441 struct ath11k_base *ab = pipe->ab; in ath11k_ce_send_done_cb() local
448 dma_unmap_single(ab->dev, ATH11K_SKB_CB(skb)->paddr, skb->len, in ath11k_ce_send_done_cb()
454 static void ath11k_ce_srng_msi_ring_params_setup(struct ath11k_base *ab, u32 ce_id, in ath11k_ce_srng_msi_ring_params_setup() argument
464 ret = ath11k_get_user_msi_vector(ab, "CE", in ath11k_ce_srng_msi_ring_params_setup()
471 ath11k_get_msi_address(ab, &addr_lo, &addr_hi); in ath11k_ce_srng_msi_ring_params_setup()
479 static int ath11k_ce_init_ring(struct ath11k_base *ab, in ath11k_ce_init_ring() argument
490 if (!(CE_ATTR_DIS_INTR & ab->hw_params.host_ce_config[ce_id].flags)) in ath11k_ce_init_ring()
491 ath11k_ce_srng_msi_ring_params_setup(ab, ce_id, ¶ms); in ath11k_ce_init_ring()
495 if (!(CE_ATTR_DIS_INTR & ab->hw_params.host_ce_config[ce_id].flags)) in ath11k_ce_init_ring()
499 params.max_buffer_len = ab->hw_params.host_ce_config[ce_id].src_sz_max; in ath11k_ce_init_ring()
500 if (!(ab->hw_params.host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) { in ath11k_ce_init_ring()
507 if (!(ab->hw_params.host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) { in ath11k_ce_init_ring()
513 ath11k_warn(ab, "Invalid CE ring type %d\n", type); in ath11k_ce_init_ring()
519 ret = ath11k_hal_srng_setup(ab, type, ce_id, 0, ¶ms); in ath11k_ce_init_ring()
521 ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n", in ath11k_ce_init_ring()
528 if (ab->hw_params.supports_shadow_regs && in ath11k_ce_init_ring()
530 ath11k_dp_shadow_init_timer(ab, &ab->ce.hp_timer[ce_id], in ath11k_ce_init_ring()
538 ath11k_ce_alloc_ring(struct ath11k_base *ab, int nentries, int desc_sz) in ath11k_ce_alloc_ring() argument
554 dma_alloc_coherent(ab->dev, in ath11k_ce_alloc_ring()
574 static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id) in ath11k_ce_alloc_pipe() argument
576 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath11k_ce_alloc_pipe()
577 const struct ce_attr *attr = &ab->hw_params.host_ce_config[ce_id]; in ath11k_ce_alloc_pipe()
588 ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); in ath11k_ce_alloc_pipe()
598 ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); in ath11k_ce_alloc_pipe()
604 ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); in ath11k_ce_alloc_pipe()
613 void ath11k_ce_per_engine_service(struct ath11k_base *ab, u16 ce_id) in ath11k_ce_per_engine_service() argument
615 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath11k_ce_per_engine_service()
624 void ath11k_ce_poll_send_completed(struct ath11k_base *ab, u8 pipe_id) in ath11k_ce_poll_send_completed() argument
626 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath11k_ce_poll_send_completed()
633 int ath11k_ce_send(struct ath11k_base *ab, struct sk_buff *skb, u8 pipe_id, in ath11k_ce_send() argument
636 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath11k_ce_send()
650 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
661 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
664 ath11k_ce_poll_send_completed(ab, pipe->pipe_num); in ath11k_ce_send()
667 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags)) in ath11k_ce_send()
670 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
675 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath11k_ce_send()
679 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_send()
681 if (unlikely(ath11k_hal_srng_src_num_free(ab, srng, false) < 1)) { in ath11k_ce_send()
682 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_send()
687 desc = ath11k_hal_srng_src_get_next_reaped(ab, srng); in ath11k_ce_send()
689 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_send()
704 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_send()
707 ath11k_dp_shadow_start_timer(ab, srng, &ab->ce.hp_timer[pipe_id]); in ath11k_ce_send()
711 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
718 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
725 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_pipe_cleanup() local
739 dma_unmap_single(ab->dev, ATH11K_SKB_RXCB(skb)->paddr, in ath11k_ce_rx_pipe_cleanup()
745 static void ath11k_ce_shadow_config(struct ath11k_base *ab) in ath11k_ce_shadow_config() argument
749 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_shadow_config()
750 if (ab->hw_params.host_ce_config[i].src_nentries) in ath11k_ce_shadow_config()
751 ath11k_hal_srng_update_shadow_config(ab, in ath11k_ce_shadow_config()
754 if (ab->hw_params.host_ce_config[i].dest_nentries) { in ath11k_ce_shadow_config()
755 ath11k_hal_srng_update_shadow_config(ab, in ath11k_ce_shadow_config()
758 ath11k_hal_srng_update_shadow_config(ab, in ath11k_ce_shadow_config()
764 void ath11k_ce_get_shadow_config(struct ath11k_base *ab, in ath11k_ce_get_shadow_config() argument
767 if (!ab->hw_params.supports_shadow_regs) in ath11k_ce_get_shadow_config()
770 ath11k_hal_srng_get_shadow_config(ab, shadow_cfg, shadow_cfg_len); in ath11k_ce_get_shadow_config()
780 ath11k_hal_srng_shadow_config(ab); in ath11k_ce_get_shadow_config()
781 ath11k_ce_shadow_config(ab); in ath11k_ce_get_shadow_config()
784 ath11k_hal_srng_get_shadow_config(ab, shadow_cfg, shadow_cfg_len); in ath11k_ce_get_shadow_config()
788 void ath11k_ce_cleanup_pipes(struct ath11k_base *ab) in ath11k_ce_cleanup_pipes() argument
793 ath11k_ce_stop_shadow_timers(ab); in ath11k_ce_cleanup_pipes()
795 for (pipe_num = 0; pipe_num < ab->hw_params.ce_count; pipe_num++) { in ath11k_ce_cleanup_pipes()
796 pipe = &ab->ce.ce_pipe[pipe_num]; in ath11k_ce_cleanup_pipes()
800 ath11k_ce_poll_send_completed(ab, pipe_num); in ath11k_ce_cleanup_pipes()
807 void ath11k_ce_rx_post_buf(struct ath11k_base *ab) in ath11k_ce_rx_post_buf() argument
813 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_rx_post_buf()
814 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_rx_post_buf()
820 ath11k_warn(ab, "failed to post rx buf to pipe: %d err: %d\n", in ath11k_ce_rx_post_buf()
822 mod_timer(&ab->rx_replenish_retry, in ath11k_ce_rx_post_buf()
833 struct ath11k_base *ab = from_timer(ab, t, rx_replenish_retry); in ath11k_ce_rx_replenish_retry() local
835 ath11k_ce_rx_post_buf(ab); in ath11k_ce_rx_replenish_retry()
838 int ath11k_ce_init_pipes(struct ath11k_base *ab) in ath11k_ce_init_pipes() argument
844 ath11k_ce_get_shadow_config(ab, &ab->qmi.ce_cfg.shadow_reg_v2, in ath11k_ce_init_pipes()
845 &ab->qmi.ce_cfg.shadow_reg_v2_len); in ath11k_ce_init_pipes()
847 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_init_pipes()
848 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_init_pipes()
851 ret = ath11k_ce_init_ring(ab, pipe->src_ring, i, in ath11k_ce_init_pipes()
854 ath11k_warn(ab, "failed to init src ring: %d\n", in ath11k_ce_init_pipes()
865 ret = ath11k_ce_init_ring(ab, pipe->dest_ring, i, in ath11k_ce_init_pipes()
868 ath11k_warn(ab, "failed to init dest ring: %d\n", in ath11k_ce_init_pipes()
882 ret = ath11k_ce_init_ring(ab, pipe->status_ring, i, in ath11k_ce_init_pipes()
885 ath11k_warn(ab, "failed to init dest status ing: %d\n", in ath11k_ce_init_pipes()
899 void ath11k_ce_free_pipes(struct ath11k_base *ab) in ath11k_ce_free_pipes() argument
905 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_free_pipes()
906 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_free_pipes()
909 ath11k_dp_shadow_stop_timer(ab, &ab->ce.hp_timer[i]); in ath11k_ce_free_pipes()
913 dma_free_coherent(ab->dev, in ath11k_ce_free_pipes()
924 dma_free_coherent(ab->dev, in ath11k_ce_free_pipes()
936 dma_free_coherent(ab->dev, in ath11k_ce_free_pipes()
948 int ath11k_ce_alloc_pipes(struct ath11k_base *ab) in ath11k_ce_alloc_pipes() argument
955 spin_lock_init(&ab->ce.ce_lock); in ath11k_ce_alloc_pipes()
957 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_alloc_pipes()
958 attr = &ab->hw_params.host_ce_config[i]; in ath11k_ce_alloc_pipes()
959 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_alloc_pipes()
961 pipe->ab = ab; in ath11k_ce_alloc_pipes()
964 ret = ath11k_ce_alloc_pipe(ab, i); in ath11k_ce_alloc_pipes()
967 ath11k_ce_free_pipes(ab); in ath11k_ce_alloc_pipes()
995 int ath11k_ce_get_attr_flags(struct ath11k_base *ab, int ce_id) in ath11k_ce_get_attr_flags() argument
997 if (ce_id >= ab->hw_params.ce_count) in ath11k_ce_get_attr_flags()
1000 return ab->hw_params.host_ce_config[ce_id].flags; in ath11k_ce_get_attr_flags()