From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 5/5] spp_vm: refactor add_ring_pmd
Date: Tue, 9 Oct 2018 19:52:07 +0900 [thread overview]
Message-ID: <20181009105207.42636-6-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181009105207.42636-1-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
* Correct assigning of uint16_to for port ID which is assigned as int
incorrectly.
* Correct log messages.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/vm/main.c | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/src/vm/main.c b/src/vm/main.c
index 55592df..63d5684 100644
--- a/src/vm/main.c
+++ b/src/vm/main.c
@@ -315,32 +315,47 @@ get_memzone_by_addr(const void *addr)
return mz;
}
+/*
+ * Create ring PMD with given ring_id.
+ */
static int
add_ring_pmd(int ring_id)
{
const struct rte_memzone *memzone;
struct rte_ring *ring;
- int ring_port_id;
+ int res;
+ char rx_queue_name[32]; /* Prefix and number like as 'eth_ring_0' */
- /* look up ring, based on user's provided id*/
- ring = rte_ring_lookup(get_rx_queue_name(ring_id));
+ memset(rx_queue_name, '\0', sizeof(rx_queue_name));
+ sprintf(rx_queue_name, "%s", get_rx_queue_name(ring_id));
+
+ /* Look up ring with provided ring_id */
+ ring = rte_ring_lookup(rx_queue_name);
if (ring == NULL) {
RTE_LOG(ERR, APP,
- "Cannot get RX ring - is server process running?\n");
+ "Failed to get RX ring %s - is primary running?\n",
+ rx_queue_name);
return -1;
}
+ RTE_LOG(INFO, APP, "Looked up ring '%s'\n", rx_queue_name);
memzone = get_memzone_by_addr(ring);
- if (memzone == NULL)
+ if (memzone == NULL) {
+ RTE_LOG(ERR, APP, "Cannot get memzone\n");
return -1;
+ }
- /* create ring pmd*/
+ /* Create ring pmd */
ring->memzone = memzone;
- ring_port_id = rte_eth_from_ring(ring);
-
- RTE_LOG(DEBUG, APP, "ring port id %d\n", ring_port_id);
+ res = rte_eth_from_ring(ring);
+ if (res < 0) {
+ RTE_LOG(ERR, APP,
+ "Cannot create eth dev with rte_eth_from_ring()\n");
+ return -1;
+ }
+ RTE_LOG(INFO, APP, "Created ring PMD: %d\n", res);
- return ring_port_id;
+ return res;
}
/**
--
2.7.4
prev parent reply other threads:[~2018-10-09 10:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 10:52 [spp] [PATCH 0/5] Add error handling for add and del commands ogawa.yasufumi
2018-10-09 10:52 ` [spp] [PATCH 1/5] shared: add error handling for invalid res UID ogawa.yasufumi
2018-10-09 10:52 ` [spp] [PATCH 2/5] spp_nfv: add error handling for add and del cmd ogawa.yasufumi
2018-10-09 10:52 ` [spp] [PATCH 3/5] spp_vm: " ogawa.yasufumi
2018-10-09 10:52 ` [spp] [PATCH 4/5] spp_nfv: refactor add_ring_pmd ogawa.yasufumi
2018-10-09 10:52 ` ogawa.yasufumi [this message]
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=20181009105207.42636-6-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).