Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: ferruh.yigit@intel.com, spp@dpdk.org, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 3/3] spp_primary: add lcore_id_used variable
Date: Tue, 29 Jan 2019 21:20:28 +0900	[thread overview]
Message-ID: <1548764428-2758-4-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1548764428-2758-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

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

To enable to retrieve lcore IDs used by spp_primary, add
`lcore_id_used` variable. It is intended to be refered for inspecting
the rest of cores can be used.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/primary/init.c  | 16 +++++++++++++++-
 src/shared/common.h |  2 ++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/primary/init.c b/src/primary/init.c
index 8b1f396..85b54a3 100644
--- a/src/primary/init.c
+++ b/src/primary/init.c
@@ -9,8 +9,8 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 
+#include "shared/common.h"
 #include "args.h"
-#include "common.h"
 #include "init.h"
 #include "primary.h"
 
@@ -23,6 +23,8 @@ static struct rte_mempool *pktmbuf_pool;
 /* the port details */
 struct port_info *ports;
 
+uint8_t lcore_id_used[RTE_MAX_LCORE] = {};
+
 /**
  * Initialise the mbuf pool for packet reception for the NIC, and any other
  * buffer pools needed by the app - currently none.
@@ -104,8 +106,10 @@ int
 init(int argc, char *argv[])
 {
 	int retval;
+	int lcore_id;
 	const struct rte_memzone *mz;
 	uint16_t count, total_ports;
+	char log_msg[1024] = { '\0' };
 
 	/* init EAL, parsing EAL args */
 	retval = rte_eal_init(argc, argv);
@@ -159,6 +163,16 @@ init(int argc, char *argv[])
 	/* Initialise the ring_port. */
 	init_shm_rings();
 
+	RTE_LCORE_FOREACH(lcore_id) {
+		lcore_id_used[lcore_id] = 1;
+	}
+	sprintf(log_msg, "Used lcores: ");
+	for (int i = 0; i < RTE_MAX_LCORE; i++) {
+		if (lcore_id_used[i] == 1)
+			sprintf(log_msg + strlen(log_msg), "%d ", i);
+	}
+	RTE_LOG(DEBUG, PRIMARY, "%s\n", log_msg);
+
 	return 0;
 }
 
diff --git a/src/shared/common.h b/src/shared/common.h
index e244db9..d5c62bd 100644
--- a/src/shared/common.h
+++ b/src/shared/common.h
@@ -127,4 +127,6 @@ int set_user_log_debug(int num_user_log);
 int parse_num_clients(uint16_t *num_clients, const char *clients);
 int parse_server(char **server_ip, int *server_port, char *server_addr);
 
+extern uint8_t lcore_id_used[RTE_MAX_LCORE];
+
 #endif
-- 
2.7.4

      parent reply	other threads:[~2019-01-29 12:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 12:20 [spp] [PATCH 0/3] Refactor spp_priamry ogawa.yasufumi
2019-01-29 12:20 ` [spp] [PATCH 1/3] spp_primary: refactor var names for ring ports ogawa.yasufumi
2019-01-29 12:20 ` [spp] [PATCH 2/3] spp_primary: change include path in Makefile ogawa.yasufumi
2019-01-29 12:20 ` 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=1548764428-2758-4-git-send-email-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).