Lines Matching full:pipe

210 static int ath11k_ce_rx_buf_enqueue_pipe(struct ath11k_ce_pipe *pipe,  in ath11k_ce_rx_buf_enqueue_pipe()  argument
213 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_buf_enqueue_pipe()
214 struct ath11k_ce_ring *ring = pipe->dest_ring; in ath11k_ce_rx_buf_enqueue_pipe()
248 pipe->rx_buf_needed--; in ath11k_ce_rx_buf_enqueue_pipe()
259 static int ath11k_ce_rx_post_pipe(struct ath11k_ce_pipe *pipe) in ath11k_ce_rx_post_pipe() argument
261 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_post_pipe()
266 if (!(pipe->dest_ring || pipe->status_ring)) in ath11k_ce_rx_post_pipe()
270 while (pipe->rx_buf_needed) { in ath11k_ce_rx_post_pipe()
271 skb = dev_alloc_skb(pipe->buf_sz); in ath11k_ce_rx_post_pipe()
291 ret = ath11k_ce_rx_buf_enqueue_pipe(pipe, skb, paddr); in ath11k_ce_rx_post_pipe()
308 static int ath11k_ce_completed_recv_next(struct ath11k_ce_pipe *pipe, in ath11k_ce_completed_recv_next() argument
311 struct ath11k_base *ab = pipe->ab; in ath11k_ce_completed_recv_next()
320 sw_index = pipe->dest_ring->sw_index; in ath11k_ce_completed_recv_next()
321 nentries_mask = pipe->dest_ring->nentries_mask; in ath11k_ce_completed_recv_next()
323 srng = &ab->hal.srng_list[pipe->status_ring->hal_ring_id]; in ath11k_ce_completed_recv_next()
341 *skb = pipe->dest_ring->skb[sw_index]; in ath11k_ce_completed_recv_next()
342 pipe->dest_ring->skb[sw_index] = NULL; in ath11k_ce_completed_recv_next()
345 pipe->dest_ring->sw_index = sw_index; in ath11k_ce_completed_recv_next()
347 pipe->rx_buf_needed++; in ath11k_ce_completed_recv_next()
358 static void ath11k_ce_recv_process_cb(struct ath11k_ce_pipe *pipe) in ath11k_ce_recv_process_cb() argument
360 struct ath11k_base *ab = pipe->ab; in ath11k_ce_recv_process_cb()
367 while (ath11k_ce_completed_recv_next(pipe, &skb, &nbytes) == 0) { 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()
385 pipe->pipe_num, skb->len); in ath11k_ce_recv_process_cb()
386 pipe->recv_cb(ab, skb); in ath11k_ce_recv_process_cb()
389 ret = ath11k_ce_rx_post_pipe(pipe); 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()
392 pipe->pipe_num, ret); in ath11k_ce_recv_process_cb()
398 static struct sk_buff *ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe) in ath11k_ce_completed_send_next() argument
400 struct ath11k_base *ab = pipe->ab; in ath11k_ce_completed_send_next()
409 sw_index = pipe->src_ring->sw_index; in ath11k_ce_completed_send_next()
410 nentries_mask = pipe->src_ring->nentries_mask; in ath11k_ce_completed_send_next()
412 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath11k_ce_completed_send_next()
424 skb = pipe->src_ring->skb[sw_index]; in ath11k_ce_completed_send_next()
426 pipe->src_ring->skb[sw_index] = NULL; in ath11k_ce_completed_send_next()
429 pipe->src_ring->sw_index = sw_index; in ath11k_ce_completed_send_next()
439 static void ath11k_ce_send_done_cb(struct ath11k_ce_pipe *pipe) in ath11k_ce_send_done_cb() argument
441 struct ath11k_base *ab = pipe->ab; in ath11k_ce_send_done_cb()
444 while (!IS_ERR(skb = ath11k_ce_completed_send_next(pipe))) { in ath11k_ce_send_done_cb()
576 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath11k_ce_alloc_pipe() local
582 pipe->attr_flags = attr->flags; in ath11k_ce_alloc_pipe()
585 pipe->send_cb = ath11k_ce_send_done_cb; in ath11k_ce_alloc_pipe()
591 pipe->src_ring = ring; in ath11k_ce_alloc_pipe()
595 pipe->recv_cb = attr->recv_cb; in ath11k_ce_alloc_pipe()
601 pipe->dest_ring = ring; in ath11k_ce_alloc_pipe()
607 pipe->status_ring = ring; in ath11k_ce_alloc_pipe()
615 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[ce_id]; in ath11k_ce_per_engine_service() local
617 if (pipe->send_cb) in ath11k_ce_per_engine_service()
618 pipe->send_cb(pipe); in ath11k_ce_per_engine_service()
620 if (pipe->recv_cb) in ath11k_ce_per_engine_service()
621 ath11k_ce_recv_process_cb(pipe); in ath11k_ce_per_engine_service()
626 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath11k_ce_poll_send_completed() local
628 if ((pipe->attr_flags & CE_ATTR_DIS_INTR) && pipe->send_cb) in ath11k_ce_poll_send_completed()
629 pipe->send_cb(pipe); in ath11k_ce_poll_send_completed()
636 struct ath11k_ce_pipe *pipe = &ab->ce.ce_pipe[pipe_id]; in ath11k_ce_send() local
649 if (pipe->attr_flags & CE_ATTR_DIS_INTR) { in ath11k_ce_send()
651 write_index = pipe->src_ring->write_index; in ath11k_ce_send()
653 sw_index = pipe->src_ring->sw_index; in ath11k_ce_send()
658 num_used = pipe->src_ring->nentries - sw_index + in ath11k_ce_send()
664 ath11k_ce_poll_send_completed(ab, pipe->pipe_num); in ath11k_ce_send()
672 write_index = pipe->src_ring->write_index; in ath11k_ce_send()
673 nentries_mask = pipe->src_ring->nentries_mask; in ath11k_ce_send()
675 srng = &ab->hal.srng_list[pipe->src_ring->hal_ring_id]; in ath11k_ce_send()
694 if (pipe->attr_flags & CE_ATTR_BYTE_SWAP_DATA) in ath11k_ce_send()
700 pipe->src_ring->skb[write_index] = skb; in ath11k_ce_send()
701 pipe->src_ring->write_index = CE_RING_IDX_INCR(nentries_mask, in ath11k_ce_send()
723 static void ath11k_ce_rx_pipe_cleanup(struct ath11k_ce_pipe *pipe) in ath11k_ce_rx_pipe_cleanup() argument
725 struct ath11k_base *ab = pipe->ab; in ath11k_ce_rx_pipe_cleanup()
726 struct ath11k_ce_ring *ring = pipe->dest_ring; in ath11k_ce_rx_pipe_cleanup()
730 if (!(ring && pipe->buf_sz)) in ath11k_ce_rx_pipe_cleanup()
790 struct ath11k_ce_pipe *pipe; in ath11k_ce_cleanup_pipes() local
796 pipe = &ab->ce.ce_pipe[pipe_num]; in ath11k_ce_cleanup_pipes()
797 ath11k_ce_rx_pipe_cleanup(pipe); in ath11k_ce_cleanup_pipes()
809 struct ath11k_ce_pipe *pipe; in ath11k_ce_rx_post_buf() local
814 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_rx_post_buf()
815 ret = ath11k_ce_rx_post_pipe(pipe); 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()
840 struct ath11k_ce_pipe *pipe; in ath11k_ce_init_pipes() local
848 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_init_pipes()
850 if (pipe->src_ring) { in ath11k_ce_init_pipes()
851 ret = ath11k_ce_init_ring(ab, pipe->src_ring, i, in ath11k_ce_init_pipes()
860 pipe->src_ring->write_index = 0; in ath11k_ce_init_pipes()
861 pipe->src_ring->sw_index = 0; in ath11k_ce_init_pipes()
864 if (pipe->dest_ring) { in ath11k_ce_init_pipes()
865 ret = ath11k_ce_init_ring(ab, pipe->dest_ring, i, in ath11k_ce_init_pipes()
874 pipe->rx_buf_needed = pipe->dest_ring->nentries ? in ath11k_ce_init_pipes()
875 pipe->dest_ring->nentries - 2 : 0; in ath11k_ce_init_pipes()
877 pipe->dest_ring->write_index = 0; in ath11k_ce_init_pipes()
878 pipe->dest_ring->sw_index = 0; in ath11k_ce_init_pipes()
881 if (pipe->status_ring) { in ath11k_ce_init_pipes()
882 ret = ath11k_ce_init_ring(ab, pipe->status_ring, i, in ath11k_ce_init_pipes()
891 pipe->status_ring->write_index = 0; in ath11k_ce_init_pipes()
892 pipe->status_ring->sw_index = 0; in ath11k_ce_init_pipes()
901 struct ath11k_ce_pipe *pipe; in ath11k_ce_free_pipes() local
906 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_free_pipes()
911 if (pipe->src_ring) { in ath11k_ce_free_pipes()
914 pipe->src_ring->nentries * desc_sz + in ath11k_ce_free_pipes()
916 pipe->src_ring->base_addr_owner_space, in ath11k_ce_free_pipes()
917 pipe->src_ring->base_addr_ce_space); in ath11k_ce_free_pipes()
918 kfree(pipe->src_ring); in ath11k_ce_free_pipes()
919 pipe->src_ring = NULL; in ath11k_ce_free_pipes()
922 if (pipe->dest_ring) { in ath11k_ce_free_pipes()
925 pipe->dest_ring->nentries * desc_sz + in ath11k_ce_free_pipes()
927 pipe->dest_ring->base_addr_owner_space, in ath11k_ce_free_pipes()
928 pipe->dest_ring->base_addr_ce_space); in ath11k_ce_free_pipes()
929 kfree(pipe->dest_ring); in ath11k_ce_free_pipes()
930 pipe->dest_ring = NULL; in ath11k_ce_free_pipes()
933 if (pipe->status_ring) { in ath11k_ce_free_pipes()
937 pipe->status_ring->nentries * desc_sz + in ath11k_ce_free_pipes()
939 pipe->status_ring->base_addr_owner_space, in ath11k_ce_free_pipes()
940 pipe->status_ring->base_addr_ce_space); in ath11k_ce_free_pipes()
941 kfree(pipe->status_ring); in ath11k_ce_free_pipes()
942 pipe->status_ring = NULL; in ath11k_ce_free_pipes()
950 struct ath11k_ce_pipe *pipe; in ath11k_ce_alloc_pipes() local
959 pipe = &ab->ce.ce_pipe[i]; in ath11k_ce_alloc_pipes()
960 pipe->pipe_num = i; in ath11k_ce_alloc_pipes()
961 pipe->ab = ab; in ath11k_ce_alloc_pipes()
962 pipe->buf_sz = attr->src_sz_max; in ath11k_ce_alloc_pipes()