DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: David Hunt <david.hunt@intel.com>
Subject: [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush
Date: Thu, 13 Apr 2017 09:36:27 +0100	[thread overview]
Message-ID: <1492072587-121343-1-git-send-email-david.hunt@intel.com> (raw)

A segfault when flushing packets has been revealed by further testing
when using distributor in single packet mode. This patch resolves that.

Fixes: 775003ad2f96 ("distributor: add new burst-capable library")

Reported-by: Yong Liu <yong.liu@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 lib/librte_distributor/rte_distributor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index 4725904..e4dfa7f 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -555,7 +555,7 @@ total_outstanding(const struct rte_distributor *d)
 int
 rte_distributor_flush_v1705(struct rte_distributor *d)
 {
-	const unsigned int flushed = total_outstanding(d);
+	unsigned int flushed;
 	unsigned int wkr;
 
 	if (d->alg_type == RTE_DIST_ALG_SINGLE) {
@@ -563,6 +563,8 @@ rte_distributor_flush_v1705(struct rte_distributor *d)
 		return rte_distributor_flush_v20(d->d_v20);
 	}
 
+	flushed = total_outstanding(d);
+
 	while (total_outstanding(d) > 0)
 		rte_distributor_process(d, NULL, 0);
 
@@ -590,6 +592,7 @@ rte_distributor_clear_returns_v1705(struct rte_distributor *d)
 	if (d->alg_type == RTE_DIST_ALG_SINGLE) {
 		/* Call the old API */
 		rte_distributor_clear_returns_v20(d->d_v20);
+		return;
 	}
 
 	/* throw away returns, so workers can exit */
-- 
2.7.4

             reply	other threads:[~2017-04-13 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  8:36 David Hunt [this message]
2017-04-14  6:04 ` Liu, Yong
2017-04-14  8:41 ` Bruce Richardson
2017-04-14  8:59 ` [dpdk-dev] [PATCH v2] " David Hunt
2017-04-20 23:05   ` 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=1492072587-121343-1-git-send-email-david.hunt@intel.com \
    --to=david.hunt@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).