summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>2017-03-31 15:36:34 +0200
committerThomas Monjalon <thomas@monjalon.net>2017-04-21 02:15:23 +0200
commit25f2af08844c4a296239ba274b50daa5aaf24298 (patch)
treeeec82d0e7939641cf0b4256077b3346236673360
parent0469250961215809568153615fb2e0e9addfafed (diff)
downloaddpdk-25f2af08844c4a296239ba274b50daa5aaf24298.zip
dpdk-25f2af08844c4a296239ba274b50daa5aaf24298.tar.gz
dpdk-25f2af08844c4a296239ba274b50daa5aaf24298.tar.xz
port: use mbuf alloc bulk instead of mempool
Makes code a bit cleaner and type-aware. Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
-rw-r--r--lib/librte_port/rte_port_fd.c7
-rw-r--r--lib/librte_port/rte_port_source_sink.c7
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 ae9f31c..8ce2423 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 = 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 851916c..a79f2f6 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 = 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],