[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191015154107.08c4e9e1@cakuba.netronome.com>
Date: Tue, 15 Oct 2019 15:41:07 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: netdev@...r.kernel.org, lorenzo.bianconi@...hat.com,
davem@...emloft.net, thomas.petazzoni@...tlin.com,
brouer@...hat.com, ilias.apalodimas@...aro.org,
matteo.croce@...hat.com, mw@...ihalf.com
Subject: Re: [PATCH v3 net-next 2/8] net: mvneta: introduce page pool API
for sw buffer manager
On Mon, 14 Oct 2019 12:49:49 +0200, Lorenzo Bianconi wrote:
> +static int mvneta_create_page_pool(struct mvneta_port *pp,
> + struct mvneta_rx_queue *rxq, int size)
> +{
> + struct page_pool_params pp_params = {
> + .order = 0,
> + .flags = PP_FLAG_DMA_MAP,
> + .pool_size = size,
> + .nid = cpu_to_node(0),
> + .dev = pp->dev->dev.parent,
> + .dma_dir = DMA_FROM_DEVICE,
> + };
> + int err;
> +
> + rxq->page_pool = page_pool_create(&pp_params);
> + if (IS_ERR(rxq->page_pool)) {
> + err = PTR_ERR(rxq->page_pool);
> + rxq->page_pool = NULL;
> + return err;
> + }
> +
> + err = xdp_rxq_info_reg(&rxq->xdp_rxq, pp->dev, 0);
The queue_index is always passed as 0, is there only a single queue?
XDP programs can read this field.
> + if (err < 0)
> + goto err_free_pp;
> +
> + err = xdp_rxq_info_reg_mem_model(&rxq->xdp_rxq, MEM_TYPE_PAGE_POOL,
> + rxq->page_pool);
> + if (err)
> + goto err_unregister_rxq;
> +
> + return 0;
> +
> +err_unregister_rxq:
> + xdp_rxq_info_unreg(&rxq->xdp_rxq);
> +err_free_pp:
> + page_pool_destroy(rxq->page_pool);
> + return err;
> +}
Powered by blists - more mailing lists