Lines Matching refs:bdp

343 static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp,  in fec_enet_get_nextdesc()  argument
346 return (bdp >= bd->last) ? bd->base in fec_enet_get_nextdesc()
347 : (struct bufdesc *)(((void *)bdp) + bd->dsize); in fec_enet_get_nextdesc()
350 static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp, in fec_enet_get_prevdesc() argument
353 return (bdp <= bd->base) ? bd->last in fec_enet_get_prevdesc()
354 : (struct bufdesc *)(((void *)bdp) - bd->dsize); in fec_enet_get_prevdesc()
357 static int fec_enet_get_bd_index(struct bufdesc *bdp, in fec_enet_get_bd_index() argument
360 return ((const char *)bdp - (const char *)bd->base) >> bd->dsize_log2; in fec_enet_get_bd_index()
385 struct bufdesc *bdp; in fec_dump() local
393 bdp = txq->bd.base; in fec_dump()
398 bdp == txq->bd.cur ? 'S' : ' ', in fec_dump()
399 bdp == txq->dirty_tx ? 'H' : ' ', in fec_dump()
400 fec16_to_cpu(bdp->cbd_sc), in fec_dump()
401 fec32_to_cpu(bdp->cbd_bufaddr), in fec_dump()
402 fec16_to_cpu(bdp->cbd_datlen), in fec_dump()
404 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_dump()
406 } while (bdp != txq->bd.base); in fec_dump()
480 struct bufdesc *bdp = txq->bd.cur; in fec_enet_txq_submit_frag_skb() local
494 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
495 ebdp = (struct bufdesc_ex *)bdp; in fec_enet_txq_submit_frag_skb()
497 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_submit_frag_skb()
525 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
543 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_submit_frag_skb()
544 bdp->cbd_datlen = cpu_to_fec16(frag_len); in fec_enet_txq_submit_frag_skb()
549 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_submit_frag_skb()
552 return bdp; in fec_enet_txq_submit_frag_skb()
554 bdp = txq->bd.cur; in fec_enet_txq_submit_frag_skb()
556 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_frag_skb()
557 dma_unmap_single(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_txq_submit_frag_skb()
558 fec16_to_cpu(bdp->cbd_datlen), DMA_TO_DEVICE); in fec_enet_txq_submit_frag_skb()
568 struct bufdesc *bdp, *last_bdp; in fec_enet_txq_submit_skb() local
592 bdp = txq->bd.cur; in fec_enet_txq_submit_skb()
593 last_bdp = bdp; in fec_enet_txq_submit_skb()
594 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_submit_skb()
601 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_skb()
637 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_submit_skb()
638 bdp->cbd_datlen = cpu_to_fec16(buflen); in fec_enet_txq_submit_skb()
642 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_txq_submit_skb()
671 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_submit_skb()
674 bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd); in fec_enet_txq_submit_skb()
680 txq->bd.cur = bdp; in fec_enet_txq_submit_skb()
691 struct bufdesc *bdp, int index, char *data, in fec_enet_txq_put_data_tso() argument
695 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc); in fec_enet_txq_put_data_tso()
700 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_put_data_tso()
722 bdp->cbd_datlen = cpu_to_fec16(size); in fec_enet_txq_put_data_tso()
723 bdp->cbd_bufaddr = cpu_to_fec32(addr); in fec_enet_txq_put_data_tso()
743 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_put_data_tso()
751 struct bufdesc *bdp, int index) in fec_enet_txq_put_hdr_tso() argument
755 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc); in fec_enet_txq_put_hdr_tso()
761 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_put_hdr_tso()
785 bdp->cbd_bufaddr = cpu_to_fec32(dmabuf); in fec_enet_txq_put_hdr_tso()
786 bdp->cbd_datlen = cpu_to_fec16(hdr_len); in fec_enet_txq_put_hdr_tso()
797 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_put_hdr_tso()
808 struct bufdesc *bdp = txq->bd.cur; in fec_enet_txq_submit_tso() local
833 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_tso()
840 ret = fec_enet_txq_put_hdr_tso(txq, skb, ndev, bdp, index); in fec_enet_txq_submit_tso()
848 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_tso()
849 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_submit_tso()
851 bdp, index, in fec_enet_txq_submit_tso()
862 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_submit_tso()
869 txq->bd.cur = bdp; in fec_enet_txq_submit_tso()
921 struct bufdesc *bdp; in fec_enet_bd_init() local
928 bdp = rxq->bd.base; in fec_enet_bd_init()
933 if (bdp->cbd_bufaddr) in fec_enet_bd_init()
934 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); in fec_enet_bd_init()
936 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_bd_init()
937 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_bd_init()
941 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); in fec_enet_bd_init()
942 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_bd_init()
950 bdp = txq->bd.base; in fec_enet_bd_init()
951 txq->bd.cur = bdp; in fec_enet_bd_init()
955 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_bd_init()
957 if (bdp->cbd_bufaddr && in fec_enet_bd_init()
958 !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) in fec_enet_bd_init()
960 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_bd_init()
961 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_bd_init()
966 if (bdp->cbd_bufaddr) in fec_enet_bd_init()
968 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_bd_init()
969 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_bd_init()
984 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_bd_init()
985 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_bd_init()
989 bdp = fec_enet_get_prevdesc(bdp, &txq->bd); in fec_enet_bd_init()
990 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_bd_init()
991 txq->dirty_tx = bdp; in fec_enet_bd_init()
1383 struct bufdesc *bdp; in fec_enet_tx_queue() local
1398 bdp = txq->dirty_tx; in fec_enet_tx_queue()
1401 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_tx_queue()
1403 while (bdp != READ_ONCE(txq->bd.cur)) { in fec_enet_tx_queue()
1406 status = fec16_to_cpu(READ_ONCE(bdp->cbd_sc)); in fec_enet_tx_queue()
1410 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_tx_queue()
1414 if (bdp->cbd_bufaddr && in fec_enet_tx_queue()
1415 !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr))) in fec_enet_tx_queue()
1417 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_tx_queue()
1418 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_tx_queue()
1420 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_tx_queue()
1434 if (bdp->cbd_bufaddr) in fec_enet_tx_queue()
1436 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_tx_queue()
1437 fec16_to_cpu(bdp->cbd_datlen), in fec_enet_tx_queue()
1443 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_tx_queue()
1449 frame_len = fec16_to_cpu(bdp->cbd_datlen); in fec_enet_tx_queue()
1490 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_tx_queue()
1514 txq->dirty_tx = bdp; in fec_enet_tx_queue()
1517 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_tx_queue()
1529 if (bdp != txq->bd.cur && in fec_enet_tx_queue()
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()
1634 struct bufdesc *bdp; in fec_enet_rx_queue() local
1671 bdp = rxq->bd.cur; in fec_enet_rx_queue()
1674 while (!((status = fec16_to_cpu(bdp->cbd_sc)) & BD_ENET_RX_EMPTY)) { in fec_enet_rx_queue()
1710 pkt_len = fec16_to_cpu(bdp->cbd_datlen); in fec_enet_rx_queue()
1713 index = fec_enet_get_bd_index(bdp, &rxq->bd); in fec_enet_rx_queue()
1716 fec32_to_cpu(bdp->cbd_bufaddr), in fec_enet_rx_queue()
1720 fec_enet_update_cbd(rxq, bdp, index); in fec_enet_rx_queue()
1759 ebdp = (struct bufdesc_ex *)bdp; in fec_enet_rx_queue()
1811 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_rx_queue()
1821 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_rx_queue()
1824 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_rx_queue()
1832 rxq->bd.cur = bdp; in fec_enet_rx_queue()
3358 struct bufdesc *bdp; in fec_enet_alloc_rxq_buffers() local
3363 bdp = rxq->bd.base; in fec_enet_alloc_rxq_buffers()
3377 bdp->cbd_bufaddr = cpu_to_fec32(phys_addr); in fec_enet_alloc_rxq_buffers()
3381 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY); in fec_enet_alloc_rxq_buffers()
3384 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_alloc_rxq_buffers()
3388 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd); in fec_enet_alloc_rxq_buffers()
3392 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd); in fec_enet_alloc_rxq_buffers()
3393 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_alloc_rxq_buffers()
3406 struct bufdesc *bdp; in fec_enet_alloc_txq_buffers() local
3410 bdp = txq->bd.base; in fec_enet_alloc_txq_buffers()
3416 bdp->cbd_sc = cpu_to_fec16(0); in fec_enet_alloc_txq_buffers()
3417 bdp->cbd_bufaddr = cpu_to_fec32(0); in fec_enet_alloc_txq_buffers()
3420 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_alloc_txq_buffers()
3424 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_alloc_txq_buffers()
3428 bdp = fec_enet_get_prevdesc(bdp, &txq->bd); in fec_enet_alloc_txq_buffers()
3429 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP); in fec_enet_alloc_txq_buffers()
3804 struct bufdesc *bdp; in fec_enet_txq_xmit_frame() local
3816 bdp = txq->bd.cur; in fec_enet_txq_xmit_frame()
3817 status = fec16_to_cpu(bdp->cbd_sc); in fec_enet_txq_xmit_frame()
3820 index = fec_enet_get_bd_index(bdp, &txq->bd); in fec_enet_txq_xmit_frame()
3851 bdp->cbd_bufaddr = cpu_to_fec32(dma_addr); in fec_enet_txq_xmit_frame()
3852 bdp->cbd_datlen = cpu_to_fec16(frame_len); in fec_enet_txq_xmit_frame()
3855 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp; in fec_enet_txq_xmit_frame()
3873 bdp->cbd_sc = cpu_to_fec16(status); in fec_enet_txq_xmit_frame()
3876 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); in fec_enet_txq_xmit_frame()
3881 txq->bd.cur = bdp; in fec_enet_txq_xmit_frame()