From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <wei.dai@intel.com>
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 6C2B858ED
 for <dev@dpdk.org>; Tue, 26 Jul 2016 11:54:15 +0200 (CEST)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga104.fm.intel.com with ESMTP; 26 Jul 2016 02:54:14 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.28,424,1464678000"; d="scan'208";a="1013988548"
Received: from dpdk2.bj.intel.com ([172.16.182.189])
 by fmsmga001.fm.intel.com with ESMTP; 26 Jul 2016 02:54:15 -0700
From: Wei Dai <wei.dai@intel.com>
To: dev@dpdk.org
Cc: Wei Dai <wei.dai@intel.com>
Date: Tue, 26 Jul 2016 17:52:43 +0800
Message-Id: <1469526763-19789-1-git-send-email-wei.dai@intel.com>
X-Mailer: git-send-email 2.5.5
In-Reply-To: <1469081018-55300-1-git-send-email-wei.dai@intel.com>
References: <1469081018-55300-1-git-send-email-wei.dai@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/2] eal: fix parsing of eal option --lcores
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 26 Jul 2016 09:54:15 -0000

The '-' in lcore set overrides cpu set of following
lcore set in the argument of EAL option --lcores.
for example --locres '0-2,(3-5)@(3,4),6@(5,6),7@(5-7)',
0-2 make lflags=1 which indeed suppress following
cpu set (3,4), (5,6) and (5-7) after @ .

Fixes: 53e54bf81700 ("eal: new option --lcores for cpu assignment")

Signed-off-by: Wei Dai <wei.dai@intel.com>
---
 lib/librte_eal/common/eal_common_options.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index c5bf98c..217d08b 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -583,7 +583,7 @@ eal_parse_lcores(const char *lcores)
 	const char *end = NULL;
 	int offset;
 	rte_cpuset_t cpuset;
-	int lflags = 0;
+	int lflags;
 	int ret = -1;
 
 	if (lcores == NULL)
@@ -609,6 +609,8 @@ eal_parse_lcores(const char *lcores)
 		if (*lcores == '\0')
 			goto err;
 
+		lflags = 0;
+
 		/* record lcore_set start point */
 		lcore_start = lcores;
 
-- 
2.5.5