Lines Matching refs:tf

316 static inline unsigned int tbnet_frame_size(const struct tbnet_frame *tf)  in tbnet_frame_size()  argument
318 return tf->frame.size ? : TBNET_FRAME_SIZE; in tbnet_frame_size()
327 struct tbnet_frame *tf = &ring->frames[i]; in tbnet_free_buffers() local
332 if (!tf->page) in tbnet_free_buffers()
345 if (tf->frame.buffer_phy) in tbnet_free_buffers()
346 dma_unmap_page(dma_dev, tf->frame.buffer_phy, size, in tbnet_free_buffers()
349 __free_pages(tf->page, order); in tbnet_free_buffers()
350 tf->page = NULL; in tbnet_free_buffers()
474 struct tbnet_frame *tf = &ring->frames[index]; in tbnet_alloc_rx_buffers() local
477 if (tf->page) in tbnet_alloc_rx_buffers()
484 tf->page = dev_alloc_pages(TBNET_RX_PAGE_ORDER); in tbnet_alloc_rx_buffers()
485 if (!tf->page) { in tbnet_alloc_rx_buffers()
490 dma_addr = dma_map_page(dma_dev, tf->page, 0, in tbnet_alloc_rx_buffers()
497 tf->frame.buffer_phy = dma_addr; in tbnet_alloc_rx_buffers()
498 tf->dev = net->dev; in tbnet_alloc_rx_buffers()
500 tb_ring_rx(ring->ring, &tf->frame); in tbnet_alloc_rx_buffers()
516 struct tbnet_frame *tf; in tbnet_get_tx_buffer() local
524 tf = &ring->frames[index]; in tbnet_get_tx_buffer()
525 tf->frame.size = 0; in tbnet_get_tx_buffer()
527 dma_sync_single_for_cpu(dma_dev, tf->frame.buffer_phy, in tbnet_get_tx_buffer()
528 tbnet_frame_size(tf), DMA_TO_DEVICE); in tbnet_get_tx_buffer()
530 return tf; in tbnet_get_tx_buffer()
536 struct tbnet_frame *tf = container_of(frame, typeof(*tf), frame); in tbnet_tx_callback() local
537 struct tbnet *net = netdev_priv(tf->dev); in tbnet_tx_callback()
553 struct tbnet_frame *tf = &ring->frames[i]; in tbnet_alloc_tx_buffers() local
556 tf->page = alloc_page(GFP_KERNEL); in tbnet_alloc_tx_buffers()
557 if (!tf->page) { in tbnet_alloc_tx_buffers()
562 dma_addr = dma_map_page(dma_dev, tf->page, 0, TBNET_FRAME_SIZE, in tbnet_alloc_tx_buffers()
565 __free_page(tf->page); in tbnet_alloc_tx_buffers()
566 tf->page = NULL; in tbnet_alloc_tx_buffers()
571 tf->dev = net->dev; in tbnet_alloc_tx_buffers()
572 tf->frame.buffer_phy = dma_addr; in tbnet_alloc_tx_buffers()
573 tf->frame.callback = tbnet_tx_callback; in tbnet_alloc_tx_buffers()
574 tf->frame.sof = TBIP_PDF_FRAME_START; in tbnet_alloc_tx_buffers()
575 tf->frame.eof = TBIP_PDF_FRAME_END; in tbnet_alloc_tx_buffers()
669 static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf, in tbnet_check_frame() argument
675 if (tf->frame.flags & RING_DESC_CRC_ERROR) { in tbnet_check_frame()
678 } else if (tf->frame.flags & RING_DESC_BUFFER_OVERRUN) { in tbnet_check_frame()
684 size = tbnet_frame_size(tf); in tbnet_check_frame()
752 struct tbnet_frame *tf; in tbnet_poll() local
773 tf = container_of(frame, typeof(*tf), frame); in tbnet_poll()
775 page = tf->page; in tbnet_poll()
776 tf->page = NULL; in tbnet_poll()
781 if (!tbnet_check_frame(net, tf, hdr)) { in tbnet_poll()