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