DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <zhouguoyang@huawei.com>,
	<wulike1@huawei.com>,  <luoxianjun@huawei.com>,
	<shahar.belkar@huawei.com>, <tanya.brokhman@huawei.com>,
	<xuanziyang2@huawei.com>,
	Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
Subject: [dpdk-dev] [PATCH v5 3/5] net/hinic: optimize mbuf alloc function with initialized
Date: Fri, 1 Nov 2019 21:36:44 +0800	[thread overview]
Message-ID: <bcdf538b418ad716939c780b63e595974494cc78.1572613507.git.cloud.wangxiaoyun@huawei.com> (raw)
In-Reply-To: <cover.1572613507.git.cloud.wangxiaoyun@huawei.com>

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(-)

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


  parent reply	other threads:[~2019-11-01 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 13:36 [dpdk-dev] [PATCH v5 0/5] Some fixes for hinic PMD driver Xiaoyun wang
2019-11-01 13:36 ` [dpdk-dev] [PATCH v5 1/5] net/hinic/base: fix code style check issue Xiaoyun wang
2019-11-01 13:36 ` [dpdk-dev] [PATCH v5 2/5] net/hinic: fix offload info calculating problem for TSO Xiaoyun wang
2019-11-01 13:36 ` Xiaoyun wang [this message]
2019-11-01 13:36 ` [dpdk-dev] [PATCH v5 4/5] net/hinic: remove Flow Director feature from doc files Xiaoyun wang
2019-11-01 13:36 ` [dpdk-dev] [PATCH v5 5/5] net/hinic: remove Free Tx mbuf on demand from hinic.ini Xiaoyun wang
2019-11-07  9:29 ` [dpdk-dev] [PATCH v5 0/5] Some fixes for hinic PMD driver Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bcdf538b418ad716939c780b63e595974494cc78.1572613507.git.cloud.wangxiaoyun@huawei.com \
    --to=cloud.wangxiaoyun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=luoxianjun@huawei.com \
    --cc=shahar.belkar@huawei.com \
    --cc=tanya.brokhman@huawei.com \
    --cc=wulike1@huawei.com \
    --cc=xuanziyang2@huawei.com \
    --cc=zhouguoyang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).