Lines Matching refs:bdp
282 static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, in fec_enet_get_nextdesc() argument
285 return (bdp >= bd->last) ? bd->base in fec_enet_get_nextdesc()
286 : (struct bufdesc *)(((void *)bdp) + bd->dsize); in fec_enet_get_nextdesc()
289 static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, in fec_enet_get_prevdesc() argument
292 return (bdp <= bd->base) ? bd->last in fec_enet_get_prevdesc()
293 : (struct bufdesc *)(((void *)bdp) - bd->dsize); in fec_enet_get_prevdesc()
296 static int fec_enet_get_bd_index(struct bufdesc *bdp, in fec_enet_get_bd_index() argument
299 return ((const char *)bdp - (const char *)bd->base) >> bd->dsize_log2; in fec_enet_get_bd_index()
334 struct bufdesc *bdp; in fec_dump() local
342 bdp = txq->bd.base; in fec_dump()
347 bdp == txq->bd.cur ? 'S' : ' ', in fec_dump()
348 bdp == txq->dirty_tx ? 'H' : ' ', in fec_dump()
349 fec16_to_cpu(bdp->cbd_sc), in fec_dump()
350 fec32_to_cpu(bdp->cbd_bufaddr), in fec_dump()
351 fec16_to_cpu(bdp->cbd_datlen), in fec_dump()
353 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_dump()
355 } while (bdp != txq->bd.base); in fec_dump()
386 struct bufdesc *bdp = txq->bd.cur; in fec_enet_txq_submit_frag_skb() local
400 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
401 ebdp = (struct bufdesc_ex *)bdp; in fec_enet_txq_submit_frag_skb()
403 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_submit_frag_skb()
430 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
448 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_submit_frag_skb()
449 bdp->cbd_datlen = cpu_to_fec16(frag_len); in fec_enet_txq_submit_frag_skb()
454 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_submit_frag_skb()
457 return bdp; in fec_enet_txq_submit_frag_skb()
459 bdp = txq->bd.cur; in fec_enet_txq_submit_frag_skb()
461 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
462 dma_unmap_single(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_txq_submit_frag_skb()
463 fec16_to_cpu(bdp->cbd_datlen), DMA_TO_DEVICE); in fec_enet_txq_submit_frag_skb()
473 struct bufdesc *bdp, *last_bdp; in fec_enet_txq_submit_skb() local
497 bdp = txq->bd.cur; in fec_enet_txq_submit_skb()
498 last_bdp = bdp; in fec_enet_txq_submit_skb()
499 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_submit_skb()
506 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_skb()
542 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_submit_skb()
543 bdp->cbd_datlen = cpu_to_fec16(buflen); in fec_enet_txq_submit_skb()
547 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_txq_submit_skb()
576 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_submit_skb()
579 bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd); in fec_enet_txq_submit_skb()
587 txq->bd.cur = bdp; in fec_enet_txq_submit_skb()
598 struct bufdesc *bdp, int index, char *data, in fec_enet_txq_put_data_tso() argument
602 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc); in fec_enet_txq_put_data_tso()
607 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_put_data_tso()
629 bdp->cbd_datlen = cpu_to_fec16(size); in fec_enet_txq_put_data_tso()
630 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_put_data_tso()
650 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_put_data_tso()
658 struct bufdesc *bdp, int index) in fec_enet_txq_put_hdr_tso() argument
662 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc); in fec_enet_txq_put_hdr_tso()
668 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_put_hdr_tso()
692 bdp->cbd_bufaddr = cpu_to_fec32(dmabuf); in fec_enet_txq_put_hdr_tso()
693 bdp->cbd_datlen = cpu_to_fec16(hdr_len); in fec_enet_txq_put_hdr_tso()
704 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_put_hdr_tso()
715 struct bufdesc *bdp = txq->bd.cur; in fec_enet_txq_submit_tso() local
740 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_tso()
747 ret = fec_enet_txq_put_hdr_tso(txq, skb, ndev, bdp, index); in fec_enet_txq_submit_tso()
755 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_tso()
756 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_tso()
758 bdp, index, in fec_enet_txq_submit_tso()
769 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_tso()
776 txq->bd.cur = bdp; in fec_enet_txq_submit_tso()
828 struct bufdesc *bdp; in fec_enet_bd_init() local
835 bdp = rxq->bd.base; in fec_enet_bd_init()
840 if (bdp->cbd_bufaddr) in fec_enet_bd_init()
841 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); in fec_enet_bd_init()
843 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_bd_init()
844 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_bd_init()
848 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); in fec_enet_bd_init()
849 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_bd_init()
857 bdp = txq->bd.base; in fec_enet_bd_init()
858 txq->bd.cur = bdp; in fec_enet_bd_init()
862 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_bd_init()
863 if (bdp->cbd_bufaddr && in fec_enet_bd_init()
864 !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) in fec_enet_bd_init()
866 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_bd_init()
867 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_bd_init()
873 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_bd_init()
874 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_bd_init()
878 bdp = fec_enet_get_prevdesc(bdp, &txq->bd); in fec_enet_bd_init()
879 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_bd_init()
880 txq->dirty_tx = bdp; in fec_enet_bd_init()
1241 struct bufdesc *bdp; in fec_enet_tx_queue() local
1254 bdp = txq->dirty_tx; in fec_enet_tx_queue()
1257 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_tx_queue()
1259 while (bdp != READ_ONCE(txq->bd.cur)) { in fec_enet_tx_queue()
1262 status = fec16_to_cpu(READ_ONCE(bdp->cbd_sc)); in fec_enet_tx_queue()
1266 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_tx_queue()
1270 if (!IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) in fec_enet_tx_queue()
1272 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_tx_queue()
1273 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_tx_queue()
1275 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_tx_queue()
1307 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_tx_queue()
1326 txq->dirty_tx = bdp; in fec_enet_tx_queue()
1329 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_tx_queue()
1341 if (bdp != txq->bd.cur && in fec_enet_tx_queue()
1357 fec_enet_new_rxbdp(struct net_device *ndev, struct bufdesc *bdp, struct sk_buff *skb) in fec_enet_new_rxbdp() argument
1366 …bdp->cbd_bufaddr = cpu_to_fec32(dma_map_single(&fep->pdev->dev, skb->data, FEC_ENET_RX_FRSIZE - fe… in fec_enet_new_rxbdp()
1367 if (dma_mapping_error(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr))) { in fec_enet_new_rxbdp()
1377 struct bufdesc *bdp, u32 length, bool swap) in fec_enet_copybreak() argument
1390 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_copybreak()
1412 struct bufdesc *bdp; in fec_enet_rx_queue() local
1434 bdp = rxq->bd.cur; in fec_enet_rx_queue()
1436 while (!((status = fec16_to_cpu(bdp->cbd_sc)) & BD_ENET_RX_EMPTY)) { in fec_enet_rx_queue()
1472 pkt_len = fec16_to_cpu(bdp->cbd_datlen); in fec_enet_rx_queue()
1475 index = fec_enet_get_bd_index(bdp, &rxq->bd); in fec_enet_rx_queue()
1482 is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4, in fec_enet_rx_queue()
1491 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_rx_queue()
1511 ebdp = (struct bufdesc_ex *)bdp; in fec_enet_rx_queue()
1557 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_rx_queue()
1562 fec_enet_new_rxbdp(ndev, bdp, skb_new); in fec_enet_rx_queue()
1573 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_rx_queue()
1583 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_rx_queue()
1586 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_rx_queue()
1594 rxq->bd.cur = bdp; in fec_enet_rx_queue()
2818 struct bufdesc *bdp; in fec_enet_free_buffers() local
2825 bdp = rxq->bd.base; in fec_enet_free_buffers()
2831 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_free_buffers()
2836 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_free_buffers()
2929 struct bufdesc *bdp; in fec_enet_alloc_rxq_buffers() local
2933 bdp = rxq->bd.base; in fec_enet_alloc_rxq_buffers()
2939 if (fec_enet_new_rxbdp(ndev, bdp, skb)) { in fec_enet_alloc_rxq_buffers()
2945 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); in fec_enet_alloc_rxq_buffers()
2948 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_alloc_rxq_buffers()
2952 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_alloc_rxq_buffers()
2956 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); in fec_enet_alloc_rxq_buffers()
2957 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_alloc_rxq_buffers()
2970 struct bufdesc *bdp; in fec_enet_alloc_txq_buffers() local
2974 bdp = txq->bd.base; in fec_enet_alloc_txq_buffers()
2980 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_alloc_txq_buffers()
2981 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_alloc_txq_buffers()
2984 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_alloc_txq_buffers()
2988 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_alloc_txq_buffers()
2992 bdp = fec_enet_get_prevdesc(bdp, &txq->bd); in fec_enet_alloc_txq_buffers()
2993 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_alloc_txq_buffers()