Skip to content

Commit

Permalink
net: netsec: start using buffers if page_pool registration succeeded
Browse files Browse the repository at this point in the history
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: 5c67bf0 ("net: netsec: Use page_pool API")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ilias Apalodimas authored and David S. Miller committed Jul 9, 2019
1 parent de90573 commit 7715ff1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/net/ethernet/socionext/netsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 7715ff1

Please sign in to comment.