diff mbox series

net: netsec: start using buffers if page_pool registration succeeded

Message ID 1562675753-26160-1-git-send-email-ilias.apalodimas@linaro.org
State New
Headers show
Series net: netsec: start using buffers if page_pool registration succeeded | expand

Commit Message

Ilias Apalodimas July 9, 2019, 12:35 p.m. UTC
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: 5c67bf0ec4d0 ("net: netsec: Use page_pool API")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

---
 drivers/net/ethernet/socionext/netsec.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

-- 
2.20.1

Comments

David Miller July 9, 2019, 8 p.m. UTC | #1
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Date: Tue,  9 Jul 2019 15:35:53 +0300

> 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: 5c67bf0ec4d0 ("net: netsec: Use page_pool API")

> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index d7307ab90d74..c3a4f86f56ee 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -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;