From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id B81AD2C27 for ; Thu, 13 Apr 2017 17:35:24 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2017 08:35:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,195,1488873600"; d="scan'208";a="76978896" Received: from silpixa00397515.ir.intel.com (HELO silpixa00397515.ger.corp.intel.com) ([10.237.223.14]) by orsmga004.jf.intel.com with ESMTP; 13 Apr 2017 08:35:22 -0700 From: David Hunt To: dev@dpdk.org Cc: David Hunt Date: Thu, 13 Apr 2017 09:36:27 +0100 Message-Id: <1492072587-121343-1-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v1] lib/distributor: fix segfaults in flush X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Apr 2017 15:35:25 -0000 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 Signed-off-by: David Hunt --- 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