Lines Matching refs:tf
323 static inline unsigned int tbnet_frame_size(const struct tbnet_frame *tf) in tbnet_frame_size() argument
325 return tf->frame.size ? : TBNET_FRAME_SIZE; in tbnet_frame_size()
334 struct tbnet_frame *tf = &ring->frames[i]; in tbnet_free_buffers() local
339 if (!tf->page) in tbnet_free_buffers()
352 if (tf->frame.buffer_phy) in tbnet_free_buffers()
353 dma_unmap_page(dma_dev, tf->frame.buffer_phy, size, in tbnet_free_buffers()
356 __free_pages(tf->page, order); in tbnet_free_buffers()
357 tf->page = NULL; in tbnet_free_buffers()
489 struct tbnet_frame *tf = &ring->frames[index]; in tbnet_alloc_rx_buffers() local
492 if (tf->page) in tbnet_alloc_rx_buffers()
499 tf->page = dev_alloc_pages(TBNET_RX_PAGE_ORDER); in tbnet_alloc_rx_buffers()
500 if (!tf->page) { in tbnet_alloc_rx_buffers()
505 dma_addr = dma_map_page(dma_dev, tf->page, 0, in tbnet_alloc_rx_buffers()
512 tf->frame.buffer_phy = dma_addr; in tbnet_alloc_rx_buffers()
513 tf->dev = net->dev; in tbnet_alloc_rx_buffers()
515 tb_ring_rx(ring->ring, &tf->frame); in tbnet_alloc_rx_buffers()
531 struct tbnet_frame *tf; in tbnet_get_tx_buffer() local
539 tf = &ring->frames[index]; in tbnet_get_tx_buffer()
540 tf->frame.size = 0; in tbnet_get_tx_buffer()
542 dma_sync_single_for_cpu(dma_dev, tf->frame.buffer_phy, in tbnet_get_tx_buffer()
543 tbnet_frame_size(tf), DMA_TO_DEVICE); in tbnet_get_tx_buffer()
545 return tf; in tbnet_get_tx_buffer()
551 struct tbnet_frame *tf = container_of(frame, typeof(*tf), frame); in tbnet_tx_callback() local
552 struct tbnet *net = netdev_priv(tf->dev); in tbnet_tx_callback()
568 struct tbnet_frame *tf = &ring->frames[i]; in tbnet_alloc_tx_buffers() local
571 tf->page = alloc_page(GFP_KERNEL); in tbnet_alloc_tx_buffers()
572 if (!tf->page) { in tbnet_alloc_tx_buffers()
577 dma_addr = dma_map_page(dma_dev, tf->page, 0, TBNET_FRAME_SIZE, in tbnet_alloc_tx_buffers()
580 __free_page(tf->page); in tbnet_alloc_tx_buffers()
581 tf->page = NULL; in tbnet_alloc_tx_buffers()
586 tf->dev = net->dev; in tbnet_alloc_tx_buffers()
587 tf->frame.buffer_phy = dma_addr; in tbnet_alloc_tx_buffers()
588 tf->frame.callback = tbnet_tx_callback; in tbnet_alloc_tx_buffers()
589 tf->frame.sof = TBIP_PDF_FRAME_START; in tbnet_alloc_tx_buffers()
590 tf->frame.eof = TBIP_PDF_FRAME_END; in tbnet_alloc_tx_buffers()
697 static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf, in tbnet_check_frame() argument
703 if (tf->frame.flags & RING_DESC_CRC_ERROR) { in tbnet_check_frame()
706 } else if (tf->frame.flags & RING_DESC_BUFFER_OVERRUN) { in tbnet_check_frame()
712 size = tbnet_frame_size(tf); in tbnet_check_frame()
780 struct tbnet_frame *tf; in tbnet_poll() local
801 tf = container_of(frame, typeof(*tf), frame); in tbnet_poll()
803 page = tf->page; in tbnet_poll()
804 tf->page = NULL; in tbnet_poll()
809 if (!tbnet_check_frame(net, tf, hdr)) { in tbnet_poll()