Lines Matching full:fdma
27 static int sparx5_fdma_tx_dataptr_cb(struct fdma *fdma, int dcb, int db, in sparx5_fdma_tx_dataptr_cb() argument
30 *dataptr = fdma->dma + (sizeof(struct fdma_dcb) * fdma->n_dcbs) + in sparx5_fdma_tx_dataptr_cb()
31 ((dcb * fdma->n_dbs + db) * fdma->db_size); in sparx5_fdma_tx_dataptr_cb()
36 static int sparx5_fdma_rx_dataptr_cb(struct fdma *fdma, int dcb, int db, in sparx5_fdma_rx_dataptr_cb() argument
39 struct sparx5 *sparx5 = fdma->priv; in sparx5_fdma_rx_dataptr_cb()
43 skb = __netdev_alloc_skb(rx->ndev, fdma->db_size, GFP_ATOMIC); in sparx5_fdma_rx_dataptr_cb()
56 struct fdma *fdma = &rx->fdma; in sparx5_fdma_rx_activate() local
59 spx5_wr(((u64)fdma->dma) & GENMASK(31, 0), sparx5, in sparx5_fdma_rx_activate()
60 FDMA_DCB_LLP(fdma->channel_id)); in sparx5_fdma_rx_activate()
61 spx5_wr(((u64)fdma->dma) >> 32, sparx5, in sparx5_fdma_rx_activate()
62 FDMA_DCB_LLP1(fdma->channel_id)); in sparx5_fdma_rx_activate()
65 spx5_wr(FDMA_CH_CFG_CH_DCB_DB_CNT_SET(fdma->n_dbs) | in sparx5_fdma_rx_activate()
68 sparx5, FDMA_CH_CFG(fdma->channel_id)); in sparx5_fdma_rx_activate()
75 /* Start RX fdma */ in sparx5_fdma_rx_activate()
80 spx5_rmw(BIT(fdma->channel_id), in sparx5_fdma_rx_activate()
81 BIT(fdma->channel_id) & FDMA_INTR_DB_ENA_INTR_DB_ENA, in sparx5_fdma_rx_activate()
85 spx5_wr(BIT(fdma->channel_id), sparx5, FDMA_CH_ACTIVATE); in sparx5_fdma_rx_activate()
90 struct fdma *fdma = &rx->fdma; in sparx5_fdma_rx_deactivate() local
93 spx5_rmw(0, BIT(fdma->channel_id) & FDMA_CH_ACTIVATE_CH_ACTIVATE, in sparx5_fdma_rx_deactivate()
97 spx5_rmw(0, BIT(fdma->channel_id) & FDMA_INTR_DB_ENA_INTR_DB_ENA, in sparx5_fdma_rx_deactivate()
100 /* Stop RX fdma */ in sparx5_fdma_rx_deactivate()
107 struct fdma *fdma = &tx->fdma; in sparx5_fdma_tx_activate() local
110 spx5_wr(((u64)fdma->dma) & GENMASK(31, 0), sparx5, in sparx5_fdma_tx_activate()
111 FDMA_DCB_LLP(fdma->channel_id)); in sparx5_fdma_tx_activate()
112 spx5_wr(((u64)fdma->dma) >> 32, sparx5, in sparx5_fdma_tx_activate()
113 FDMA_DCB_LLP1(fdma->channel_id)); in sparx5_fdma_tx_activate()
116 spx5_wr(FDMA_CH_CFG_CH_DCB_DB_CNT_SET(fdma->n_dbs) | in sparx5_fdma_tx_activate()
119 sparx5, FDMA_CH_CFG(fdma->channel_id)); in sparx5_fdma_tx_activate()
121 /* Start TX fdma */ in sparx5_fdma_tx_activate()
126 spx5_wr(BIT(fdma->channel_id), sparx5, FDMA_CH_ACTIVATE); in sparx5_fdma_tx_activate()
132 spx5_rmw(0, BIT(tx->fdma.channel_id) & FDMA_CH_ACTIVATE_CH_ACTIVATE, in sparx5_fdma_tx_deactivate()
136 static void sparx5_fdma_reload(struct sparx5 *sparx5, struct fdma *fdma) in sparx5_fdma_reload() argument
139 spx5_wr(BIT(fdma->channel_id), sparx5, FDMA_CH_RELOAD); in sparx5_fdma_reload()
144 struct fdma *fdma = &rx->fdma; in sparx5_fdma_rx_get_frame() local
151 db_hw = fdma_db_next_get(fdma); in sparx5_fdma_rx_get_frame()
154 skb = rx->skb[fdma->dcb_index][fdma->db_index]; in sparx5_fdma_rx_get_frame()
188 struct fdma *fdma = &rx->fdma; in sparx5_fdma_napi_callback() local
192 fdma_db_advance(fdma); in sparx5_fdma_napi_callback()
195 if (fdma_dcb_is_reusable(fdma)) in sparx5_fdma_napi_callback()
197 fdma_dcb_add(fdma, fdma->dcb_index, in sparx5_fdma_napi_callback()
198 FDMA_DCB_INFO_DATAL(fdma->db_size), in sparx5_fdma_napi_callback()
200 fdma_db_reset(fdma); in sparx5_fdma_napi_callback()
201 fdma_dcb_advance(fdma); in sparx5_fdma_napi_callback()
205 spx5_rmw(BIT(fdma->channel_id), in sparx5_fdma_napi_callback()
206 BIT(fdma->channel_id) & FDMA_INTR_DB_ENA_INTR_DB_ENA, in sparx5_fdma_napi_callback()
210 sparx5_fdma_reload(sparx5, fdma); in sparx5_fdma_napi_callback()
217 struct fdma *fdma = &tx->fdma; in sparx5_fdma_xmit() local
221 fdma_dcb_advance(fdma); in sparx5_fdma_xmit()
222 if (!fdma_db_is_done(fdma_db_get(fdma, fdma->dcb_index, 0))) in sparx5_fdma_xmit()
226 virt_addr = ((u8 *)fdma->dcbs + in sparx5_fdma_xmit()
227 (sizeof(struct fdma_dcb) * fdma->n_dcbs) + in sparx5_fdma_xmit()
228 ((fdma->dcb_index * fdma->n_dbs) * fdma->db_size)); in sparx5_fdma_xmit()
233 fdma_dcb_add(fdma, fdma->dcb_index, 0, in sparx5_fdma_xmit()
243 sparx5_fdma_reload(sparx5, fdma); in sparx5_fdma_xmit()
251 struct fdma *fdma = &rx->fdma; in sparx5_fdma_rx_alloc() local
254 err = fdma_alloc_phys(fdma); in sparx5_fdma_rx_alloc()
258 fdma_dcbs_init(fdma, FDMA_DCB_INFO_DATAL(fdma->db_size), in sparx5_fdma_rx_alloc()
271 struct fdma *fdma = &tx->fdma; in sparx5_fdma_tx_alloc() local
274 err = fdma_alloc_phys(fdma); in sparx5_fdma_tx_alloc()
278 fdma_dcbs_init(fdma, FDMA_DCB_INFO_DATAL(fdma->db_size), in sparx5_fdma_tx_alloc()
287 struct fdma *fdma = &rx->fdma; in sparx5_fdma_rx_init() local
290 fdma->channel_id = channel; in sparx5_fdma_rx_init()
291 fdma->n_dcbs = FDMA_DCB_MAX; in sparx5_fdma_rx_init()
292 fdma->n_dbs = FDMA_RX_DCB_MAX_DBS; in sparx5_fdma_rx_init()
293 fdma->priv = sparx5; in sparx5_fdma_rx_init()
294 fdma->db_size = ALIGN(FDMA_XTR_BUFFER_SIZE, PAGE_SIZE); in sparx5_fdma_rx_init()
295 fdma->size = fdma_get_size(&sparx5->rx.fdma); in sparx5_fdma_rx_init()
296 fdma->ops.dataptr_cb = &sparx5_fdma_rx_dataptr_cb; in sparx5_fdma_rx_init()
297 fdma->ops.nextptr_cb = &fdma_nextptr_cb; in sparx5_fdma_rx_init()
312 struct fdma *fdma = &tx->fdma; in sparx5_fdma_tx_init() local
314 fdma->channel_id = channel; in sparx5_fdma_tx_init()
315 fdma->n_dcbs = FDMA_DCB_MAX; in sparx5_fdma_tx_init()
316 fdma->n_dbs = FDMA_TX_DCB_MAX_DBS; in sparx5_fdma_tx_init()
317 fdma->priv = sparx5; in sparx5_fdma_tx_init()
318 fdma->db_size = ALIGN(FDMA_XTR_BUFFER_SIZE, PAGE_SIZE); in sparx5_fdma_tx_init()
319 fdma->size = fdma_get_size_contiguous(&sparx5->tx.fdma); in sparx5_fdma_tx_init()
320 fdma->ops.dataptr_cb = &sparx5_fdma_tx_dataptr_cb; in sparx5_fdma_tx_init()
321 fdma->ops.nextptr_cb = &fdma_nextptr_cb; in sparx5_fdma_tx_init()
355 /* Change mode to fdma extraction and injection */ in sparx5_fdma_injection_mode()
413 /* Reset FDMA state */ in sparx5_fdma_start()
452 /* Stop the fdma and channel interrupts */ in sparx5_fdma_stop()
459 fdma_free_phys(&sparx5->rx.fdma); in sparx5_fdma_stop()
460 fdma_free_phys(&sparx5->tx.fdma); in sparx5_fdma_stop()