DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>
To: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/5] port: use mbuf alloc bulk instead of mempool
Date: Fri, 31 Mar 2017 15:36:34 +0200	[thread overview]
Message-ID: <1490967396-2240-3-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> (raw)
In-Reply-To: <1490967396-2240-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com>

Makes code a bit cleaner and type-aware.

Signed-off-by: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>
---
 lib/librte_port/rte_port_fd.c          | 7 +------
 lib/librte_port/rte_port_source_sink.c | 7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/lib/librte_port/rte_port_fd.c b/lib/librte_port/rte_port_fd.c
index 0d640f3..03e69f5 100644
--- a/lib/librte_port/rte_port_fd.c
+++ b/lib/librte_port/rte_port_fd.c
@@ -110,15 +110,10 @@ rte_port_fd_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 	struct rte_port_fd_reader *p = (struct rte_port_fd_reader *) port;
 	uint32_t i;
 
-	if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0)
+	if (rte_pktmbuf_alloc_bulk(p->mempool, pkts, n_pkts) != 0)
 		return 0;
 
 	for (i = 0; i < n_pkts; i++) {
-		rte_mbuf_refcnt_set(pkts[i], 1);
-		rte_pktmbuf_reset(pkts[i]);
-	}
-
-	for (i = 0; i < n_pkts; i++) {
 		struct rte_mbuf *pkt = pkts[i];
 		void *pkt_data = rte_pktmbuf_mtod(pkt, void *);
 		ssize_t n_bytes;
diff --git a/lib/librte_port/rte_port_source_sink.c b/lib/librte_port/rte_port_source_sink.c
index 4cad710..796418a 100644
--- a/lib/librte_port/rte_port_source_sink.c
+++ b/lib/librte_port/rte_port_source_sink.c
@@ -289,14 +289,9 @@ rte_port_source_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 	struct rte_port_source *p = (struct rte_port_source *) port;
 	uint32_t i;
 
-	if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0)
+	if (rte_pktmbuf_alloc_bulk(p->mempool, pkts, n_pkts) != 0)
 		return 0;
 
-	for (i = 0; i < n_pkts; i++) {
-		rte_mbuf_refcnt_set(pkts[i], 1);
-		rte_pktmbuf_reset(pkts[i]);
-	}
-
 	if (p->pkt_buff != NULL) {
 		for (i = 0; i < n_pkts; i++) {
 			uint8_t *pkt_data = rte_pktmbuf_mtod(pkts[i],
-- 
2.7.4

  parent reply	other threads:[~2017-03-31 13:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 13:36 [dpdk-dev] [PATCH 1/5] examples/ip_pipeline: add support for more than 32 CPUs Andriy Berestovskyy
2017-03-31 13:36 ` [dpdk-dev] [PATCH 2/5] examples/ip_pipeline: avoid panic if link up/down is not supported Andriy Berestovskyy
2017-03-31 14:17   ` Dumitrescu, Cristian
2017-03-31 13:36 ` Andriy Berestovskyy [this message]
2017-03-31 14:18   ` [dpdk-dev] [PATCH 3/5] port: use mbuf alloc bulk instead of mempool Dumitrescu, Cristian
2017-03-31 13:36 ` [dpdk-dev] [PATCH 4/5] port: fix file descriptor reader Andriy Berestovskyy
2017-03-31 14:18   ` Dumitrescu, Cristian
2017-03-31 13:36 ` [dpdk-dev] [PATCH 5/5] port: minor typo Andriy Berestovskyy
2017-03-31 14:18   ` Dumitrescu, Cristian
2017-03-31 14:17 ` [dpdk-dev] [PATCH 1/5] examples/ip_pipeline: add support for more than 32 CPUs Dumitrescu, Cristian
2017-04-21  0:16   ` Thomas Monjalon

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=1490967396-2240-3-git-send-email-Andriy.Berestovskyy@caviumnetworks.com \
    --to=andriy.berestovskyy@caviumnetworks.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /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).