Lines Matching refs:fdma
57 static int ocelot_fdma_rx_ring_free(struct ocelot_fdma *fdma) in ocelot_fdma_rx_ring_free() argument
59 struct ocelot_fdma_rx_ring *rx_ring = &fdma->rx_ring; in ocelot_fdma_rx_ring_free()
68 static int ocelot_fdma_tx_ring_free(struct ocelot_fdma *fdma) in ocelot_fdma_tx_ring_free() argument
70 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring; in ocelot_fdma_tx_ring_free()
79 static bool ocelot_fdma_tx_ring_empty(struct ocelot_fdma *fdma) in ocelot_fdma_tx_ring_empty() argument
81 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring; in ocelot_fdma_tx_ring_empty()
149 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_alloc_rx_buffs() local
157 rx_ring = &fdma->rx_ring; in ocelot_fdma_alloc_rx_buffs()
237 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_rx_restart() local
245 rx_ring = &fdma->rx_ring; in ocelot_fdma_rx_restart()
299 struct ocelot_fdma_rx_ring *rx_ring = &ocelot->fdma->rx_ring; in ocelot_fdma_reuse_rx_page()
391 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_rx_get() local
401 cleaned_cnt = ocelot_fdma_rx_ring_free(fdma); in ocelot_fdma_rx_get()
402 rx_ring = &fdma->rx_ring; in ocelot_fdma_rx_get()
483 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_tx_cleanup() local
495 tx_ring = &fdma->tx_ring; in ocelot_fdma_tx_cleanup()
500 while (!ocelot_fdma_tx_ring_empty(fdma)) { in ocelot_fdma_tx_cleanup()
525 if (ocelot_fdma_tx_ring_free(fdma)) in ocelot_fdma_tx_cleanup()
531 if (!end_of_list || ocelot_fdma_tx_ring_empty(fdma)) in ocelot_fdma_tx_cleanup()
553 struct ocelot_fdma *fdma = container_of(napi, struct ocelot_fdma, napi); in ocelot_fdma_napi_poll() local
554 struct ocelot *ocelot = fdma->ocelot; in ocelot_fdma_napi_poll()
568 napi_complete_done(&fdma->napi, work_done); in ocelot_fdma_napi_poll()
590 napi_schedule(&ocelot->fdma->napi); in ocelot_fdma_interrupt()
608 struct ocelot_fdma *fdma, struct sk_buff *skb) in ocelot_fdma_send_skb() argument
610 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring; in ocelot_fdma_send_skb()
628 if (ocelot_fdma_tx_ring_empty(fdma)) { in ocelot_fdma_send_skb()
677 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_inject_frame() local
680 spin_lock(&fdma->tx_ring.xmit_lock); in ocelot_fdma_inject_frame()
682 if (ocelot_fdma_tx_ring_free(fdma) == 0) { in ocelot_fdma_inject_frame()
691 ocelot_fdma_send_skb(ocelot, fdma, skb); in ocelot_fdma_inject_frame()
694 spin_unlock(&fdma->tx_ring.xmit_lock); in ocelot_fdma_inject_frame()
701 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_free_rx_ring() local
706 rx_ring = &fdma->rx_ring; in ocelot_fdma_free_rx_ring()
718 if (fdma->rx_ring.skb) in ocelot_fdma_free_rx_ring()
719 dev_kfree_skb_any(fdma->rx_ring.skb); in ocelot_fdma_free_rx_ring()
724 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_free_tx_ring() local
730 tx_ring = &fdma->tx_ring; in ocelot_fdma_free_tx_ring()
745 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_rings_alloc() local
752 fdma->dcbs_base = dmam_alloc_coherent(ocelot->dev, in ocelot_fdma_rings_alloc()
754 &fdma->dcbs_dma_base, GFP_KERNEL); in ocelot_fdma_rings_alloc()
755 if (!fdma->dcbs_base) in ocelot_fdma_rings_alloc()
759 dcbs = fdma->dcbs_base; in ocelot_fdma_rings_alloc()
760 dcbs_dma = fdma->dcbs_dma_base; in ocelot_fdma_rings_alloc()
768 fdma->tx_ring.dcbs = dcbs; in ocelot_fdma_rings_alloc()
769 fdma->tx_ring.dcbs_dma = dcbs_dma; in ocelot_fdma_rings_alloc()
770 spin_lock_init(&fdma->tx_ring.xmit_lock); in ocelot_fdma_rings_alloc()
773 fdma->rx_ring.dcbs = dcbs + OCELOT_FDMA_TX_RING_SIZE; in ocelot_fdma_rings_alloc()
774 fdma->rx_ring.dcbs_dma = dcbs_dma + OCELOT_FDMA_TX_DCB_SIZE; in ocelot_fdma_rings_alloc()
776 ocelot_fdma_tx_ring_free(fdma)); in ocelot_fdma_rings_alloc()
785 ocelot_fdma_rx_set_llp(&fdma->rx_ring); in ocelot_fdma_rings_alloc()
792 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_netdev_init() local
797 if (fdma->ndev) in ocelot_fdma_netdev_init()
800 fdma->ndev = dev; in ocelot_fdma_netdev_init()
801 netif_napi_add_weight(dev, &fdma->napi, ocelot_fdma_napi_poll, in ocelot_fdma_netdev_init()
807 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_netdev_deinit() local
809 if (fdma->ndev == dev) { in ocelot_fdma_netdev_deinit()
810 netif_napi_del(&fdma->napi); in ocelot_fdma_netdev_deinit()
811 fdma->ndev = NULL; in ocelot_fdma_netdev_deinit()
818 struct ocelot_fdma *fdma; in ocelot_fdma_init() local
821 fdma = devm_kzalloc(dev, sizeof(*fdma), GFP_KERNEL); in ocelot_fdma_init()
822 if (!fdma) in ocelot_fdma_init()
825 ocelot->fdma = fdma; in ocelot_fdma_init()
830 fdma->ocelot = ocelot; in ocelot_fdma_init()
831 fdma->irq = platform_get_irq_byname(pdev, "fdma"); in ocelot_fdma_init()
832 ret = devm_request_irq(dev, fdma->irq, ocelot_fdma_interrupt, 0, in ocelot_fdma_init()
846 devm_free_irq(dev, fdma->irq, fdma); in ocelot_fdma_init()
848 devm_kfree(dev, fdma); in ocelot_fdma_init()
850 ocelot->fdma = NULL; in ocelot_fdma_init()
855 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_start() local
873 napi_enable(&fdma->napi); in ocelot_fdma_start()
875 ocelot_fdma_activate_chan(ocelot, ocelot->fdma->rx_ring.dcbs_dma, in ocelot_fdma_start()
881 struct ocelot_fdma *fdma = ocelot->fdma; in ocelot_fdma_deinit() local
888 napi_synchronize(&fdma->napi); in ocelot_fdma_deinit()
889 napi_disable(&fdma->napi); in ocelot_fdma_deinit()