Lines Matching refs:bdp

329 static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp,  in fec_enet_get_nextdesc()  argument
332 return (bdp >= bd->last) ? bd->base in fec_enet_get_nextdesc()
333 : (struct bufdesc *)(((void *)bdp) + bd->dsize); in fec_enet_get_nextdesc()
336 static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, in fec_enet_get_prevdesc() argument
339 return (bdp <= bd->base) ? bd->last in fec_enet_get_prevdesc()
340 : (struct bufdesc *)(((void *)bdp) - bd->dsize); in fec_enet_get_prevdesc()
343 static int fec_enet_get_bd_index(struct bufdesc *bdp, in fec_enet_get_bd_index() argument
346 return ((const char *)bdp - (const char *)bd->base) >> bd->dsize_log2; in fec_enet_get_bd_index()
381 struct bufdesc *bdp; in fec_dump() local
389 bdp = txq->bd.base; in fec_dump()
394 bdp == txq->bd.cur ? 'S' : ' ', in fec_dump()
395 bdp == txq->dirty_tx ? 'H' : ' ', in fec_dump()
396 fec16_to_cpu(bdp->cbd_sc), in fec_dump()
397 fec32_to_cpu(bdp->cbd_bufaddr), in fec_dump()
398 fec16_to_cpu(bdp->cbd_datlen), in fec_dump()
400 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_dump()
402 } while (bdp != txq->bd.base); in fec_dump()
475 struct bufdesc *bdp = txq->bd.cur; in fec_enet_txq_submit_frag_skb() local
489 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
490 ebdp = (struct bufdesc_ex *)bdp; in fec_enet_txq_submit_frag_skb()
492 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_submit_frag_skb()
520 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
538 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_submit_frag_skb()
539 bdp->cbd_datlen = cpu_to_fec16(frag_len); in fec_enet_txq_submit_frag_skb()
544 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_submit_frag_skb()
547 return bdp; in fec_enet_txq_submit_frag_skb()
549 bdp = txq->bd.cur; in fec_enet_txq_submit_frag_skb()
551 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
552 dma_unmap_single(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_txq_submit_frag_skb()
553 fec16_to_cpu(bdp->cbd_datlen), DMA_TO_DEVICE); in fec_enet_txq_submit_frag_skb()
563 struct bufdesc *bdp, *last_bdp; in fec_enet_txq_submit_skb() local
587 bdp = txq->bd.cur; in fec_enet_txq_submit_skb()
588 last_bdp = bdp; in fec_enet_txq_submit_skb()
589 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_submit_skb()
596 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_skb()
632 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_submit_skb()
633 bdp->cbd_datlen = cpu_to_fec16(buflen); in fec_enet_txq_submit_skb()
637 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_txq_submit_skb()
666 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_submit_skb()
669 bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd); in fec_enet_txq_submit_skb()
677 txq->bd.cur = bdp; in fec_enet_txq_submit_skb()
688 struct bufdesc *bdp, int index, char *data, in fec_enet_txq_put_data_tso() argument
692 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc); in fec_enet_txq_put_data_tso()
697 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_put_data_tso()
719 bdp->cbd_datlen = cpu_to_fec16(size); in fec_enet_txq_put_data_tso()
720 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_put_data_tso()
740 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_put_data_tso()
748 struct bufdesc *bdp, int index) in fec_enet_txq_put_hdr_tso() argument
752 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc); in fec_enet_txq_put_hdr_tso()
758 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_put_hdr_tso()
782 bdp->cbd_bufaddr = cpu_to_fec32(dmabuf); in fec_enet_txq_put_hdr_tso()
783 bdp->cbd_datlen = cpu_to_fec16(hdr_len); in fec_enet_txq_put_hdr_tso()
794 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_put_hdr_tso()
805 struct bufdesc *bdp = txq->bd.cur; in fec_enet_txq_submit_tso() local
830 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_tso()
837 ret = fec_enet_txq_put_hdr_tso(txq, skb, ndev, bdp, index); in fec_enet_txq_submit_tso()
845 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_tso()
846 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_tso()
848 bdp, index, in fec_enet_txq_submit_tso()
859 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_tso()
866 txq->bd.cur = bdp; in fec_enet_txq_submit_tso()
918 struct bufdesc *bdp; in fec_enet_bd_init() local
925 bdp = rxq->bd.base; in fec_enet_bd_init()
930 if (bdp->cbd_bufaddr) in fec_enet_bd_init()
931 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); in fec_enet_bd_init()
933 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_bd_init()
934 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_bd_init()
938 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); in fec_enet_bd_init()
939 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_bd_init()
947 bdp = txq->bd.base; in fec_enet_bd_init()
948 txq->bd.cur = bdp; in fec_enet_bd_init()
952 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_bd_init()
953 if (bdp->cbd_bufaddr && in fec_enet_bd_init()
954 !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) in fec_enet_bd_init()
956 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_bd_init()
957 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_bd_init()
963 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_bd_init()
964 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_bd_init()
968 bdp = fec_enet_get_prevdesc(bdp, &txq->bd); in fec_enet_bd_init()
969 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_bd_init()
970 txq->dirty_tx = bdp; in fec_enet_bd_init()
1382 struct bufdesc *bdp; in fec_enet_tx_queue() local
1395 bdp = txq->dirty_tx; in fec_enet_tx_queue()
1398 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_tx_queue()
1400 while (bdp != READ_ONCE(txq->bd.cur)) { in fec_enet_tx_queue()
1403 status = fec16_to_cpu(READ_ONCE(bdp->cbd_sc)); in fec_enet_tx_queue()
1407 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_tx_queue()
1411 if (!IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) in fec_enet_tx_queue()
1413 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_tx_queue()
1414 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_tx_queue()
1416 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_tx_queue()
1448 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_tx_queue()
1467 txq->dirty_tx = bdp; in fec_enet_tx_queue()
1470 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_tx_queue()
1482 if (bdp != txq->bd.cur && in fec_enet_tx_queue()
1498 fec_enet_new_rxbdp(struct net_device *ndev, struct bufdesc *bdp, struct sk_buff *skb) in fec_enet_new_rxbdp() argument
1507bdp->cbd_bufaddr = cpu_to_fec32(dma_map_single(&fep->pdev->dev, skb->data, FEC_ENET_RX_FRSIZE - fe… in fec_enet_new_rxbdp()
1508 if (dma_mapping_error(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr))) { in fec_enet_new_rxbdp()
1519 struct bufdesc *bdp, u32 length, bool swap) in fec_enet_copybreak() argument
1532 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_copybreak()
1545 struct bufdesc *bdp, int index) in fec_enet_update_cbd() argument
1556 bdp->cbd_bufaddr = cpu_to_fec32(phys_addr); in fec_enet_update_cbd()
1569 struct bufdesc *bdp; in fec_enet_rx_queue() local
1590 bdp = rxq->bd.cur; in fec_enet_rx_queue()
1592 while (!((status = fec16_to_cpu(bdp->cbd_sc)) & BD_ENET_RX_EMPTY)) { in fec_enet_rx_queue()
1628 pkt_len = fec16_to_cpu(bdp->cbd_datlen); in fec_enet_rx_queue()
1631 index = fec_enet_get_bd_index(bdp, &rxq->bd); in fec_enet_rx_queue()
1634 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_rx_queue()
1638 fec_enet_update_cbd(rxq, bdp, index); in fec_enet_rx_queue()
1661 ebdp = (struct bufdesc_ex *)bdp; in fec_enet_rx_queue()
1713 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_rx_queue()
1723 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_rx_queue()
1726 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_rx_queue()
1734 rxq->bd.cur = bdp; in fec_enet_rx_queue()
3181 struct bufdesc *bdp; in fec_enet_alloc_rxq_buffers() local
3186 bdp = rxq->bd.base; in fec_enet_alloc_rxq_buffers()
3200 bdp->cbd_bufaddr = cpu_to_fec32(phys_addr); in fec_enet_alloc_rxq_buffers()
3204 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); in fec_enet_alloc_rxq_buffers()
3207 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_alloc_rxq_buffers()
3211 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_alloc_rxq_buffers()
3215 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); in fec_enet_alloc_rxq_buffers()
3216 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_alloc_rxq_buffers()
3229 struct bufdesc *bdp; in fec_enet_alloc_txq_buffers() local
3233 bdp = txq->bd.base; in fec_enet_alloc_txq_buffers()
3239 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_alloc_txq_buffers()
3240 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_alloc_txq_buffers()
3243 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_alloc_txq_buffers()
3247 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_alloc_txq_buffers()
3251 bdp = fec_enet_get_prevdesc(bdp, &txq->bd); in fec_enet_alloc_txq_buffers()
3252 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_alloc_txq_buffers()