Lines Matching refs:fdma
56 static int ocelot_fdma_rx_ring_free(struct ocelot_fdma *fdma)
58 struct ocelot_fdma_rx_ring *rx_ring = &fdma->rx_ring;
67 static int ocelot_fdma_tx_ring_free(struct ocelot_fdma *fdma)
69 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring;
78 static bool ocelot_fdma_tx_ring_empty(struct ocelot_fdma *fdma)
80 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring;
148 struct ocelot_fdma *fdma = ocelot->fdma;
156 rx_ring = &fdma->rx_ring;
236 struct ocelot_fdma *fdma = ocelot->fdma;
244 rx_ring = &fdma->rx_ring;
298 struct ocelot_fdma_rx_ring *rx_ring = &ocelot->fdma->rx_ring;
391 struct ocelot_fdma *fdma = ocelot->fdma;
401 cleaned_cnt = ocelot_fdma_rx_ring_free(fdma);
402 rx_ring = &fdma->rx_ring;
483 struct ocelot_fdma *fdma = ocelot->fdma;
495 tx_ring = &fdma->tx_ring;
500 while (!ocelot_fdma_tx_ring_empty(fdma)) {
525 if (ocelot_fdma_tx_ring_free(fdma))
531 if (!end_of_list || ocelot_fdma_tx_ring_empty(fdma))
553 struct ocelot_fdma *fdma = container_of(napi, struct ocelot_fdma, napi);
554 struct ocelot *ocelot = fdma->ocelot;
568 napi_complete_done(&fdma->napi, work_done);
590 napi_schedule(&ocelot->fdma->napi);
608 struct ocelot_fdma *fdma, struct sk_buff *skb)
610 struct ocelot_fdma_tx_ring *tx_ring = &fdma->tx_ring;
628 if (ocelot_fdma_tx_ring_empty(fdma)) {
677 struct ocelot_fdma *fdma = ocelot->fdma;
680 spin_lock(&fdma->tx_ring.xmit_lock);
682 if (ocelot_fdma_tx_ring_free(fdma) == 0) {
691 ocelot_fdma_send_skb(ocelot, fdma, skb);
694 spin_unlock(&fdma->tx_ring.xmit_lock);
701 struct ocelot_fdma *fdma = ocelot->fdma;
706 rx_ring = &fdma->rx_ring;
718 if (fdma->rx_ring.skb)
719 dev_kfree_skb_any(fdma->rx_ring.skb);
724 struct ocelot_fdma *fdma = ocelot->fdma;
730 tx_ring = &fdma->tx_ring;
745 struct ocelot_fdma *fdma = ocelot->fdma;
752 fdma->dcbs_base = dmam_alloc_coherent(ocelot->dev,
754 &fdma->dcbs_dma_base, GFP_KERNEL);
755 if (!fdma->dcbs_base)
759 dcbs = fdma->dcbs_base;
760 dcbs_dma = fdma->dcbs_dma_base;
768 fdma->tx_ring.dcbs = dcbs;
769 fdma->tx_ring.dcbs_dma = dcbs_dma;
770 spin_lock_init(&fdma->tx_ring.xmit_lock);
773 fdma->rx_ring.dcbs = dcbs + OCELOT_FDMA_TX_RING_SIZE;
774 fdma->rx_ring.dcbs_dma = dcbs_dma + OCELOT_FDMA_TX_DCB_SIZE;
776 ocelot_fdma_tx_ring_free(fdma));
785 ocelot_fdma_rx_set_llp(&fdma->rx_ring);
792 struct ocelot_fdma *fdma = ocelot->fdma;
797 if (fdma->ndev)
800 fdma->ndev = dev;
801 netif_napi_add_weight(dev, &fdma->napi, ocelot_fdma_napi_poll,
807 struct ocelot_fdma *fdma = ocelot->fdma;
809 if (fdma->ndev == dev) {
810 netif_napi_del(&fdma->napi);
811 fdma->ndev = NULL;
818 struct ocelot_fdma *fdma;
821 fdma = devm_kzalloc(dev, sizeof(*fdma), GFP_KERNEL);
822 if (!fdma)
825 ocelot->fdma = fdma;
830 fdma->ocelot = ocelot;
831 fdma->irq = platform_get_irq_byname(pdev, "fdma");
832 ret = devm_request_irq(dev, fdma->irq, ocelot_fdma_interrupt, 0,
846 devm_free_irq(dev, fdma->irq, fdma);
848 devm_kfree(dev, fdma);
850 ocelot->fdma = NULL;
855 struct ocelot_fdma *fdma = ocelot->fdma;
873 napi_enable(&fdma->napi);
875 ocelot_fdma_activate_chan(ocelot, ocelot->fdma->rx_ring.dcbs_dma,
881 struct ocelot_fdma *fdma = ocelot->fdma;
888 napi_synchronize(&fdma->napi);
889 napi_disable(&fdma->napi);