Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7715ff16 authored by Ilias Apalodimas's avatar Ilias Apalodimas Committed by David S. Miller
Browse files

net: netsec: start using buffers if page_pool registration succeeded



The current driver starts using page_pool buffers before calling
xdp_rxq_info_reg_mem_model(). Start using the buffers after the
registration succeeded, so we won't have to call
page_pool_request_shutdown() in case of failure

Fixes: 5c67bf0e ("net: netsec: Use page_pool API")
Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de90573e
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -1309,6 +1309,15 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv)
		goto err_out;
	}

	err = xdp_rxq_info_reg(&dring->xdp_rxq, priv->ndev, 0);
	if (err)
		goto err_out;

	err = xdp_rxq_info_reg_mem_model(&dring->xdp_rxq, MEM_TYPE_PAGE_POOL,
					 dring->page_pool);
	if (err)
		goto err_out;

	for (i = 0; i < DESC_NUM; i++) {
		struct netsec_desc *desc = &dring->desc[i];
		dma_addr_t dma_handle;
@@ -1327,14 +1336,6 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv)
	}

	netsec_rx_fill(priv, 0, DESC_NUM);
	err = xdp_rxq_info_reg(&dring->xdp_rxq, priv->ndev, 0);
	if (err)
		goto err_out;

	err = xdp_rxq_info_reg_mem_model(&dring->xdp_rxq, MEM_TYPE_PAGE_POOL,
					 dring->page_pool);
	if (err)
		goto err_out;

	return 0;