From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A774BA00BE; Fri, 1 Nov 2019 14:22:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8026F1D483; Fri, 1 Nov 2019 14:22:27 +0100 (CET) Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by dpdk.org (Postfix) with ESMTP id 7C2FE1BFC1 for ; Fri, 1 Nov 2019 14:22:25 +0100 (CET) Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A1069123ECD5E23E8F78 for ; Fri, 1 Nov 2019 21:22:24 +0800 (CST) Received: from tester.localdomain (10.175.119.39) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Fri, 1 Nov 2019 21:22:17 +0800 From: Xiaoyun wang To: CC: , , , , , , , Xiaoyun wang Date: Fri, 1 Nov 2019 21:36:44 +0800 Message-ID: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.119.39] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v5 3/5] net/hinic: optimize mbuf alloc function with initialized X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/hinic/hinic_pmd_rx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); -- 1.8.3.1