Lines Matching full:vring
71 struct wil_ring *vring = &wil->ring_tx[i]; in wil_is_tx_idle() local
72 int vring_index = vring - wil->ring_tx; in wil_is_tx_idle()
78 if (!vring->va || !txdata->enabled) { in wil_is_tx_idle()
86 while (!wil_ring_is_empty(vring)) { in wil_is_tx_idle()
94 "tx vring is not empty -> NAPI\n"); in wil_is_tx_idle()
99 if (!vring->va || !txdata->enabled) in wil_is_tx_idle()
110 static int wil_vring_alloc(struct wil6210_priv *wil, struct wil_ring *vring) in wil_vring_alloc() argument
113 size_t sz = vring->size * sizeof(vring->va[0]); in wil_vring_alloc()
118 BUILD_BUG_ON(sizeof(vring->va[0]) != 32); in wil_vring_alloc()
120 vring->swhead = 0; in wil_vring_alloc()
121 vring->swtail = 0; in wil_vring_alloc()
122 vring->ctx = kcalloc(vring->size, sizeof(vring->ctx[0]), GFP_KERNEL); in wil_vring_alloc()
123 if (!vring->ctx) { in wil_vring_alloc()
124 vring->va = NULL; in wil_vring_alloc()
128 /* vring->va should be aligned on its size rounded up to power of 2 in wil_vring_alloc()
134 * allocation before allocating vring memory. in wil_vring_alloc()
143 vring->va = dma_alloc_coherent(dev, sz, &vring->pa, GFP_KERNEL); in wil_vring_alloc()
144 if (!vring->va) { in wil_vring_alloc()
145 kfree(vring->ctx); in wil_vring_alloc()
146 vring->ctx = NULL; in wil_vring_alloc()
158 for (i = 0; i < vring->size; i++) { in wil_vring_alloc()
160 &vring->va[i].tx.legacy; in wil_vring_alloc()
165 wil_dbg_misc(wil, "vring[%d] 0x%p:%pad 0x%p\n", vring->size, in wil_vring_alloc()
166 vring->va, &vring->pa, vring->ctx); in wil_vring_alloc()
190 static void wil_vring_free(struct wil6210_priv *wil, struct wil_ring *vring) in wil_vring_free() argument
193 size_t sz = vring->size * sizeof(vring->va[0]); in wil_vring_free()
196 if (!vring->is_rx) { in wil_vring_free()
197 int vring_index = vring - wil->ring_tx; in wil_vring_free()
199 wil_dbg_misc(wil, "free Tx vring %d [%d] 0x%p:%pad 0x%p\n", in wil_vring_free()
200 vring_index, vring->size, vring->va, in wil_vring_free()
201 &vring->pa, vring->ctx); in wil_vring_free()
203 wil_dbg_misc(wil, "free Rx vring [%d] 0x%p:%pad 0x%p\n", in wil_vring_free()
204 vring->size, vring->va, in wil_vring_free()
205 &vring->pa, vring->ctx); in wil_vring_free()
208 while (!wil_ring_is_empty(vring)) { in wil_vring_free()
213 if (!vring->is_rx) { in wil_vring_free()
216 &vring->va[vring->swtail].tx.legacy; in wil_vring_free()
218 ctx = &vring->ctx[vring->swtail]; in wil_vring_free()
222 vring->swtail); in wil_vring_free()
223 vring->swtail = wil_ring_next_tail(vring); in wil_vring_free()
230 vring->swtail = wil_ring_next_tail(vring); in wil_vring_free()
234 &vring->va[vring->swhead].rx.legacy; in wil_vring_free()
236 ctx = &vring->ctx[vring->swhead]; in wil_vring_free()
242 wil_ring_advance_head(vring, 1); in wil_vring_free()
245 dma_free_coherent(dev, sz, (void *)vring->va, vring->pa); in wil_vring_free()
246 kfree(vring->ctx); in wil_vring_free()
247 vring->pa = 0; in wil_vring_free()
248 vring->va = NULL; in wil_vring_free()
249 vring->ctx = NULL; in wil_vring_free()
252 /* Allocate one skb for Rx VRING
256 static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct wil_ring *vring, in wil_vring_alloc_skb() argument
262 volatile struct vring_rx_desc *_d = &vring->va[i].rx.legacy; in wil_vring_alloc_skb()
292 vring->ctx[i].skb = skb; in wil_vring_alloc_skb()
440 struct wil_ring *vring) in wil_vring_reap_rx() argument
460 if (unlikely(wil_ring_is_empty(vring))) in wil_vring_reap_rx()
463 i = (int)vring->swhead; in wil_vring_reap_rx()
464 _d = &vring->va[i].rx.legacy; in wil_vring_reap_rx()
470 skb = vring->ctx[i].skb; in wil_vring_reap_rx()
471 vring->ctx[i].skb = NULL; in wil_vring_reap_rx()
472 wil_ring_advance_head(vring, 1); in wil_vring_reap_rx()
1001 /* Proceed all completed skb's from Rx VRING
1051 struct wil_ring *vring = &wil->ring_rx; in wil_rx_init() local
1056 if (vring->va) { in wil_rx_init()
1063 vring->size = 1 << order; in wil_rx_init()
1064 vring->is_rx = true; in wil_rx_init()
1065 rc = wil_vring_alloc(wil, vring); in wil_rx_init()
1069 rc = wmi_rx_chain_add(wil, vring); in wil_rx_init()
1073 rc = wil_rx_refill(wil, vring->size); in wil_rx_init()
1079 wil_vring_free(wil, vring); in wil_rx_init()
1086 struct wil_ring *vring = &wil->ring_rx; in wil_rx_fini() local
1090 if (vring->va) in wil_rx_fini()
1091 wil_vring_free(wil, vring); in wil_rx_fini()
1164 struct wil_ring *vring = &wil->ring_tx[id]; in wil_vring_init_tx() local
1179 if (vring->va) { in wil_vring_init_tx()
1186 vring->is_rx = false; in wil_vring_init_tx()
1187 vring->size = size; in wil_vring_init_tx()
1188 rc = wil_vring_alloc(wil, vring); in wil_vring_init_tx()
1195 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); in wil_vring_init_tx()
1213 vring->hwtail = le32_to_cpu(reply.cmd.tx_vring_tail_ptr); in wil_vring_init_tx()
1227 wil_vring_free(wil, vring); in wil_vring_init_tx()
1267 struct wil_ring *vring = &wil->ring_tx[ring_id]; in wil_tx_vring_modify() local
1274 if (!vring->va) { in wil_tx_vring_modify()
1286 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); in wil_tx_vring_modify()
1341 struct wil_ring *vring = &wil->ring_tx[id]; in wil_vring_init_bcast() local
1348 if (vring->va) { in wil_vring_init_bcast()
1355 vring->is_rx = false; in wil_vring_init_bcast()
1356 vring->size = size; in wil_vring_init_bcast()
1357 rc = wil_vring_alloc(wil, vring); in wil_vring_init_bcast()
1364 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); in wil_vring_init_bcast()
1383 vring->hwtail = le32_to_cpu(reply.cmd.tx_vring_tail_ptr); in wil_vring_init_bcast()
1394 wil_vring_free(wil, vring); in wil_vring_init_bcast()
1428 "find_tx_ucast: vring[%d] not valid\n", in wil_find_tx_ucast()
1451 /* In the STA mode, it is expected to have only 1 VRING in wil_find_tx_ring_sta()
1453 * find 1-st vring eligible for this skb and use it. in wil_find_tx_ring_sta()
1482 * use dedicated broadcast vring
1484 * Find 1-st vring and return it;
1561 /* find 1-st vring eligible for data */ in wil_find_tx_bcast_2()
1726 struct wil_ring *vring, struct sk_buff *skb) in __wil_tx_vring_tso() argument
1745 u32 swhead = vring->swhead; in __wil_tx_vring_tso()
1746 int used, avail = wil_ring_avail_tx(vring); in __wil_tx_vring_tso()
1751 int vring_index = vring - wil->ring_tx; in __wil_tx_vring_tso()
1766 wil_dbg_txrx(wil, "tx_vring_tso: %d bytes to vring %d\n", skb->len, in __wil_tx_vring_tso()
1818 _hdr_desc = &vring->va[i].tx.legacy; in __wil_tx_vring_tso()
1832 vring->ctx[i].mapped_as = wil_mapped_as_single; in __wil_tx_vring_tso()
1833 hdr_ctx = &vring->ctx[i]; in __wil_tx_vring_tso()
1861 i = (swhead + descs_used) % vring->size; in __wil_tx_vring_tso()
1868 vring->ctx[i].mapped_as = wil_mapped_as_page; in __wil_tx_vring_tso()
1875 vring->ctx[i].mapped_as = wil_mapped_as_single; in __wil_tx_vring_tso()
1884 _desc = &vring->va[i].tx.legacy; in __wil_tx_vring_tso()
1888 first_ctx = &vring->ctx[i]; in __wil_tx_vring_tso()
1973 vring->ctx[i].skb = skb_get(skb); in __wil_tx_vring_tso()
1976 used = wil_ring_used_tx(vring); in __wil_tx_vring_tso()
1992 wil_ring_advance_head(vring, descs_used); in __wil_tx_vring_tso()
1993 wil_dbg_txrx(wil, "TSO: Tx swhead %d -> %d\n", swhead, vring->swhead); in __wil_tx_vring_tso()
2005 wil_w(wil, vring->hwtail, vring->swhead); in __wil_tx_vring_tso()
2012 i = (swhead + descs_used - 1) % vring->size; in __wil_tx_vring_tso()
2013 d = (struct vring_tx_desc *)&vring->va[i].tx.legacy; in __wil_tx_vring_tso()
2014 _desc = &vring->va[i].tx.legacy; in __wil_tx_vring_tso()
2017 ctx = &vring->ctx[i]; in __wil_tx_vring_tso()
2218 * vring is the vring which is currently being modified by either adding
2222 * The implementation is to stop net queues if modified vring has low
2224 * availability and modified vring has high descriptor availability.
2238 wil_dbg_txrx(wil, "vring %d, mid %d, check_stop=%d, stopped=%d", in __wil_update_net_queues()
2255 /* not enough room in the vring */ in __wil_update_net_queues()
2337 /* find vring */ in wil_start_xmit()
2339 /* in STA mode (ESS), all to same VRING (to AP) */ in wil_start_xmit()
2343 /* in pbss, no bcast VRING - duplicate skb in in wil_start_xmit()
2348 /* AP has a dedicated bcast VRING */ in wil_start_xmit()
2356 /* unicast, find specific VRING by dest. address */ in wil_start_xmit()
2363 /* set up vring entry */ in wil_start_xmit()
2412 /* Clean up transmitted skb's from the Tx VRING
2423 struct wil_ring *vring = &wil->ring_tx[ringid]; in wil_tx_complete() local
2432 if (unlikely(!vring->va)) { in wil_tx_complete()
2433 wil_err(wil, "Tx irq[%d]: vring not initialized\n", ringid); in wil_tx_complete()
2438 wil_info(wil, "Tx irq[%d]: vring disabled\n", ringid); in wil_tx_complete()
2444 used_before_complete = wil_ring_used_tx(vring); in wil_tx_complete()
2449 while (!wil_ring_is_empty(vring)) { in wil_tx_complete()
2451 struct wil_ctx *ctx = &vring->ctx[vring->swtail]; in wil_tx_complete()
2456 int lf = (vring->swtail + ctx->nr_frags) % vring->size; in wil_tx_complete()
2459 _d = &vring->va[lf].tx.legacy; in wil_tx_complete()
2463 new_swtail = (lf + 1) % vring->size; in wil_tx_complete()
2464 while (vring->swtail != new_swtail) { in wil_tx_complete()
2469 ctx = &vring->ctx[vring->swtail]; in wil_tx_complete()
2471 _d = &vring->va[vring->swtail].tx.legacy; in wil_tx_complete()
2476 trace_wil6210_tx_done(ringid, vring->swtail, dmalen, in wil_tx_complete()
2480 ringid, vring->swtail, dmalen, in wil_tx_complete()
2523 vring->swtail = wil_ring_next_tail(vring); in wil_tx_complete()
2529 used_new = wil_ring_used_tx(vring); in wil_tx_complete()
2539 wil_update_net_queues(wil, vif, vring, false); in wil_tx_complete()