Lines Matching refs:rx_buf
76 ef4_rx_buf_next(struct ef4_rx_queue *rx_queue, struct ef4_rx_buffer *rx_buf) in ef4_rx_buf_next() argument
78 if (unlikely(rx_buf == ef4_rx_buffer(rx_queue, rx_queue->ptr_mask))) in ef4_rx_buf_next()
81 return rx_buf + 1; in ef4_rx_buf_next()
85 struct ef4_rx_buffer *rx_buf, in ef4_sync_rx_buffer() argument
88 dma_sync_single_for_cpu(&efx->pci_dev->dev, rx_buf->dma_addr, len, in ef4_sync_rx_buffer()
155 struct ef4_rx_buffer *rx_buf; in ef4_init_rx_buffers() local
192 rx_buf = ef4_rx_buffer(rx_queue, index); in ef4_init_rx_buffers()
193 rx_buf->dma_addr = dma_addr + efx->rx_ip_align; in ef4_init_rx_buffers()
194 rx_buf->page = page; in ef4_init_rx_buffers()
195 rx_buf->page_offset = page_offset + efx->rx_ip_align; in ef4_init_rx_buffers()
196 rx_buf->len = efx->rx_dma_len; in ef4_init_rx_buffers()
197 rx_buf->flags = 0; in ef4_init_rx_buffers()
204 rx_buf->flags = EF4_RX_BUF_LAST_IN_PAGE; in ef4_init_rx_buffers()
214 struct ef4_rx_buffer *rx_buf) in ef4_unmap_rx_buffer() argument
216 struct page *page = rx_buf->page; in ef4_unmap_rx_buffer()
228 struct ef4_rx_buffer *rx_buf, in ef4_free_rx_buffers() argument
232 if (rx_buf->page) { in ef4_free_rx_buffers()
233 put_page(rx_buf->page); in ef4_free_rx_buffers()
234 rx_buf->page = NULL; in ef4_free_rx_buffers()
236 rx_buf = ef4_rx_buf_next(rx_queue, rx_buf); in ef4_free_rx_buffers()
245 struct ef4_rx_buffer *rx_buf) in ef4_recycle_rx_page() argument
247 struct page *page = rx_buf->page; in ef4_recycle_rx_page()
253 if (!(rx_buf->flags & EF4_RX_BUF_LAST_IN_PAGE)) in ef4_recycle_rx_page()
272 ef4_unmap_rx_buffer(efx, rx_buf); in ef4_recycle_rx_page()
273 put_page(rx_buf->page); in ef4_recycle_rx_page()
277 struct ef4_rx_buffer *rx_buf) in ef4_fini_rx_buffer() argument
280 if (rx_buf->page) in ef4_fini_rx_buffer()
281 put_page(rx_buf->page); in ef4_fini_rx_buffer()
284 if (rx_buf->flags & EF4_RX_BUF_LAST_IN_PAGE) { in ef4_fini_rx_buffer()
285 ef4_unmap_rx_buffer(rx_queue->efx, rx_buf); in ef4_fini_rx_buffer()
286 ef4_free_rx_buffers(rx_queue, rx_buf, 1); in ef4_fini_rx_buffer()
288 rx_buf->page = NULL; in ef4_fini_rx_buffer()
293 struct ef4_rx_buffer *rx_buf, in ef4_recycle_rx_pages() argument
302 ef4_recycle_rx_page(channel, rx_buf); in ef4_recycle_rx_pages()
303 rx_buf = ef4_rx_buf_next(rx_queue, rx_buf); in ef4_recycle_rx_pages()
308 struct ef4_rx_buffer *rx_buf, in ef4_discard_rx_packet() argument
313 ef4_recycle_rx_pages(channel, rx_buf, n_frags); in ef4_discard_rx_packet()
315 ef4_free_rx_buffers(rx_queue, rx_buf, n_frags); in ef4_discard_rx_packet()
393 struct ef4_rx_buffer *rx_buf, in ef4_rx_packet__check_len() argument
397 unsigned max_len = rx_buf->len - efx->type->rx_buffer_padding; in ef4_rx_packet__check_len()
405 rx_buf->flags |= EF4_RX_PKT_DISCARD; in ef4_rx_packet__check_len()
407 if ((len > rx_buf->len) && EF4_WORKAROUND_8071(efx)) { in ef4_rx_packet__check_len()
430 ef4_rx_packet_gro(struct ef4_channel *channel, struct ef4_rx_buffer *rx_buf, in ef4_rx_packet_gro() argument
442 ef4_free_rx_buffers(rx_queue, rx_buf, n_frags); in ef4_rx_packet_gro()
449 skb->ip_summed = ((rx_buf->flags & EF4_RX_PKT_CSUMMED) ? in ef4_rx_packet_gro()
454 rx_buf->page, rx_buf->page_offset, in ef4_rx_packet_gro()
455 rx_buf->len); in ef4_rx_packet_gro()
456 rx_buf->page = NULL; in ef4_rx_packet_gro()
457 skb->len += rx_buf->len; in ef4_rx_packet_gro()
461 rx_buf = ef4_rx_buf_next(&channel->rx_queue, rx_buf); in ef4_rx_packet_gro()
474 struct ef4_rx_buffer *rx_buf, in ef4_rx_mk_skb() argument
490 EF4_BUG_ON_PARANOID(rx_buf->len < hdr_len); in ef4_rx_mk_skb()
498 if (rx_buf->len > hdr_len) { in ef4_rx_mk_skb()
499 rx_buf->page_offset += hdr_len; in ef4_rx_mk_skb()
500 rx_buf->len -= hdr_len; in ef4_rx_mk_skb()
504 rx_buf->page, rx_buf->page_offset, in ef4_rx_mk_skb()
505 rx_buf->len); in ef4_rx_mk_skb()
506 rx_buf->page = NULL; in ef4_rx_mk_skb()
507 skb->len += rx_buf->len; in ef4_rx_mk_skb()
508 skb->data_len += rx_buf->len; in ef4_rx_mk_skb()
512 rx_buf = ef4_rx_buf_next(&channel->rx_queue, rx_buf); in ef4_rx_mk_skb()
515 __free_pages(rx_buf->page, efx->rx_buffer_order); in ef4_rx_mk_skb()
516 rx_buf->page = NULL; in ef4_rx_mk_skb()
535 struct ef4_rx_buffer *rx_buf; in ef4_rx_packet() local
539 rx_buf = ef4_rx_buffer(rx_queue, index); in ef4_rx_packet()
540 rx_buf->flags |= flags; in ef4_rx_packet()
545 ef4_rx_packet__check_len(rx_queue, rx_buf, len); in ef4_rx_packet()
553 WARN_ON(!(len == 0 && rx_buf->flags & EF4_RX_PKT_DISCARD)); in ef4_rx_packet()
554 rx_buf->flags |= EF4_RX_PKT_DISCARD; in ef4_rx_packet()
561 (rx_buf->flags & EF4_RX_PKT_CSUMMED) ? " [SUMMED]" : "", in ef4_rx_packet()
562 (rx_buf->flags & EF4_RX_PKT_DISCARD) ? " [DISCARD]" : ""); in ef4_rx_packet()
567 if (unlikely(rx_buf->flags & EF4_RX_PKT_DISCARD)) { in ef4_rx_packet()
569 ef4_discard_rx_packet(channel, rx_buf, n_frags); in ef4_rx_packet()
574 rx_buf->len = len; in ef4_rx_packet()
579 ef4_sync_rx_buffer(efx, rx_buf, rx_buf->len); in ef4_rx_packet()
584 prefetch(ef4_rx_buf_va(rx_buf)); in ef4_rx_packet()
586 rx_buf->page_offset += efx->rx_prefix_size; in ef4_rx_packet()
587 rx_buf->len -= efx->rx_prefix_size; in ef4_rx_packet()
596 rx_buf = ef4_rx_buf_next(rx_queue, rx_buf); in ef4_rx_packet()
599 ef4_sync_rx_buffer(efx, rx_buf, efx->rx_dma_len); in ef4_rx_packet()
601 rx_buf->len = len - (n_frags - 1) * efx->rx_dma_len; in ef4_rx_packet()
602 ef4_sync_rx_buffer(efx, rx_buf, rx_buf->len); in ef4_rx_packet()
606 rx_buf = ef4_rx_buffer(rx_queue, index); in ef4_rx_packet()
607 ef4_recycle_rx_pages(channel, rx_buf, n_frags); in ef4_rx_packet()
618 struct ef4_rx_buffer *rx_buf, in ef4_rx_deliver() argument
622 u16 hdr_len = min_t(u16, rx_buf->len, EF4_SKB_HEADERS); in ef4_rx_deliver()
624 skb = ef4_rx_mk_skb(channel, rx_buf, n_frags, eh, hdr_len); in ef4_rx_deliver()
629 ef4_free_rx_buffers(rx_queue, rx_buf, n_frags); in ef4_rx_deliver()
636 if (likely(rx_buf->flags & EF4_RX_PKT_CSUMMED)) in ef4_rx_deliver()
651 struct ef4_rx_buffer *rx_buf = in __ef4_rx_packet() local
653 u8 *eh = ef4_rx_buf_va(rx_buf); in __ef4_rx_packet()
658 if (rx_buf->flags & EF4_RX_PKT_PREFIX_LEN) in __ef4_rx_packet()
659 rx_buf->len = le16_to_cpup((__le16 *) in __ef4_rx_packet()
668 ef4_loopback_rx_packet(efx, eh, rx_buf->len); in __ef4_rx_packet()
670 ef4_free_rx_buffers(rx_queue, rx_buf, in __ef4_rx_packet()
676 rx_buf->flags &= ~EF4_RX_PKT_CSUMMED; in __ef4_rx_packet()
678 if ((rx_buf->flags & EF4_RX_PKT_TCP) && !channel->type->receive_skb) in __ef4_rx_packet()
679 ef4_rx_packet_gro(channel, rx_buf, channel->rx_pkt_n_frags, eh); in __ef4_rx_packet()
681 ef4_rx_deliver(channel, eh, rx_buf, channel->rx_pkt_n_frags); in __ef4_rx_packet()
789 struct ef4_rx_buffer *rx_buf; in ef4_fini_rx_queue() local
801 rx_buf = ef4_rx_buffer(rx_queue, index); in ef4_fini_rx_queue()
802 ef4_fini_rx_buffer(rx_queue, rx_buf); in ef4_fini_rx_queue()