Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 4/6] spp_vm: fix to use uint16_t port_id in do_add
Date: Tue,  9 Oct 2018 19:53:58 +0900	[thread overview]
Message-ID: <20181009105400.42817-5-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181009105400.42817-1-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

Modify to use uint16_t type for port_id.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/vm/main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/vm/main.c b/src/vm/main.c
index 3807370..2813fca 100644
--- a/src/vm/main.c
+++ b/src/vm/main.c
@@ -373,7 +373,7 @@ static int
 do_add(char *res_uid)
 {
 	enum port_type type = UNDEF;
-	int port_id = PORT_RESET;
+	uint16_t port_id = PORT_RESET;
 	char *p_type;
 	int p_id;
 	int res;
@@ -384,11 +384,13 @@ do_add(char *res_uid)
 
 	if (!strcmp(p_type, "ring")) {
 		type = RING;
-		port_id = add_ring_pmd(p_id);
+		res = add_ring_pmd(p_id);
 	}
 
-	if (port_id < 0)
+	if (res < 0)
 		return -1;
+	else
+		port_id = (uint16_t) res;
 
 	port_map[port_id].id = p_id;
 	port_map[port_id].port_type = type;
-- 
2.7.4

  parent reply	other threads:[~2018-10-09 10:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 10:53 [spp] [PATCH 0/6] Fix bug of assigning ports ogawa.yasufumi
2018-10-09 10:53 ` [spp] [PATCH 1/6] spp_nfv: fix bug of do_del if port does not exist ogawa.yasufumi
2018-10-09 10:53 ` [spp] [PATCH 2/6] spp_nfv: refactor log of patch command ogawa.yasufumi
2018-10-09 10:53 ` [spp] [PATCH 3/6] spp_vm: fix bug of do_del if port does not exist ogawa.yasufumi
2018-10-09 10:53 ` ogawa.yasufumi [this message]
2018-10-09 10:53 ` [spp] [PATCH 5/6] spp_vm: correct error handling if patch cmd failed ogawa.yasufumi
2018-10-09 10:54 ` [spp] [PATCH 6/6] spp_vm: refactor log of patch command ogawa.yasufumi

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=20181009105400.42817-5-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@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).