DPDK patches and discussions
 help / color / mirror / Atom feed
From: Simon Kuenzer <simon.kuenzer@neclab.eu>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] eal/linuxapp: Add parameter to specify master lcore id
Date: Tue, 8 Jul 2014 10:28:30 +0200
Message-ID: <1404808110-16314-1-git-send-email-simon.kuenzer@neclab.eu> (raw)

This commit enables users to specify the lcore id that
is used as master lcore.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
---
 lib/librte_eal/linuxapp/eal/eal.c |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 573fd06..4ad5b9b 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -101,6 +101,7 @@
 #define OPT_XEN_DOM0    "xen-dom0"
 #define OPT_CREATE_UIO_DEV "create-uio-dev"
 #define OPT_VFIO_INTR    "vfio-intr"
+#define OPT_MASTER_LCORE "master-lcore"
 
 #define RTE_EAL_BLACKLIST_SIZE	0x100
 
@@ -336,6 +337,7 @@ eal_usage(const char *prgname)
 	       "[--proc-type primary|secondary|auto] \n\n"
 	       "EAL options:\n"
 	       "  -c COREMASK  : A hexadecimal bitmask of cores to run on\n"
+	       "  --"OPT_MASTER_LCORE" ID: Core ID that is used as master\n"
 	       "  -n NUM       : Number of memory channels\n"
 		   "  -v           : Display version information on startup\n"
 	       "  -d LIB.so    : add driver (can be used multiple times)\n"
@@ -468,6 +470,21 @@ eal_parse_coremask(const char *coremask)
 	return 0;
 }
 
+/* Changes the lcore id of the master thread */
+static int
+eal_parse_master_lcore(const char *arg)
+{
+	struct rte_config *cfg = rte_eal_get_configuration();
+	int master_lcore = atoi(arg);
+
+	if (!(master_lcore >= 0 && master_lcore < RTE_MAX_LCORE))
+		return -1;
+	if (cfg->lcore_role[master_lcore] != ROLE_RTE)
+		return -1;
+	cfg->master_lcore = master_lcore;
+	return 0;
+}
+
 static int
 eal_parse_syslog(const char *facility)
 {
@@ -653,6 +670,7 @@ eal_parse_args(int argc, char **argv)
 		{OPT_HUGE_DIR, 1, 0, 0},
 		{OPT_NO_SHCONF, 0, 0, 0},
 		{OPT_PROC_TYPE, 1, 0, 0},
+		{OPT_MASTER_LCORE, 1, 0, 0},
 		{OPT_FILE_PREFIX, 1, 0, 0},
 		{OPT_SOCKET_MEM, 1, 0, 0},
 		{OPT_PCI_WHITELIST, 1, 0, 0},
@@ -802,6 +820,21 @@ eal_parse_args(int argc, char **argv)
 			else if (!strcmp(lgopts[option_index].name, OPT_PROC_TYPE)) {
 				internal_config.process_type = eal_parse_proc_type(optarg);
 			}
+			else if (!strcmp(lgopts[option_index].name, OPT_MASTER_LCORE)) {
+				if (!coremask_ok) {
+					RTE_LOG(ERR, EAL, "please specify the master "
+							"lcore id after specifying "
+							"the coremask\n");
+					eal_usage(prgname);
+					return -1;
+				}
+				if (eal_parse_master_lcore(optarg) < 0) {
+					RTE_LOG(ERR, EAL, "invalid parameter for --"
+							OPT_MASTER_LCORE "\n");
+					eal_usage(prgname);
+					return -1;
+				}
+			}
 			else if (!strcmp(lgopts[option_index].name, OPT_FILE_PREFIX)) {
 				internal_config.hugefile_prefix = optarg;
 			}
-- 
1.7.10.4

             reply	other threads:[~2014-07-08  9:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08  8:28 Simon Kuenzer [this message]
2014-07-08  9:42 ` Simon Kuenzer
2014-07-21 16:21   ` Simon Kuenzer
2014-07-22 23:40     ` Hiroshi Shimamoto
2014-07-23  7:50       ` Thomas Monjalon
2014-07-23  8:53         ` Hiroshi Shimamoto
2014-07-23  9:04           ` Thomas Monjalon
2014-07-23 12:05             ` Simon Kuenzer
2014-08-04  2:48             ` Hiroshi Shimamoto
2014-07-23 12:10           ` Simon Kuenzer
2014-11-03 17:02             ` Aaron Campbell
2014-11-03 22:29               ` Thomas Monjalon
2014-07-23  8:03       ` Gray, Mark D
2014-11-03 17:02 ` Aaron Campbell
2014-11-04 19:00   ` Thomas Monjalon
2014-11-05 15:34     ` Aaron Campbell
2014-11-04 21:40 ` [dpdk-dev] [PATCH v2] eal: add option --master-lcore Thomas Monjalon
2014-11-05 11:54   ` Ananyev, Konstantin
2014-11-05 16:52     ` Thomas Monjalon
2014-11-05 15:34   ` Aaron Campbell
2014-11-05 23:43   ` Simon Kuenzer

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=1404808110-16314-1-git-send-email-simon.kuenzer@neclab.eu \
    --to=simon.kuenzer@neclab.eu \
    --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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git