Lines Matching refs:sring

60 			   struct wil_status_ring *sring)  in wil_sring_free()  argument
65 if (!sring || !sring->va) in wil_sring_free()
68 sz = sring->elem_size * sring->size; in wil_sring_free()
71 sz, sring->va, &sring->pa); in wil_sring_free()
73 dma_free_coherent(dev, sz, (void *)sring->va, sring->pa); in wil_sring_free()
74 sring->pa = 0; in wil_sring_free()
75 sring->va = NULL; in wil_sring_free()
79 struct wil_status_ring *sring) in wil_sring_alloc() argument
82 size_t sz = sring->elem_size * sring->size; in wil_sring_alloc()
91 sring->swhead = 0; in wil_sring_alloc()
96 sring->va = dma_alloc_coherent(dev, sz, &sring->pa, GFP_KERNEL); in wil_sring_alloc()
97 if (!sring->va) in wil_sring_alloc()
100 wil_dbg_misc(wil, "status_ring[%d] 0x%p:%pad\n", sring->size, sring->va, in wil_sring_alloc()
101 &sring->pa); in wil_sring_alloc()
109 struct wil_status_ring *sring; in wil_tx_init_edma() local
128 sring = &wil->srings[ring_id]; in wil_tx_init_edma()
130 sring->is_rx = false; in wil_tx_init_edma()
131 sring->size = status_ring_size; in wil_tx_init_edma()
132 sring->elem_size = sizeof(struct wil_ring_tx_status); in wil_tx_init_edma()
133 rc = wil_sring_alloc(wil, sring); in wil_tx_init_edma()
141 sring->desc_rdy_pol = 1; in wil_tx_init_edma()
146 wil_sring_free(wil, sring); in wil_tx_init_edma()
211 void wil_get_next_rx_status_msg(struct wil_status_ring *sring, u8 *dr_bit, in wil_get_next_rx_status_msg() argument
217 (sring->va + (sring->elem_size * sring->swhead)); in wil_get_next_rx_status_msg()
221 memcpy(msg, (void *)_msg, sring->elem_size); in wil_get_next_rx_status_msg()
224 static inline void wil_sring_advance_swhead(struct wil_status_ring *sring) in wil_sring_advance_swhead() argument
226 sring->swhead = (sring->swhead + 1) % sring->size; in wil_sring_advance_swhead()
227 if (sring->swhead == 0) in wil_sring_advance_swhead()
228 sring->desc_rdy_pol = 1 - sring->desc_rdy_pol; in wil_sring_advance_swhead()
346 struct wil_status_ring *sring = &wil->srings[ring_id]; in wil_init_rx_sring() local
352 memset(&sring->rx_data, 0, sizeof(sring->rx_data)); in wil_init_rx_sring()
354 sring->is_rx = true; in wil_init_rx_sring()
355 sring->size = status_ring_size; in wil_init_rx_sring()
356 sring->elem_size = elem_size; in wil_init_rx_sring()
357 rc = wil_sring_alloc(wil, sring); in wil_init_rx_sring()
365 sring->desc_rdy_pol = 1; in wil_init_rx_sring()
369 wil_sring_free(wil, sring); in wil_init_rx_sring()
573 struct wil_status_ring *sring; in wil_is_rx_idle_edma() local
580 sring = &wil->srings[i]; in wil_is_rx_idle_edma()
581 if (!sring->va) in wil_is_rx_idle_edma()
584 wil_get_next_rx_status_msg(sring, &dr_bit, msg); in wil_is_rx_idle_edma()
587 if (dr_bit == sring->desc_rdy_pol) in wil_is_rx_idle_edma()
851 struct wil_status_ring *sring) in wil_sring_reap_rx_edma() argument
859 struct wil_ring_rx_data *rxdata = &sring->rx_data; in wil_sring_reap_rx_edma()
869 u16 sring_idx = sring - wil->srings; in wil_sring_reap_rx_edma()
875 wil_get_next_rx_status_msg(sring, &dr_bit, msg); in wil_sring_reap_rx_edma()
878 if (dr_bit != sring->desc_rdy_pol) in wil_sring_reap_rx_edma()
890 sring->swhead); in wil_sring_reap_rx_edma()
896 (sring->va + (sring->elem_size * sring->swhead)); in wil_sring_reap_rx_edma()
903 buff_id, sring->swhead); in wil_sring_reap_rx_edma()
909 wil_rx_status_reset_buff_id(sring); in wil_sring_reap_rx_edma()
910 wil_sring_advance_swhead(sring); in wil_sring_reap_rx_edma()
911 sring->invalid_buff_id_cnt++; in wil_sring_reap_rx_edma()
920 wil_rx_status_reset_buff_id(sring); in wil_sring_reap_rx_edma()
924 wil_sring_advance_swhead(sring); in wil_sring_reap_rx_edma()
925 sring->invalid_buff_id_cnt++; in wil_sring_reap_rx_edma()
929 wil_rx_status_reset_buff_id(sring); in wil_sring_reap_rx_edma()
930 wil_sring_advance_swhead(sring); in wil_sring_reap_rx_edma()
954 cid, sring->swhead); in wil_sring_reap_rx_edma()
1061 memcpy(s, msg, sring->elem_size); in wil_sring_reap_rx_edma()
1070 struct wil_status_ring *sring; in wil_rx_handle_edma() local
1081 sring = &wil->srings[i]; in wil_rx_handle_edma()
1082 if (unlikely(!sring->va)) { in wil_rx_handle_edma()
1091 wil_sring_reap_rx_edma(wil, sring)))) { in wil_rx_handle_edma()
1112 wil_w(wil, sring->hwtail, (sring->swhead - 1) % sring->size); in wil_rx_handle_edma()
1143 wil_get_next_tx_status_msg(struct wil_status_ring *sring, u8 *dr_bit, in wil_get_next_tx_status_msg() argument
1147 (sring->va + (sring->elem_size * sring->swhead)); in wil_get_next_tx_status_msg()
1159 struct wil_status_ring *sring) in wil_tx_sring_handler() argument
1179 wil_get_next_tx_status_msg(sring, &dr_bit, &msg); in wil_tx_sring_handler()
1182 while (dr_bit == sring->desc_rdy_pol) { in wil_tx_sring_handler()
1298 wil_w(wil, sring->hwtail, sring->swhead); in wil_tx_sring_handler()
1300 wil_sring_advance_swhead(sring); in wil_tx_sring_handler()
1302 wil_get_next_tx_status_msg(sring, &dr_bit, &msg); in wil_tx_sring_handler()
1311 wil_w(wil, sring->hwtail, (sring->swhead - 1) % sring->size); in wil_tx_sring_handler()
1590 struct wil_status_ring *sring = &wil->srings[wil->tx_sring_idx]; in wil_tx_fini_edma() local
1594 wil_sring_free(wil, sring); in wil_tx_fini_edma()
1597 static void wil_rx_data_free(struct wil_status_ring *sring) in wil_rx_data_free() argument
1599 if (!sring) in wil_rx_data_free()
1602 kfree_skb(sring->rx_data.skb); in wil_rx_data_free()
1603 sring->rx_data.skb = NULL; in wil_rx_data_free()