summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>2017-03-31 15:36:35 +0200
committerThomas Monjalon <thomas@monjalon.net>2017-04-21 02:15:26 +0200
commit614fcaca62ee30b0da570264fa5d2a83e125a75f (patch)
tree310759233b568143c3d2da36e940a12d31fa04cf
parent25f2af08844c4a296239ba274b50daa5aaf24298 (diff)
downloaddpdk-614fcaca62ee30b0da570264fa5d2a83e125a75f.zip
dpdk-614fcaca62ee30b0da570264fa5d2a83e125a75f.tar.gz
dpdk-614fcaca62ee30b0da570264fa5d2a83e125a75f.tar.xz
port: fix file descriptor reader
The code should return the actual number of packets read. Fixes: 5a99f208 ("port: support file descriptor") 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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/librte_port/rte_port_fd.c b/lib/librte_port/rte_port_fd.c
index 8ce2423..b5b3729 100644
--- a/lib/librte_port/rte_port_fd.c
+++ b/lib/librte_port/rte_port_fd.c
@@ -108,7 +108,7 @@ static int
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;
+ uint32_t i, j;
if (rte_pktmbuf_alloc_bulk(p->mempool, pkts, n_pkts) != 0)
return 0;
@@ -126,12 +126,12 @@ rte_port_fd_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts)
pkt->pkt_len = n_bytes;
}
- for ( ; i < n_pkts; i++)
- rte_pktmbuf_free(pkts[i]);
+ for (j = i; j < n_pkts; j++)
+ rte_pktmbuf_free(pkts[j]);
RTE_PORT_FD_READER_STATS_PKTS_IN_ADD(p, i);
- return n_pkts;
+ return i;
}
static int