Lines Matching full:ab
259 void ath11k_ce_stop_shadow_timers(struct ath11k_base *ab) in ath11k_ce_stop_shadow_timers() argument
263 if (!ab->hw_params.supports_shadow_regs) in ath11k_ce_stop_shadow_timers()
266 for (i = 0; i < ab->hw_params.ce_count; i++) in ath11k_ce_stop_shadow_timers()
268 ath11k_dp_shadow_stop_timer(ab, &ab->ce.hp_timer[i]); in ath11k_ce_stop_shadow_timers()
274 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_buf_enqueue_pipe() local
282 lockdep_assert_held(&ab->ce.ce_lock); in ath11k_ce_rx_buf_enqueue_pipe()
286 srng = &ab->hal.srng_list[ring->hal_ring_id]; in ath11k_ce_rx_buf_enqueue_pipe()
290 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_rx_buf_enqueue_pipe()
292 if (unlikely(ath11k_hal_srng_src_num_free(ab, srng, false) < 1)) { in ath11k_ce_rx_buf_enqueue_pipe()
297 desc = ath11k_hal_srng_src_get_next_entry(ab, srng); in ath11k_ce_rx_buf_enqueue_pipe()
313 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_rx_buf_enqueue_pipe()
322 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_post_pipe() local
330 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_rx_post_pipe()
340 paddr = dma_map_single(ab->dev, skb->data, in ath11k_ce_rx_post_pipe()
343 if (unlikely(dma_mapping_error(ab->dev, paddr))) { in ath11k_ce_rx_post_pipe()
344 ath11k_warn(ab, "failed to dma map ce rx buf\n"); in ath11k_ce_rx_post_pipe()
355 ath11k_warn(ab, "failed to enqueue rx buf: %d\n", ret); in ath11k_ce_rx_post_pipe()
356 dma_unmap_single(ab->dev, paddr, in ath11k_ce_rx_post_pipe()
365 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_rx_post_pipe()
372 struct ath11k_base *ab = pipe->ab; in ath11k_ce_completed_recv_next() local
379 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_recv_next()
384 srng = &ab->hal.srng_list[pipe->status_ring->hal_ring_id]; in ath11k_ce_completed_recv_next()
388 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_completed_recv_next()
390 desc = ath11k_hal_srng_dst_get_next_entry(ab, srng); in ath11k_ce_completed_recv_next()
409 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_completed_recv_next()
413 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_recv_next()
420 struct ath11k_base *ab = pipe->ab; in ath11k_ce_recv_process_cb() local
429 dma_unmap_single(ab->dev, ATH11K_SKB_RXCB(skb)->paddr, in ath11k_ce_recv_process_cb()
433 ath11k_warn(ab, "unexpected rx length (nbytes %d, max %d)", in ath11k_ce_recv_process_cb()
444 ath11k_dbg(ab, ATH11K_DBG_CE, "rx ce pipe %d len %d\n", in ath11k_ce_recv_process_cb()
446 pipe->recv_cb(ab, skb); in ath11k_ce_recv_process_cb()
451 ath11k_warn(ab, "failed to post rx buf to pipe: %d err: %d\n", in ath11k_ce_recv_process_cb()
453 mod_timer(&ab->rx_replenish_retry, in ath11k_ce_recv_process_cb()
460 struct ath11k_base *ab = pipe->ab; in ath11k_ce_completed_send_next() local
467 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_send_next()
472 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath11k_ce_completed_send_next()
476 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_completed_send_next()
478 desc = ath11k_hal_srng_src_reap_next(ab, srng); in ath11k_ce_completed_send_next()
494 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_completed_send_next()
501 struct ath11k_base *ab = pipe->ab; in ath11k_ce_tx_process_cb() local
510 dma_unmap_single(ab->dev, ATH11K_SKB_CB(skb)->paddr, skb->len, in ath11k_ce_tx_process_cb()
513 if ((!pipe->send_cb) || ab->hw_params.credit_flow) { in ath11k_ce_tx_process_cb()
522 ath11k_dbg(ab, ATH11K_DBG_CE, "tx ce pipe %d len %d\n", in ath11k_ce_tx_process_cb()
524 pipe->send_cb(ab, skb); in ath11k_ce_tx_process_cb()
528 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
538 ret = ath11k_get_user_msi_vector(ab, "CE", in ath11k_ce_srng_msi_ring_params_setup()
545 ath11k_get_msi_address(ab, &addr_lo, &addr_hi); in ath11k_ce_srng_msi_ring_params_setup()
546 ath11k_get_ce_msi_idx(ab, ce_id, &msi_data_idx); in ath11k_ce_srng_msi_ring_params_setup()
554 static int ath11k_ce_init_ring(struct ath11k_base *ab, in ath11k_ce_init_ring() argument
565 if (!(CE_ATTR_DIS_INTR & ab->hw_params.host_ce_config[ce_id].flags)) in ath11k_ce_init_ring()
566 ath11k_ce_srng_msi_ring_params_setup(ab, ce_id, ¶ms); in ath11k_ce_init_ring()
570 if (!(CE_ATTR_DIS_INTR & ab->hw_params.host_ce_config[ce_id].flags)) in ath11k_ce_init_ring()
574 params.max_buffer_len = ab->hw_params.host_ce_config[ce_id].src_sz_max; in ath11k_ce_init_ring()
575 if (!(ab->hw_params.host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) { in ath11k_ce_init_ring()
582 if (!(ab->hw_params.host_ce_config[ce_id].flags & CE_ATTR_DIS_INTR)) { in ath11k_ce_init_ring()
588 ath11k_warn(ab, "Invalid CE ring type %d\n", type); in ath11k_ce_init_ring()
594 ret = ath11k_hal_srng_setup(ab, type, ce_id, 0, ¶ms); in ath11k_ce_init_ring()
596 ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n", in ath11k_ce_init_ring()
603 if (ab->hw_params.supports_shadow_regs && in ath11k_ce_init_ring()
605 ath11k_dp_shadow_init_timer(ab, &ab->ce.hp_timer[ce_id], in ath11k_ce_init_ring()
613 ath11k_ce_alloc_ring(struct ath11k_base *ab, int nentries, int desc_sz) in ath11k_ce_alloc_ring() argument
629 dma_alloc_coherent(ab->dev, in ath11k_ce_alloc_ring()
649 static int ath11k_ce_alloc_pipe(struct ath11k_base *ab, int ce_id) in ath11k_ce_alloc_pipe() argument
651 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath11k_ce_alloc_pipe()
652 const struct ce_attr *attr = &ab->hw_params.host_ce_config[ce_id]; in ath11k_ce_alloc_pipe()
663 ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); in ath11k_ce_alloc_pipe()
673 ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); in ath11k_ce_alloc_pipe()
679 ring = ath11k_ce_alloc_ring(ab, nentries, desc_sz); in ath11k_ce_alloc_pipe()
688 void ath11k_ce_per_engine_service(struct ath11k_base *ab, u16 ce_id) in ath11k_ce_per_engine_service() argument
690 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath11k_ce_per_engine_service()
691 const struct ce_attr *attr = &ab->hw_params.host_ce_config[ce_id]; in ath11k_ce_per_engine_service()
700 void ath11k_ce_poll_send_completed(struct ath11k_base *ab, u8 pipe_id) in ath11k_ce_poll_send_completed() argument
702 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath11k_ce_poll_send_completed()
703 const struct ce_attr *attr = &ab->hw_params.host_ce_config[pipe_id]; in ath11k_ce_poll_send_completed()
710 int ath11k_ce_send(struct ath11k_base *ab, struct sk_buff *skb, u8 pipe_id, in ath11k_ce_send() argument
713 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath11k_ce_send()
727 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
738 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
741 ath11k_ce_poll_send_completed(ab, pipe->pipe_num); in ath11k_ce_send()
744 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags)) in ath11k_ce_send()
747 spin_lock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
752 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath11k_ce_send()
756 ath11k_hal_srng_access_begin(ab, srng); in ath11k_ce_send()
758 if (unlikely(ath11k_hal_srng_src_num_free(ab, srng, false) < 1)) { in ath11k_ce_send()
759 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_send()
764 desc = ath11k_hal_srng_src_get_next_reaped(ab, srng); in ath11k_ce_send()
766 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_send()
781 ath11k_hal_srng_access_end(ab, srng); in ath11k_ce_send()
784 ath11k_dp_shadow_start_timer(ab, srng, &ab->ce.hp_timer[pipe_id]); in ath11k_ce_send()
788 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
795 spin_unlock_bh(&ab->ce.ce_lock); in ath11k_ce_send()
802 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_pipe_cleanup() local
816 dma_unmap_single(ab->dev, ATH11K_SKB_RXCB(skb)->paddr, in ath11k_ce_rx_pipe_cleanup()
822 static void ath11k_ce_shadow_config(struct ath11k_base *ab) in ath11k_ce_shadow_config() argument
826 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_shadow_config()
827 if (ab->hw_params.host_ce_config[i].src_nentries) in ath11k_ce_shadow_config()
828 ath11k_hal_srng_update_shadow_config(ab, in ath11k_ce_shadow_config()
831 if (ab->hw_params.host_ce_config[i].dest_nentries) { in ath11k_ce_shadow_config()
832 ath11k_hal_srng_update_shadow_config(ab, in ath11k_ce_shadow_config()
835 ath11k_hal_srng_update_shadow_config(ab, in ath11k_ce_shadow_config()
841 void ath11k_ce_get_shadow_config(struct ath11k_base *ab, in ath11k_ce_get_shadow_config() argument
844 if (!ab->hw_params.supports_shadow_regs) in ath11k_ce_get_shadow_config()
847 ath11k_hal_srng_get_shadow_config(ab, shadow_cfg, shadow_cfg_len); in ath11k_ce_get_shadow_config()
857 ath11k_hal_srng_shadow_config(ab); in ath11k_ce_get_shadow_config()
858 ath11k_ce_shadow_config(ab); in ath11k_ce_get_shadow_config()
861 ath11k_hal_srng_get_shadow_config(ab, shadow_cfg, shadow_cfg_len); in ath11k_ce_get_shadow_config()
865 void ath11k_ce_cleanup_pipes(struct ath11k_base *ab) in ath11k_ce_cleanup_pipes() argument
870 ath11k_ce_stop_shadow_timers(ab); in ath11k_ce_cleanup_pipes()
872 for (pipe_num = 0; pipe_num < ab->hw_params.ce_count; pipe_num++) { in ath11k_ce_cleanup_pipes()
873 pipe = &ab->ce.ce_pipe[pipe_num]; in ath11k_ce_cleanup_pipes()
877 ath11k_ce_poll_send_completed(ab, pipe_num); in ath11k_ce_cleanup_pipes()
884 void ath11k_ce_rx_post_buf(struct ath11k_base *ab) in ath11k_ce_rx_post_buf() argument
890 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_rx_post_buf()
891 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_rx_post_buf()
897 ath11k_warn(ab, "failed to post rx buf to pipe: %d err: %d\n", in ath11k_ce_rx_post_buf()
899 mod_timer(&ab->rx_replenish_retry, in ath11k_ce_rx_post_buf()
910 struct ath11k_base *ab = from_timer(ab, t, rx_replenish_retry); in ath11k_ce_rx_replenish_retry() local
912 ath11k_ce_rx_post_buf(ab); in ath11k_ce_rx_replenish_retry()
915 int ath11k_ce_init_pipes(struct ath11k_base *ab) in ath11k_ce_init_pipes() argument
921 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_init_pipes()
922 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_init_pipes()
925 ret = ath11k_ce_init_ring(ab, pipe->src_ring, i, in ath11k_ce_init_pipes()
928 ath11k_warn(ab, "failed to init src ring: %d\n", in ath11k_ce_init_pipes()
939 ret = ath11k_ce_init_ring(ab, pipe->dest_ring, i, in ath11k_ce_init_pipes()
942 ath11k_warn(ab, "failed to init dest ring: %d\n", in ath11k_ce_init_pipes()
956 ret = ath11k_ce_init_ring(ab, pipe->status_ring, i, in ath11k_ce_init_pipes()
959 ath11k_warn(ab, "failed to init dest status ing: %d\n", in ath11k_ce_init_pipes()
973 void ath11k_ce_free_pipes(struct ath11k_base *ab) in ath11k_ce_free_pipes() argument
980 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_free_pipes()
981 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_free_pipes()
984 ath11k_dp_shadow_stop_timer(ab, &ab->ce.hp_timer[i]); in ath11k_ce_free_pipes()
989 dma_free_coherent(ab->dev, in ath11k_ce_free_pipes()
1001 dma_free_coherent(ab->dev, in ath11k_ce_free_pipes()
1014 dma_free_coherent(ab->dev, in ath11k_ce_free_pipes()
1026 int ath11k_ce_alloc_pipes(struct ath11k_base *ab) in ath11k_ce_alloc_pipes() argument
1033 spin_lock_init(&ab->ce.ce_lock); in ath11k_ce_alloc_pipes()
1035 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ce_alloc_pipes()
1036 attr = &ab->hw_params.host_ce_config[i]; in ath11k_ce_alloc_pipes()
1037 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_alloc_pipes()
1039 pipe->ab = ab; in ath11k_ce_alloc_pipes()
1042 ret = ath11k_ce_alloc_pipe(ab, i); in ath11k_ce_alloc_pipes()
1045 ath11k_ce_free_pipes(ab); in ath11k_ce_alloc_pipes()
1073 int ath11k_ce_get_attr_flags(struct ath11k_base *ab, int ce_id) in ath11k_ce_get_attr_flags() argument
1075 if (ce_id >= ab->hw_params.ce_count) in ath11k_ce_get_attr_flags()
1078 return ab->hw_params.host_ce_config[ce_id].flags; in ath11k_ce_get_attr_flags()