DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/1] ip_pipeline: fixed parsing cpu cores
Date: Tue, 21 Jul 2015 16:39:00 +0200	[thread overview]
Message-ID: <1437489540-20758-1-git-send-email-maciejx.t.gajdzica@intel.com> (raw)

This patch fixes parsing value of core variable in pipeline config.
Before not every combination of cores (c), sockets (s) and
hyperthreading (h) was parsed correctly.

Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica@intel.com>
---
 examples/ip_pipeline/config_parse.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c
index 361bf8a..c9b78f9 100644
--- a/examples/ip_pipeline/config_parse.c
+++ b/examples/ip_pipeline/config_parse.c
@@ -386,14 +386,14 @@ parse_pipeline_core(uint32_t *socket,
 		switch (type) {
 		case 's':
 		case 'S':
-			if (s_parsed)
+			if (s_parsed || c_parsed || h_parsed)
 				return -EINVAL;
 			s_parsed = 1;
 			next++;
 			break;
 		case 'c':
 		case 'C':
-			if (c_parsed)
+			if (c_parsed || h_parsed)
 				return -EINVAL;
 			c_parsed = 1;
 			next++;
@@ -423,7 +423,10 @@ parse_pipeline_core(uint32_t *socket,
 			num[num_len] = *next;
 		}
 
-		if (num_len == 0 && type != 'h')
+		if (num_len == 0 && type != 'h' && type != 'H')
+			return -EINVAL;
+
+		if (num_len != 0 && (type == 'h' || type == 'H'))
 			return -EINVAL;
 
 		num[num_len] = '\0';
@@ -438,9 +441,6 @@ parse_pipeline_core(uint32_t *socket,
 		case 'c':
 		case 'C':
 			c = val;
-			if (type == 'C' && *next != '\0')
-				return -EINVAL;
-
 			break;
 		case 'h':
 		case 'H':
-- 
1.7.9.5

             reply	other threads:[~2015-07-21 14:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 14:39 Maciej Gajdzica [this message]
2015-07-21 15:35 ` Dumitrescu, Cristian
2015-07-27 13:50   ` 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=1437489540-20758-1-git-send-email-maciejx.t.gajdzica@intel.com \
    --to=maciejx.t.gajdzica@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).