Lines Matching full:pipe

222 static int ath12k_ce_rx_buf_enqueue_pipe(struct ath12k_ce_pipe *pipe,  in ath12k_ce_rx_buf_enqueue_pipe()  argument
225 struct ath12k_base *ab = pipe->ab; in ath12k_ce_rx_buf_enqueue_pipe()
226 struct ath12k_ce_ring *ring = pipe->dest_ring; in ath12k_ce_rx_buf_enqueue_pipe()
260 pipe->rx_buf_needed--; in ath12k_ce_rx_buf_enqueue_pipe()
271 static int ath12k_ce_rx_post_pipe(struct ath12k_ce_pipe *pipe) in ath12k_ce_rx_post_pipe() argument
273 struct ath12k_base *ab = pipe->ab; in ath12k_ce_rx_post_pipe()
278 if (!(pipe->dest_ring || pipe->status_ring)) in ath12k_ce_rx_post_pipe()
282 while (pipe->rx_buf_needed) { in ath12k_ce_rx_post_pipe()
283 skb = dev_alloc_skb(pipe->buf_sz); in ath12k_ce_rx_post_pipe()
303 ret = ath12k_ce_rx_buf_enqueue_pipe(pipe, skb, paddr); in ath12k_ce_rx_post_pipe()
319 static int ath12k_ce_completed_recv_next(struct ath12k_ce_pipe *pipe, in ath12k_ce_completed_recv_next() argument
322 struct ath12k_base *ab = pipe->ab; in ath12k_ce_completed_recv_next()
331 sw_index = pipe->dest_ring->sw_index; in ath12k_ce_completed_recv_next()
332 nentries_mask = pipe->dest_ring->nentries_mask; in ath12k_ce_completed_recv_next()
334 srng = &ab->hal.srng_list[pipe->status_ring->hal_ring_id]; in ath12k_ce_completed_recv_next()
352 *skb = pipe->dest_ring->skb[sw_index]; in ath12k_ce_completed_recv_next()
353 pipe->dest_ring->skb[sw_index] = NULL; in ath12k_ce_completed_recv_next()
356 pipe->dest_ring->sw_index = sw_index; in ath12k_ce_completed_recv_next()
358 pipe->rx_buf_needed++; in ath12k_ce_completed_recv_next()
369 static void ath12k_ce_recv_process_cb(struct ath12k_ce_pipe *pipe) in ath12k_ce_recv_process_cb() argument
371 struct ath12k_base *ab = pipe->ab; in ath12k_ce_recv_process_cb()
378 while (ath12k_ce_completed_recv_next(pipe, &skb, &nbytes) == 0) { 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()
396 pipe->pipe_num, skb->len); in ath12k_ce_recv_process_cb()
397 pipe->recv_cb(ab, skb); in ath12k_ce_recv_process_cb()
400 ret = ath12k_ce_rx_post_pipe(pipe); 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()
403 pipe->pipe_num, ret); in ath12k_ce_recv_process_cb()
409 static struct sk_buff *ath12k_ce_completed_send_next(struct ath12k_ce_pipe *pipe) in ath12k_ce_completed_send_next() argument
411 struct ath12k_base *ab = pipe->ab; in ath12k_ce_completed_send_next()
420 sw_index = pipe->src_ring->sw_index; in ath12k_ce_completed_send_next()
421 nentries_mask = pipe->src_ring->nentries_mask; in ath12k_ce_completed_send_next()
423 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath12k_ce_completed_send_next()
435 skb = pipe->src_ring->skb[sw_index]; in ath12k_ce_completed_send_next()
437 pipe->src_ring->skb[sw_index] = NULL; in ath12k_ce_completed_send_next()
440 pipe->src_ring->sw_index = sw_index; in ath12k_ce_completed_send_next()
450 static void ath12k_ce_send_done_cb(struct ath12k_ce_pipe *pipe) in ath12k_ce_send_done_cb() argument
452 struct ath12k_base *ab = pipe->ab; in ath12k_ce_send_done_cb()
455 while (!IS_ERR(skb = ath12k_ce_completed_send_next(pipe))) { in ath12k_ce_send_done_cb()
582 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath12k_ce_alloc_pipe() local
588 pipe->attr_flags = attr->flags; in ath12k_ce_alloc_pipe()
591 pipe->send_cb = ath12k_ce_send_done_cb; in ath12k_ce_alloc_pipe()
597 pipe->src_ring = ring; in ath12k_ce_alloc_pipe()
601 pipe->recv_cb = attr->recv_cb; in ath12k_ce_alloc_pipe()
607 pipe->dest_ring = ring; in ath12k_ce_alloc_pipe()
613 pipe->status_ring = ring; in ath12k_ce_alloc_pipe()
621 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath12k_ce_per_engine_service() local
623 if (pipe->send_cb) in ath12k_ce_per_engine_service()
624 pipe->send_cb(pipe); in ath12k_ce_per_engine_service()
626 if (pipe->recv_cb) in ath12k_ce_per_engine_service()
627 ath12k_ce_recv_process_cb(pipe); in ath12k_ce_per_engine_service()
632 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath12k_ce_poll_send_completed() local
634 if ((pipe->attr_flags & CE_ATTR_DIS_INTR) && pipe->send_cb) in ath12k_ce_poll_send_completed()
635 pipe->send_cb(pipe); in ath12k_ce_poll_send_completed()
641 struct ath12k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath12k_ce_send() local
654 if (pipe->attr_flags & CE_ATTR_DIS_INTR) { in ath12k_ce_send()
656 write_index = pipe->src_ring->write_index; in ath12k_ce_send()
658 sw_index = pipe->src_ring->sw_index; in ath12k_ce_send()
663 num_used = pipe->src_ring->nentries - sw_index + in ath12k_ce_send()
669 ath12k_ce_poll_send_completed(ab, pipe->pipe_num); in ath12k_ce_send()
677 write_index = pipe->src_ring->write_index; in ath12k_ce_send()
678 nentries_mask = pipe->src_ring->nentries_mask; in ath12k_ce_send()
680 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath12k_ce_send()
699 if (pipe->attr_flags & CE_ATTR_BYTE_SWAP_DATA) in ath12k_ce_send()
705 pipe->src_ring->skb[write_index] = skb; in ath12k_ce_send()
706 pipe->src_ring->write_index = CE_RING_IDX_INCR(nentries_mask, in ath12k_ce_send()
719 static void ath12k_ce_rx_pipe_cleanup(struct ath12k_ce_pipe *pipe) in ath12k_ce_rx_pipe_cleanup() argument
721 struct ath12k_base *ab = pipe->ab; in ath12k_ce_rx_pipe_cleanup()
722 struct ath12k_ce_ring *ring = pipe->dest_ring; in ath12k_ce_rx_pipe_cleanup()
726 if (!(ring && pipe->buf_sz)) in ath12k_ce_rx_pipe_cleanup()
743 struct ath12k_ce_pipe *pipe; in ath12k_ce_cleanup_pipes() local
747 pipe = &ab->ce.ce_pipe[pipe_num]; in ath12k_ce_cleanup_pipes()
748 ath12k_ce_rx_pipe_cleanup(pipe); in ath12k_ce_cleanup_pipes()
759 struct ath12k_ce_pipe *pipe; in ath12k_ce_rx_post_buf() local
764 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_rx_post_buf()
765 ret = ath12k_ce_rx_post_pipe(pipe); 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()
827 struct ath12k_ce_pipe *pipe; in ath12k_ce_init_pipes() local
835 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_init_pipes()
837 if (pipe->src_ring) { in ath12k_ce_init_pipes()
838 ret = ath12k_ce_init_ring(ab, pipe->src_ring, i, in ath12k_ce_init_pipes()
847 pipe->src_ring->write_index = 0; in ath12k_ce_init_pipes()
848 pipe->src_ring->sw_index = 0; in ath12k_ce_init_pipes()
851 if (pipe->dest_ring) { in ath12k_ce_init_pipes()
852 ret = ath12k_ce_init_ring(ab, pipe->dest_ring, i, in ath12k_ce_init_pipes()
861 pipe->rx_buf_needed = pipe->dest_ring->nentries ? in ath12k_ce_init_pipes()
862 pipe->dest_ring->nentries - 2 : 0; in ath12k_ce_init_pipes()
864 pipe->dest_ring->write_index = 0; in ath12k_ce_init_pipes()
865 pipe->dest_ring->sw_index = 0; in ath12k_ce_init_pipes()
868 if (pipe->status_ring) { in ath12k_ce_init_pipes()
869 ret = ath12k_ce_init_ring(ab, pipe->status_ring, i, in ath12k_ce_init_pipes()
878 pipe->status_ring->write_index = 0; in ath12k_ce_init_pipes()
879 pipe->status_ring->sw_index = 0; in ath12k_ce_init_pipes()
888 struct ath12k_ce_pipe *pipe; in ath12k_ce_free_pipes() local
893 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_free_pipes()
895 if (pipe->src_ring) { in ath12k_ce_free_pipes()
898 pipe->src_ring->nentries * desc_sz + in ath12k_ce_free_pipes()
900 pipe->src_ring->base_addr_owner_space, in ath12k_ce_free_pipes()
901 pipe->src_ring->base_addr_ce_space); in ath12k_ce_free_pipes()
902 kfree(pipe->src_ring); in ath12k_ce_free_pipes()
903 pipe->src_ring = NULL; in ath12k_ce_free_pipes()
906 if (pipe->dest_ring) { in ath12k_ce_free_pipes()
909 pipe->dest_ring->nentries * desc_sz + in ath12k_ce_free_pipes()
911 pipe->dest_ring->base_addr_owner_space, in ath12k_ce_free_pipes()
912 pipe->dest_ring->base_addr_ce_space); in ath12k_ce_free_pipes()
913 kfree(pipe->dest_ring); in ath12k_ce_free_pipes()
914 pipe->dest_ring = NULL; in ath12k_ce_free_pipes()
917 if (pipe->status_ring) { in ath12k_ce_free_pipes()
921 pipe->status_ring->nentries * desc_sz + in ath12k_ce_free_pipes()
923 pipe->status_ring->base_addr_owner_space, in ath12k_ce_free_pipes()
924 pipe->status_ring->base_addr_ce_space); in ath12k_ce_free_pipes()
925 kfree(pipe->status_ring); in ath12k_ce_free_pipes()
926 pipe->status_ring = NULL; in ath12k_ce_free_pipes()
933 struct ath12k_ce_pipe *pipe; in ath12k_ce_alloc_pipes() local
942 pipe = &ab->ce.ce_pipe[i]; in ath12k_ce_alloc_pipes()
943 pipe->pipe_num = i; in ath12k_ce_alloc_pipes()
944 pipe->ab = ab; in ath12k_ce_alloc_pipes()
945 pipe->buf_sz = attr->src_sz_max; in ath12k_ce_alloc_pipes()