[v5,3/5] net/hinic: optimize mbuf alloc function with initialized

Message ID bcdf538b418ad716939c780b63e595974494cc78.1572613507.git.cloud.wangxiaoyun@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Some fixes for hinic PMD driver |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Wangxiaoyun (Cloud) Nov. 1, 2019, 1:36 p.m. UTC
  When port start, driver needs to alloc mbuf resource to fill rx
queue bd section, replace rte_mbuf_raw_alloc function to
rte_pktmbuf_alloc_bulk with initialized mbuf structure to aviod
some structures being used without initialization.

Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/hinic_pmd_rx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c
index 743bae9..f865f2f 100644
--- a/drivers/net/hinic/hinic_pmd_rx.c
+++ b/drivers/net/hinic/hinic_pmd_rx.c
@@ -853,10 +853,11 @@  static inline u32 hinic_rx_alloc_mbuf_bulk(struct hinic_rxq *rxq,
 static struct rte_mbuf *hinic_rx_alloc_mbuf(struct hinic_rxq *rxq,
 					dma_addr_t *dma_addr)
 {
-	struct rte_mbuf *mbuf;
+	struct rte_mbuf *mbuf = NULL;
+	int rc;
 
-	mbuf = rte_mbuf_raw_alloc(rxq->mb_pool);
-	if (unlikely(!mbuf))
+	rc = rte_pktmbuf_alloc_bulk(rxq->mb_pool, &mbuf, 1);
+	if (unlikely(rc != HINIC_OK))
 		return NULL;
 
 	*dma_addr = rte_mbuf_data_iova_default(mbuf);