Lines Matching refs:tf
317 static inline unsigned int tbnet_frame_size(const struct tbnet_frame *tf) in tbnet_frame_size() argument
319 return tf->frame.size ? : TBNET_FRAME_SIZE; in tbnet_frame_size()
328 struct tbnet_frame *tf = &ring->frames[i]; in tbnet_free_buffers() local
333 if (!tf->page) in tbnet_free_buffers()
346 if (tf->frame.buffer_phy) in tbnet_free_buffers()
347 dma_unmap_page(dma_dev, tf->frame.buffer_phy, size, in tbnet_free_buffers()
350 __free_pages(tf->page, order); in tbnet_free_buffers()
351 tf->page = NULL; in tbnet_free_buffers()
483 struct tbnet_frame *tf = &ring->frames[index]; in tbnet_alloc_rx_buffers() local
486 if (tf->page) in tbnet_alloc_rx_buffers()
493 tf->page = dev_alloc_pages(TBNET_RX_PAGE_ORDER); in tbnet_alloc_rx_buffers()
494 if (!tf->page) { in tbnet_alloc_rx_buffers()
499 dma_addr = dma_map_page(dma_dev, tf->page, 0, in tbnet_alloc_rx_buffers()
506 tf->frame.buffer_phy = dma_addr; in tbnet_alloc_rx_buffers()
507 tf->dev = net->dev; in tbnet_alloc_rx_buffers()
509 tb_ring_rx(ring->ring, &tf->frame); in tbnet_alloc_rx_buffers()
525 struct tbnet_frame *tf; in tbnet_get_tx_buffer() local
533 tf = &ring->frames[index]; in tbnet_get_tx_buffer()
534 tf->frame.size = 0; in tbnet_get_tx_buffer()
536 dma_sync_single_for_cpu(dma_dev, tf->frame.buffer_phy, in tbnet_get_tx_buffer()
537 tbnet_frame_size(tf), DMA_TO_DEVICE); in tbnet_get_tx_buffer()
539 return tf; in tbnet_get_tx_buffer()
545 struct tbnet_frame *tf = container_of(frame, typeof(*tf), frame); in tbnet_tx_callback() local
546 struct tbnet *net = netdev_priv(tf->dev); in tbnet_tx_callback()
562 struct tbnet_frame *tf = &ring->frames[i]; in tbnet_alloc_tx_buffers() local
565 tf->page = alloc_page(GFP_KERNEL); in tbnet_alloc_tx_buffers()
566 if (!tf->page) { in tbnet_alloc_tx_buffers()
571 dma_addr = dma_map_page(dma_dev, tf->page, 0, TBNET_FRAME_SIZE, in tbnet_alloc_tx_buffers()
574 __free_page(tf->page); in tbnet_alloc_tx_buffers()
575 tf->page = NULL; in tbnet_alloc_tx_buffers()
580 tf->dev = net->dev; in tbnet_alloc_tx_buffers()
581 tf->frame.buffer_phy = dma_addr; in tbnet_alloc_tx_buffers()
582 tf->frame.callback = tbnet_tx_callback; in tbnet_alloc_tx_buffers()
583 tf->frame.sof = TBIP_PDF_FRAME_START; in tbnet_alloc_tx_buffers()
584 tf->frame.eof = TBIP_PDF_FRAME_END; in tbnet_alloc_tx_buffers()
685 static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf, in tbnet_check_frame() argument
691 if (tf->frame.flags & RING_DESC_CRC_ERROR) { in tbnet_check_frame()
694 } else if (tf->frame.flags & RING_DESC_BUFFER_OVERRUN) { in tbnet_check_frame()
700 size = tbnet_frame_size(tf); in tbnet_check_frame()
768 struct tbnet_frame *tf; in tbnet_poll() local
789 tf = container_of(frame, typeof(*tf), frame); in tbnet_poll()
791 page = tf->page; in tbnet_poll()
792 tf->page = NULL; in tbnet_poll()
797 if (!tbnet_check_frame(net, tf, hdr)) { in tbnet_poll()