Lines Matching refs:bdp
343 static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp,
346 return (bdp >= bd->last) ? bd->base
347 : (struct bufdesc *)(((void *)bdp) + bd->dsize);
350 static struct bufdesc *fec_enet_get_prevdesc(struct bufdesc *bdp,
353 return (bdp <= bd->base) ? bd->last
354 : (struct bufdesc *)(((void *)bdp) - bd->dsize);
357 static int fec_enet_get_bd_index(struct bufdesc *bdp,
360 return ((const char *)bdp - (const char *)bd->base) >> bd->dsize_log2;
385 struct bufdesc *bdp;
393 bdp = txq->bd.base;
398 bdp == txq->bd.cur ? 'S' : ' ',
399 bdp == txq->dirty_tx ? 'H' : ' ',
400 fec16_to_cpu(bdp->cbd_sc),
401 fec32_to_cpu(bdp->cbd_bufaddr),
402 fec16_to_cpu(bdp->cbd_datlen),
404 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
406 } while (bdp != txq->bd.base);
480 struct bufdesc *bdp = txq->bd.cur;
494 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
495 ebdp = (struct bufdesc_ex *)bdp;
497 status = fec16_to_cpu(bdp->cbd_sc);
525 index = fec_enet_get_bd_index(bdp, &txq->bd);
543 bdp->cbd_bufaddr = cpu_to_fec32(addr);
544 bdp->cbd_datlen = cpu_to_fec16(frag_len);
549 bdp->cbd_sc = cpu_to_fec16(status);
552 return bdp;
554 bdp = txq->bd.cur;
556 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
557 dma_unmap_single(&fep->pdev->dev, fec32_to_cpu(bdp->cbd_bufaddr),
558 fec16_to_cpu(bdp->cbd_datlen), DMA_TO_DEVICE);
568 struct bufdesc *bdp, *last_bdp;
592 bdp = txq->bd.cur;
593 last_bdp = bdp;
594 status = fec16_to_cpu(bdp->cbd_sc);
601 index = fec_enet_get_bd_index(bdp, &txq->bd);
637 bdp->cbd_bufaddr = cpu_to_fec32(addr);
638 bdp->cbd_datlen = cpu_to_fec16(buflen);
642 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
671 bdp->cbd_sc = cpu_to_fec16(status);
674 bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd);
678 /* Make sure the update to bdp is performed before txq->bd.cur. */
680 txq->bd.cur = bdp;
691 struct bufdesc *bdp, int index, char *data,
695 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc);
700 status = fec16_to_cpu(bdp->cbd_sc);
722 bdp->cbd_datlen = cpu_to_fec16(size);
723 bdp->cbd_bufaddr = cpu_to_fec32(addr);
743 bdp->cbd_sc = cpu_to_fec16(status);
751 struct bufdesc *bdp, int index)
755 struct bufdesc_ex *ebdp = container_of(bdp, struct bufdesc_ex, desc);
761 status = fec16_to_cpu(bdp->cbd_sc);
785 bdp->cbd_bufaddr = cpu_to_fec32(dmabuf);
786 bdp->cbd_datlen = cpu_to_fec16(hdr_len);
797 bdp->cbd_sc = cpu_to_fec16(status);
808 struct bufdesc *bdp = txq->bd.cur;
833 index = fec_enet_get_bd_index(bdp, &txq->bd);
840 ret = fec_enet_txq_put_hdr_tso(txq, skb, ndev, bdp, index);
848 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
849 index = fec_enet_get_bd_index(bdp, &txq->bd);
851 bdp, index,
862 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
869 txq->bd.cur = bdp;
921 struct bufdesc *bdp;
928 bdp = rxq->bd.base;
933 if (bdp->cbd_bufaddr)
934 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY);
936 bdp->cbd_sc = cpu_to_fec16(0);
937 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd);
941 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd);
942 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP);
950 bdp = txq->bd.base;
951 txq->bd.cur = bdp;
955 bdp->cbd_sc = cpu_to_fec16(0);
957 if (bdp->cbd_bufaddr &&
958 !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr)))
960 fec32_to_cpu(bdp->cbd_bufaddr),
961 fec16_to_cpu(bdp->cbd_datlen),
966 if (bdp->cbd_bufaddr)
968 fec32_to_cpu(bdp->cbd_bufaddr),
969 fec16_to_cpu(bdp->cbd_datlen),
984 bdp->cbd_bufaddr = cpu_to_fec32(0);
985 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
989 bdp = fec_enet_get_prevdesc(bdp, &txq->bd);
990 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP);
991 txq->dirty_tx = bdp;
1383 struct bufdesc *bdp;
1396 /* get next bdp of dirty_tx */
1398 bdp = txq->dirty_tx;
1400 /* get next bdp of dirty_tx */
1401 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
1403 while (bdp != READ_ONCE(txq->bd.cur)) {
1406 status = fec16_to_cpu(READ_ONCE(bdp->cbd_sc));
1410 index = fec_enet_get_bd_index(bdp, &txq->bd);
1414 if (bdp->cbd_bufaddr &&
1415 !IS_TSO_HEADER(txq, fec32_to_cpu(bdp->cbd_bufaddr)))
1417 fec32_to_cpu(bdp->cbd_bufaddr),
1418 fec16_to_cpu(bdp->cbd_datlen),
1420 bdp->cbd_bufaddr = cpu_to_fec32(0);
1434 if (bdp->cbd_bufaddr)
1436 fec32_to_cpu(bdp->cbd_bufaddr),
1437 fec16_to_cpu(bdp->cbd_datlen),
1443 bdp->cbd_bufaddr = cpu_to_fec32(0);
1449 frame_len = fec16_to_cpu(bdp->cbd_datlen);
1490 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
1510 /* Make sure the update to bdp and tx_buf are performed
1514 txq->dirty_tx = bdp;
1517 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
1529 if (bdp != txq->bd.cur &&
1545 struct bufdesc *bdp, int index)
1556 bdp->cbd_bufaddr = cpu_to_fec32(phys_addr);
1634 struct bufdesc *bdp;
1671 bdp = rxq->bd.cur;
1674 while (!((status = fec16_to_cpu(bdp->cbd_sc)) & BD_ENET_RX_EMPTY)) {
1710 pkt_len = fec16_to_cpu(bdp->cbd_datlen);
1713 index = fec_enet_get_bd_index(bdp, &rxq->bd);
1716 fec32_to_cpu(bdp->cbd_bufaddr),
1720 fec_enet_update_cbd(rxq, bdp, index);
1759 ebdp = (struct bufdesc_ex *)bdp;
1811 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
1821 bdp->cbd_sc = cpu_to_fec16(status);
1824 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd);
1832 rxq->bd.cur = bdp;
3360 struct bufdesc *bdp;
3365 bdp = rxq->bd.base;
3379 bdp->cbd_bufaddr = cpu_to_fec32(phys_addr);
3383 bdp->cbd_sc = cpu_to_fec16(BD_ENET_RX_EMPTY);
3386 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
3390 bdp = fec_enet_get_nextdesc(bdp, &rxq->bd);
3394 bdp = fec_enet_get_prevdesc(bdp, &rxq->bd);
3395 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP);
3408 struct bufdesc *bdp;
3412 bdp = txq->bd.base;
3418 bdp->cbd_sc = cpu_to_fec16(0);
3419 bdp->cbd_bufaddr = cpu_to_fec32(0);
3422 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
3426 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
3430 bdp = fec_enet_get_prevdesc(bdp, &txq->bd);
3431 bdp->cbd_sc |= cpu_to_fec16(BD_SC_WRAP);
3801 struct bufdesc *bdp;
3813 bdp = txq->bd.cur;
3814 status = fec16_to_cpu(bdp->cbd_sc);
3817 index = fec_enet_get_bd_index(bdp, &txq->bd);
3848 bdp->cbd_bufaddr = cpu_to_fec32(dma_addr);
3849 bdp->cbd_datlen = cpu_to_fec16(frame_len);
3852 struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
3870 bdp->cbd_sc = cpu_to_fec16(status);
3873 bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
3875 /* Make sure the update to bdp are performed before txq->bd.cur. */
3878 txq->bd.cur = bdp;