struct mvneta_rx_queue *rxq,
gfp_t gfp_mask)
{
- enum dma_data_direction dma_dir;
dma_addr_t phys_addr;
struct page *page;
return -ENOMEM;
phys_addr = page_pool_get_dma_addr(page) + pp->rx_offset_correction;
- dma_dir = page_pool_get_dma_dir(rxq->page_pool);
- dma_sync_single_for_device(pp->dev->dev.parent, phys_addr,
- MVNETA_MAX_RX_BUF_SIZE, dma_dir);
mvneta_rx_desc_fill(rx_desc, phys_addr, page, rxq);
return 0;
err = xdp_do_redirect(pp->dev, xdp, prog);
if (err) {
ret = MVNETA_XDP_DROPPED;
- page_pool_recycle_direct(rxq->page_pool,
- virt_to_head_page(xdp->data));
+ __page_pool_put_page(rxq->page_pool,
+ virt_to_head_page(xdp->data),
+ xdp->data_end - xdp->data_hard_start,
+ true);
} else {
ret = MVNETA_XDP_REDIR;
}
case XDP_TX:
ret = mvneta_xdp_xmit_back(pp, xdp);
if (ret != MVNETA_XDP_TX)
- page_pool_recycle_direct(rxq->page_pool,
- virt_to_head_page(xdp->data));
+ __page_pool_put_page(rxq->page_pool,
+ virt_to_head_page(xdp->data),
+ xdp->data_end - xdp->data_hard_start,
+ true);
break;
default:
bpf_warn_invalid_xdp_action(act);
trace_xdp_exception(pp->dev, prog, act);
/* fall through */
case XDP_DROP:
- page_pool_recycle_direct(rxq->page_pool,
- virt_to_head_page(xdp->data));
+ __page_pool_put_page(rxq->page_pool,
+ virt_to_head_page(xdp->data),
+ xdp->data_end - xdp->data_hard_start,
+ true);
ret = MVNETA_XDP_DROPPED;
break;
}
struct bpf_prog *xdp_prog = READ_ONCE(pp->xdp_prog);
struct page_pool_params pp_params = {
.order = 0,
- .flags = PP_FLAG_DMA_MAP,
+ .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
.pool_size = size,
.nid = cpu_to_node(0),
.dev = pp->dev->dev.parent,
.dma_dir = xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE,
+ .offset = pp->rx_offset_correction,
+ .max_len = MVNETA_MAX_RX_BUF_SIZE,
};
int err;