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 4/5] port: fix file descriptor reader
Date: Fri, 31 Mar 2017 15:36:35 +0200	[thread overview]
Message-ID: <1490967396-2240-4-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> (raw)
In-Reply-To: <1490967396-2240-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com>

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>
---
 lib/librte_port/rte_port_fd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_port/rte_port_fd.c b/lib/librte_port/rte_port_fd.c
index 03e69f5..914dfac 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 = (struct rte_port_fd_reader *) 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
-- 
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 ` [dpdk-dev] [PATCH 3/5] port: use mbuf alloc bulk instead of mempool Andriy Berestovskyy
2017-03-31 14:18   ` Dumitrescu, Cristian
2017-03-31 13:36 ` Andriy Berestovskyy [this message]
2017-03-31 14:18   ` [dpdk-dev] [PATCH 4/5] port: fix file descriptor reader 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-4-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).