Lines Matching full:ab
225 struct ath12k_base *ab = pipe->ab; in ath12k_ce_rx_buf_enqueue_pipe() local
233 lockdep_assert_held(&ab->ce.ce_lock); in ath12k_ce_rx_buf_enqueue_pipe()
237 srng = &ab->hal.srng_list[ring->hal_ring_id]; in ath12k_ce_rx_buf_enqueue_pipe()
241 ath12k_hal_srng_access_begin(ab, srng); in ath12k_ce_rx_buf_enqueue_pipe()
243 if (unlikely(ath12k_hal_srng_src_num_free(ab, srng, false) < 1)) { in ath12k_ce_rx_buf_enqueue_pipe()
248 desc = ath12k_hal_srng_src_get_next_entry(ab, srng); in ath12k_ce_rx_buf_enqueue_pipe()
264 ath12k_hal_srng_access_end(ab, srng); in ath12k_ce_rx_buf_enqueue_pipe()
273 struct ath12k_base *ab = pipe->ab; in ath12k_ce_rx_post_pipe() local
281 spin_lock_bh(&ab->ce.ce_lock); in ath12k_ce_rx_post_pipe()
291 paddr = dma_map_single(ab->dev, skb->data, in ath12k_ce_rx_post_pipe()
294 if (unlikely(dma_mapping_error(ab->dev, paddr))) { in ath12k_ce_rx_post_pipe()
295 ath12k_warn(ab, "failed to dma map ce rx buf\n"); in ath12k_ce_rx_post_pipe()
305 ath12k_warn(ab, "failed to enqueue rx buf: %d\n", ret); in ath12k_ce_rx_post_pipe()
306 dma_unmap_single(ab->dev, paddr, in ath12k_ce_rx_post_pipe()
315 spin_unlock_bh(&ab->ce.ce_lock); in ath12k_ce_rx_post_pipe()
322 struct ath12k_base *ab = pipe->ab; in ath12k_ce_completed_recv_next() local
329 spin_lock_bh(&ab->ce.ce_lock); in ath12k_ce_completed_recv_next()
334 srng = &ab->hal.srng_list[pipe->status_ring->hal_ring_id]; in ath12k_ce_completed_recv_next()
338 ath12k_hal_srng_access_begin(ab, srng); in ath12k_ce_completed_recv_next()
340 desc = ath12k_hal_srng_dst_get_next_entry(ab, srng); in ath12k_ce_completed_recv_next()
360 ath12k_hal_srng_access_end(ab, srng); in ath12k_ce_completed_recv_next()
364 spin_unlock_bh(&ab->ce.ce_lock); in ath12k_ce_completed_recv_next()
371 struct ath12k_base *ab = pipe->ab; in ath12k_ce_recv_process_cb() local
380 dma_unmap_single(ab->dev, ATH12K_SKB_RXCB(skb)->paddr, in ath12k_ce_recv_process_cb()
384 ath12k_warn(ab, "rxed more than expected (nbytes %d, max %d)", in ath12k_ce_recv_process_cb()
395 ath12k_dbg(ab, ATH12K_DBG_AHB, "rx ce pipe %d len %d\n", in ath12k_ce_recv_process_cb()
397 pipe->recv_cb(ab, skb); in ath12k_ce_recv_process_cb()
402 ath12k_warn(ab, "failed to post rx buf to pipe: %d err: %d\n", in ath12k_ce_recv_process_cb()
404 mod_timer(&ab->rx_replenish_retry, in ath12k_ce_recv_process_cb()
411 struct ath12k_base *ab = pipe->ab; in ath12k_ce_completed_send_next() local
418 spin_lock_bh(&ab->ce.ce_lock); in ath12k_ce_completed_send_next()
423 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath12k_ce_completed_send_next()
427 ath12k_hal_srng_access_begin(ab, srng); in ath12k_ce_completed_send_next()
429 desc = ath12k_hal_srng_src_reap_next(ab, srng); in ath12k_ce_completed_send_next()
445 spin_unlock_bh(&ab->ce.ce_lock); in ath12k_ce_completed_send_next()
452 struct ath12k_base *ab = pipe->ab; in ath12k_ce_send_done_cb() local
459 dma_unmap_single(ab->dev, ATH12K_SKB_CB(skb)->paddr, skb->len, in ath12k_ce_send_done_cb()
465 static void ath12k_ce_srng_msi_ring_params_setup(struct ath12k_base *ab, u32 ce_id, in ath12k_ce_srng_msi_ring_params_setup() argument
475 ret = ath12k_hif_get_user_msi_vector(ab, "CE", in ath12k_ce_srng_msi_ring_params_setup()
482 ath12k_hif_get_msi_address(ab, &addr_lo, &addr_hi); in ath12k_ce_srng_msi_ring_params_setup()
483 ath12k_hif_get_ce_msi_idx(ab, ce_id, &msi_data_idx); in ath12k_ce_srng_msi_ring_params_setup()
491 static int ath12k_ce_init_ring(struct ath12k_base *ab, in ath12k_ce_init_ring() argument
502 if (!(CE_ATTR_DIS_INTR & ab->hw_params->host_ce_config[ce_id].flags)) in ath12k_ce_init_ring()
503 ath12k_ce_srng_msi_ring_params_setup(ab, ce_id, ¶ms); in ath12k_ce_init_ring()
507 if (!(CE_ATTR_DIS_INTR & ab->hw_params->host_ce_config[ce_id].flags)) in ath12k_ce_init_ring()
511 params.max_buffer_len = ab->hw_params->host_ce_config[ce_id].src_sz_max; in ath12k_ce_init_ring()
512 if (!(ab->hw_params->host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) { in ath12k_ce_init_ring()
519 if (!(ab->hw_params->host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) { in ath12k_ce_init_ring()
525 ath12k_warn(ab, "Invalid CE ring type %d\n", type); in ath12k_ce_init_ring()
531 ret = ath12k_hal_srng_setup(ab, type, ce_id, 0, ¶ms); in ath12k_ce_init_ring()
533 ath12k_warn(ab, "failed to setup srng: %d ring_id %d\n", in ath12k_ce_init_ring()
544 ath12k_ce_alloc_ring(struct ath12k_base *ab, int nentries, int desc_sz) in ath12k_ce_alloc_ring() argument
560 dma_alloc_coherent(ab->dev, in ath12k_ce_alloc_ring()
580 static int ath12k_ce_alloc_pipe(struct ath12k_base *ab, int ce_id) in ath12k_ce_alloc_pipe() argument
582 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath12k_ce_alloc_pipe()
583 const struct ce_attr *attr = &ab->hw_params->host_ce_config[ce_id]; in ath12k_ce_alloc_pipe()
594 ring = ath12k_ce_alloc_ring(ab, nentries, desc_sz); in ath12k_ce_alloc_pipe()
604 ring = ath12k_ce_alloc_ring(ab, nentries, desc_sz); in ath12k_ce_alloc_pipe()
610 ring = ath12k_ce_alloc_ring(ab, nentries, desc_sz); in ath12k_ce_alloc_pipe()
619 void ath12k_ce_per_engine_service(struct ath12k_base *ab, u16 ce_id) in ath12k_ce_per_engine_service() argument
621 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath12k_ce_per_engine_service()
630 void ath12k_ce_poll_send_completed(struct ath12k_base *ab, u8 pipe_id) in ath12k_ce_poll_send_completed() argument
632 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath12k_ce_poll_send_completed()
638 int ath12k_ce_send(struct ath12k_base *ab, struct sk_buff *skb, u8 pipe_id, in ath12k_ce_send() argument
641 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath12k_ce_send()
655 spin_lock_bh(&ab->ce.ce_lock); in ath12k_ce_send()
666 spin_unlock_bh(&ab->ce.ce_lock); in ath12k_ce_send()
669 ath12k_ce_poll_send_completed(ab, pipe->pipe_num); in ath12k_ce_send()
672 if (test_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags)) in ath12k_ce_send()
675 spin_lock_bh(&ab->ce.ce_lock); in ath12k_ce_send()
680 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath12k_ce_send()
684 ath12k_hal_srng_access_begin(ab, srng); in ath12k_ce_send()
686 if (unlikely(ath12k_hal_srng_src_num_free(ab, srng, false) < 1)) { in ath12k_ce_send()
687 ath12k_hal_srng_access_end(ab, srng); in ath12k_ce_send()
692 desc = ath12k_hal_srng_src_get_next_reaped(ab, srng); in ath12k_ce_send()
694 ath12k_hal_srng_access_end(ab, srng); in ath12k_ce_send()
709 ath12k_hal_srng_access_end(ab, srng); in ath12k_ce_send()
714 spin_unlock_bh(&ab->ce.ce_lock); in ath12k_ce_send()
721 struct ath12k_base *ab = pipe->ab; in ath12k_ce_rx_pipe_cleanup() local
735 dma_unmap_single(ab->dev, ATH12K_SKB_RXCB(skb)->paddr, in ath12k_ce_rx_pipe_cleanup()
741 void ath12k_ce_cleanup_pipes(struct ath12k_base *ab) in ath12k_ce_cleanup_pipes() argument
746 for (pipe_num = 0; pipe_num < ab->hw_params->ce_count; pipe_num++) { in ath12k_ce_cleanup_pipes()
747 pipe = &ab->ce.ce_pipe[pipe_num]; in ath12k_ce_cleanup_pipes()
751 ath12k_ce_poll_send_completed(ab, pipe_num); in ath12k_ce_cleanup_pipes()
757 void ath12k_ce_rx_post_buf(struct ath12k_base *ab) in ath12k_ce_rx_post_buf() argument
763 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_ce_rx_post_buf()
764 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_rx_post_buf()
770 ath12k_warn(ab, "failed to post rx buf to pipe: %d err: %d\n", in ath12k_ce_rx_post_buf()
772 mod_timer(&ab->rx_replenish_retry, in ath12k_ce_rx_post_buf()
782 struct ath12k_base *ab = from_timer(ab, t, rx_replenish_retry); in ath12k_ce_rx_replenish_retry() local
784 ath12k_ce_rx_post_buf(ab); in ath12k_ce_rx_replenish_retry()
787 static void ath12k_ce_shadow_config(struct ath12k_base *ab) in ath12k_ce_shadow_config() argument
791 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_ce_shadow_config()
792 if (ab->hw_params->host_ce_config[i].src_nentries) in ath12k_ce_shadow_config()
793 ath12k_hal_srng_update_shadow_config(ab, HAL_CE_SRC, i); in ath12k_ce_shadow_config()
795 if (ab->hw_params->host_ce_config[i].dest_nentries) { in ath12k_ce_shadow_config()
796 ath12k_hal_srng_update_shadow_config(ab, HAL_CE_DST, i); in ath12k_ce_shadow_config()
797 ath12k_hal_srng_update_shadow_config(ab, HAL_CE_DST_STATUS, i); in ath12k_ce_shadow_config()
802 void ath12k_ce_get_shadow_config(struct ath12k_base *ab, in ath12k_ce_get_shadow_config() argument
805 if (!ab->hw_params->supports_shadow_regs) in ath12k_ce_get_shadow_config()
808 ath12k_hal_srng_get_shadow_config(ab, shadow_cfg, shadow_cfg_len); in ath12k_ce_get_shadow_config()
818 ath12k_hal_srng_shadow_config(ab); in ath12k_ce_get_shadow_config()
819 ath12k_ce_shadow_config(ab); in ath12k_ce_get_shadow_config()
822 ath12k_hal_srng_get_shadow_config(ab, shadow_cfg, shadow_cfg_len); in ath12k_ce_get_shadow_config()
825 int ath12k_ce_init_pipes(struct ath12k_base *ab) in ath12k_ce_init_pipes() argument
831 ath12k_ce_get_shadow_config(ab, &ab->qmi.ce_cfg.shadow_reg_v3, in ath12k_ce_init_pipes()
832 &ab->qmi.ce_cfg.shadow_reg_v3_len); in ath12k_ce_init_pipes()
834 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_ce_init_pipes()
835 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_init_pipes()
838 ret = ath12k_ce_init_ring(ab, pipe->src_ring, i, in ath12k_ce_init_pipes()
841 ath12k_warn(ab, "failed to init src ring: %d\n", in ath12k_ce_init_pipes()
852 ret = ath12k_ce_init_ring(ab, pipe->dest_ring, i, in ath12k_ce_init_pipes()
855 ath12k_warn(ab, "failed to init dest ring: %d\n", in ath12k_ce_init_pipes()
869 ret = ath12k_ce_init_ring(ab, pipe->status_ring, i, in ath12k_ce_init_pipes()
872 ath12k_warn(ab, "failed to init dest status ing: %d\n", in ath12k_ce_init_pipes()
886 void ath12k_ce_free_pipes(struct ath12k_base *ab) in ath12k_ce_free_pipes() argument
892 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_ce_free_pipes()
893 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_free_pipes()
897 dma_free_coherent(ab->dev, in ath12k_ce_free_pipes()
908 dma_free_coherent(ab->dev, in ath12k_ce_free_pipes()
920 dma_free_coherent(ab->dev, in ath12k_ce_free_pipes()
931 int ath12k_ce_alloc_pipes(struct ath12k_base *ab) in ath12k_ce_alloc_pipes() argument
938 spin_lock_init(&ab->ce.ce_lock); in ath12k_ce_alloc_pipes()
940 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_ce_alloc_pipes()
941 attr = &ab->hw_params->host_ce_config[i]; in ath12k_ce_alloc_pipes()
942 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_alloc_pipes()
944 pipe->ab = ab; in ath12k_ce_alloc_pipes()
947 ret = ath12k_ce_alloc_pipe(ab, i); in ath12k_ce_alloc_pipes()
950 ath12k_ce_free_pipes(ab); in ath12k_ce_alloc_pipes()
958 int ath12k_ce_get_attr_flags(struct ath12k_base *ab, int ce_id) in ath12k_ce_get_attr_flags() argument
960 if (ce_id >= ab->hw_params->ce_count) in ath12k_ce_get_attr_flags()
963 return ab->hw_params->host_ce_config[ce_id].flags; in ath12k_ce_get_attr_flags()