Lines Matching full:fdma

9 static int lan966x_fdma_rx_dataptr_cb(struct fdma *fdma, int dcb, int db,  in lan966x_fdma_rx_dataptr_cb()  argument
12 struct lan966x *lan966x = (struct lan966x *)fdma->priv; in lan966x_fdma_rx_dataptr_cb()
26 static int lan966x_fdma_tx_dataptr_cb(struct fdma *fdma, int dcb, int db, in lan966x_fdma_tx_dataptr_cb() argument
29 struct lan966x *lan966x = (struct lan966x *)fdma->priv; in lan966x_fdma_tx_dataptr_cb()
36 static int lan966x_fdma_xdp_tx_dataptr_cb(struct fdma *fdma, int dcb, int db, in lan966x_fdma_xdp_tx_dataptr_cb() argument
39 struct lan966x *lan966x = (struct lan966x *)fdma->priv; in lan966x_fdma_xdp_tx_dataptr_cb()
53 struct fdma *fdma = &rx->fdma; in lan966x_fdma_rx_free_pages() local
56 for (i = 0; i < fdma->n_dcbs; ++i) { in lan966x_fdma_rx_free_pages()
57 for (j = 0; j < fdma->n_dbs; ++j) in lan966x_fdma_rx_free_pages()
65 struct fdma *fdma = &rx->fdma; in lan966x_fdma_rx_free_page() local
68 page = rx->page[fdma->dcb_index][fdma->db_index]; in lan966x_fdma_rx_free_page()
81 .pool_size = rx->fdma.n_dcbs, in lan966x_fdma_rx_alloc_page_pool()
113 struct fdma *fdma = &rx->fdma; in lan966x_fdma_rx_alloc() local
119 err = fdma_alloc_coherent(lan966x->dev, fdma); in lan966x_fdma_rx_alloc()
123 fdma_dcbs_init(fdma, FDMA_DCB_INFO_DATAL(fdma->db_size), in lan966x_fdma_rx_alloc()
132 struct fdma *fdma = &rx->fdma; in lan966x_fdma_rx_start() local
138 lan_wr(lower_32_bits((u64)fdma->dma), lan966x, in lan966x_fdma_rx_start()
139 FDMA_DCB_LLP(fdma->channel_id)); in lan966x_fdma_rx_start()
140 lan_wr(upper_32_bits((u64)fdma->dma), lan966x, in lan966x_fdma_rx_start()
141 FDMA_DCB_LLP1(fdma->channel_id)); in lan966x_fdma_rx_start()
143 lan_wr(FDMA_CH_CFG_CH_DCB_DB_CNT_SET(fdma->n_dbs) | in lan966x_fdma_rx_start()
147 lan966x, FDMA_CH_CFG(fdma->channel_id)); in lan966x_fdma_rx_start()
149 /* Start fdma */ in lan966x_fdma_rx_start()
157 mask |= BIT(fdma->channel_id); in lan966x_fdma_rx_start()
163 lan_rmw(FDMA_CH_ACTIVATE_CH_ACTIVATE_SET(BIT(fdma->channel_id)), in lan966x_fdma_rx_start()
171 struct fdma *fdma = &rx->fdma; in lan966x_fdma_rx_disable() local
175 lan_rmw(FDMA_CH_DISABLE_CH_DISABLE_SET(BIT(fdma->channel_id)), in lan966x_fdma_rx_disable()
180 val, !(val & BIT(fdma->channel_id)), in lan966x_fdma_rx_disable()
183 lan_rmw(FDMA_CH_DB_DISCARD_DB_DISCARD_SET(BIT(fdma->channel_id)), in lan966x_fdma_rx_disable()
192 lan_rmw(FDMA_CH_RELOAD_CH_RELOAD_SET(BIT(rx->fdma.channel_id)), in lan966x_fdma_rx_reload()
200 struct fdma *fdma = &tx->fdma; in lan966x_fdma_tx_alloc() local
203 tx->dcbs_buf = kcalloc(fdma->n_dcbs, sizeof(struct lan966x_tx_dcb_buf), in lan966x_fdma_tx_alloc()
208 err = fdma_alloc_coherent(lan966x->dev, fdma); in lan966x_fdma_tx_alloc()
212 fdma_dcbs_init(fdma, 0, 0); in lan966x_fdma_tx_alloc()
226 fdma_free_coherent(lan966x->dev, &tx->fdma); in lan966x_fdma_tx_free()
232 struct fdma *fdma = &tx->fdma; in lan966x_fdma_tx_activate() local
238 lan_wr(lower_32_bits((u64)fdma->dma), lan966x, in lan966x_fdma_tx_activate()
239 FDMA_DCB_LLP(fdma->channel_id)); in lan966x_fdma_tx_activate()
240 lan_wr(upper_32_bits((u64)fdma->dma), lan966x, in lan966x_fdma_tx_activate()
241 FDMA_DCB_LLP1(fdma->channel_id)); in lan966x_fdma_tx_activate()
243 lan_wr(FDMA_CH_CFG_CH_DCB_DB_CNT_SET(fdma->n_dbs) | in lan966x_fdma_tx_activate()
247 lan966x, FDMA_CH_CFG(fdma->channel_id)); in lan966x_fdma_tx_activate()
249 /* Start fdma */ in lan966x_fdma_tx_activate()
257 mask |= BIT(fdma->channel_id); in lan966x_fdma_tx_activate()
263 lan_rmw(FDMA_CH_ACTIVATE_CH_ACTIVATE_SET(BIT(fdma->channel_id)), in lan966x_fdma_tx_activate()
271 struct fdma *fdma = &tx->fdma; in lan966x_fdma_tx_disable() local
275 lan_rmw(FDMA_CH_DISABLE_CH_DISABLE_SET(BIT(fdma->channel_id)), in lan966x_fdma_tx_disable()
280 val, !(val & BIT(fdma->channel_id)), in lan966x_fdma_tx_disable()
283 lan_rmw(FDMA_CH_DB_DISCARD_DB_DISCARD_SET(BIT(fdma->channel_id)), in lan966x_fdma_tx_disable()
295 lan_rmw(FDMA_CH_RELOAD_CH_RELOAD_SET(BIT(tx->fdma.channel_id)), in lan966x_fdma_tx_reload()
334 struct fdma *fdma = &tx->fdma; in lan966x_fdma_tx_clear_buf() local
344 for (i = 0; i < fdma->n_dcbs; ++i) { in lan966x_fdma_tx_clear_buf()
350 db = fdma_db_get(fdma, i, 0); in lan966x_fdma_tx_clear_buf()
394 struct fdma *fdma = &rx->fdma; in lan966x_fdma_rx_check_frame() local
399 db = fdma_db_next_get(fdma); in lan966x_fdma_rx_check_frame()
400 page = rx->page[fdma->dcb_index][fdma->db_index]; in lan966x_fdma_rx_check_frame()
425 struct fdma *fdma = &rx->fdma; in lan966x_fdma_rx_get_frame() local
432 db = fdma_db_next_get(fdma); in lan966x_fdma_rx_get_frame()
433 page = rx->page[fdma->dcb_index][fdma->db_index]; in lan966x_fdma_rx_get_frame()
435 skb = build_skb(page_address(page), fdma->db_size); in lan966x_fdma_rx_get_frame()
479 struct fdma *fdma = &rx->fdma; in lan966x_fdma_napi_poll() local
484 dcb_reload = fdma->dcb_index; in lan966x_fdma_napi_poll()
490 if (!fdma_has_frames(fdma)) in lan966x_fdma_napi_poll()
500 fdma_dcb_advance(fdma); in lan966x_fdma_napi_poll()
506 fdma_dcb_advance(fdma); in lan966x_fdma_napi_poll()
510 fdma_dcb_advance(fdma); in lan966x_fdma_napi_poll()
515 fdma_dcb_advance(fdma); in lan966x_fdma_napi_poll()
524 while (dcb_reload != fdma->dcb_index) { in lan966x_fdma_napi_poll()
527 dcb_reload &= fdma->n_dcbs - 1; in lan966x_fdma_napi_poll()
529 fdma_dcb_add(fdma, old_dcb, FDMA_DCB_INFO_DATAL(fdma->db_size), in lan966x_fdma_napi_poll()
574 struct fdma *fdma = &tx->fdma; in lan966x_fdma_get_next_dcb() local
577 for (i = 0; i < fdma->n_dcbs; ++i) { in lan966x_fdma_get_next_dcb()
580 !fdma_is_last(&tx->fdma, &tx->fdma.dcbs[i])) in lan966x_fdma_get_next_dcb()
676 __fdma_dcb_add(&tx->fdma, in lan966x_fdma_xmit_xdpf()
757 fdma_dcb_add(&tx->fdma, in lan966x_fdma_xmit()
813 struct fdma fdma_rx_old; in lan966x_fdma_reload()
817 memcpy(&fdma_rx_old, &lan966x->rx.fdma, sizeof(struct fdma)); in lan966x_fdma_reload()
843 memcpy(&lan966x->rx.fdma, &fdma_rx_old, sizeof(struct fdma)); in lan966x_fdma_reload()
929 if (!lan966x->fdma) in lan966x_fdma_init()
933 lan966x->rx.fdma.channel_id = FDMA_XTR_CHANNEL; in lan966x_fdma_init()
934 lan966x->rx.fdma.n_dcbs = FDMA_DCB_MAX; in lan966x_fdma_init()
935 lan966x->rx.fdma.n_dbs = FDMA_RX_DCB_MAX_DBS; in lan966x_fdma_init()
936 lan966x->rx.fdma.priv = lan966x; in lan966x_fdma_init()
937 lan966x->rx.fdma.size = fdma_get_size(&lan966x->rx.fdma); in lan966x_fdma_init()
938 lan966x->rx.fdma.db_size = PAGE_SIZE << lan966x->rx.page_order; in lan966x_fdma_init()
939 lan966x->rx.fdma.ops.nextptr_cb = &fdma_nextptr_cb; in lan966x_fdma_init()
940 lan966x->rx.fdma.ops.dataptr_cb = &lan966x_fdma_rx_dataptr_cb; in lan966x_fdma_init()
943 lan966x->tx.fdma.channel_id = FDMA_INJ_CHANNEL; in lan966x_fdma_init()
944 lan966x->tx.fdma.n_dcbs = FDMA_DCB_MAX; in lan966x_fdma_init()
945 lan966x->tx.fdma.n_dbs = FDMA_TX_DCB_MAX_DBS; in lan966x_fdma_init()
946 lan966x->tx.fdma.priv = lan966x; in lan966x_fdma_init()
947 lan966x->tx.fdma.size = fdma_get_size(&lan966x->tx.fdma); in lan966x_fdma_init()
948 lan966x->tx.fdma.db_size = PAGE_SIZE << lan966x->rx.page_order; in lan966x_fdma_init()
949 lan966x->tx.fdma.ops.nextptr_cb = &fdma_nextptr_cb; in lan966x_fdma_init()
950 lan966x->tx.fdma.ops.dataptr_cb = &lan966x_fdma_tx_dataptr_cb; in lan966x_fdma_init()
958 fdma_free_coherent(lan966x->dev, &lan966x->rx.fdma); in lan966x_fdma_init()
969 if (!lan966x->fdma) in lan966x_fdma_deinit()
979 fdma_free_coherent(lan966x->dev, &lan966x->rx.fdma); in lan966x_fdma_deinit()