Lines Matching refs:pipe

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