Re: [net-next PATCH v5 1/6] octeontx2-pf: use xdp_return_frame() to free xdp buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 06, 2025 at 02:20:29PM +0530, Suman Ghosh wrote:
> xdp_return_frames() will help to free the xdp frames and their
> associated pages back to page pool.
> 
> Signed-off-by: Geetha sowjanya <gakula@xxxxxxxxxxx>
> Signed-off-by: Suman Ghosh <sumang@xxxxxxxxxxx>

...

> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c

...

> @@ -1465,10 +1476,14 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
>  		trace_xdp_exception(pfvf->netdev, prog, act);
>  		break;
>  	case XDP_DROP:
> +		cq->pool_ptrs++;
> +		if (page->pp) {
> +			page_pool_recycle_direct(pool->page_pool, page);
> +			return true;
> +		}
>  		otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
>  				    DMA_FROM_DEVICE);
>  		put_page(page);
> -		cq->pool_ptrs++;
>  		return true;

The above seems to get shuffled around in the next patch anyway, so
maybe it's best to do this here (completely untested):

	case XDP_DROP:
		cq->pool_ptrs++;
		if (page->pp) {
			page_pool_recycle_direct(pool->page_pool, page);
		} else {
			otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
					    DMA_FROM_DEVICE);
			put_page(page);
		}
		return true;

>  	}
>  	return false;

...




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux