get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1459/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1459,
    "url": "https://patches.dpdk.org/api/patches/1459/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416692622-28886-11-git-send-email-thomas.monjalon@6wind.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1416692622-28886-11-git-send-email-thomas.monjalon@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1416692622-28886-11-git-send-email-thomas.monjalon@6wind.com",
    "date": "2014-11-22T21:43:42",
    "name": "[dpdk-dev,10/10] eal: add option --master-lcore",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "830b12fe13f8050e9dd30e7b42260c4f4808d41c",
    "submitter": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/people/1/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas.monjalon@6wind.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1416692622-28886-11-git-send-email-thomas.monjalon@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1459/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1459/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 030087FF6;\n\tSat, 22 Nov 2014 22:33:57 +0100 (CET)",
            "from mail-wg0-f52.google.com (mail-wg0-f52.google.com\n\t[74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 99A4F7FDD\n\tfor <dev@dpdk.org>; Sat, 22 Nov 2014 22:33:52 +0100 (CET)",
            "by mail-wg0-f52.google.com with SMTP id a1so9281679wgh.39\n\tfor <dev@dpdk.org>; Sat, 22 Nov 2014 13:44:33 -0800 (PST)",
            "from localhost.localdomain (136-92-190-109.dsl.ovh.fr.\n\t[109.190.92.136]) by mx.google.com with ESMTPSA id\n\tcz3sm13724087wjb.23.2014.11.22.13.44.31 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 22 Nov 2014 13:44:32 -0800 (PST)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=Oaggiq3QbVreSLlMCz4j2qmH2xb3EvZlVAxnTSXp3hE=;\n\tb=QkVoUVlQ2HIy19fPsZuI/OP3JZTSMNUr6rxANs4Ih8iIaTRABurySnhwuExH74AUhV\n\tphM14NoRjpOtTaychioOh9CT/9nWdQAmj0HG+/dEWb6pISFHPiTGV+Cqm814gpL/TtM2\n\t9jsX05SKNwe03vHChE98+cz7nLQe2m8mZ6vZoCVajwI3deWYe/6fu7H4NEp7uTR89XQB\n\t1hEIrRROjnZ0+Tjjw6pUMmzIhiFHZV9ufNfWWqe3PgoAzJy5K0PqSxbQcmMUWprKqqKm\n\tb8s9wR/XPHQsgf1M2knOdHa96kQtFMDEw207JOHBdqXu3oA3bCjY+fdDkev2JFH1wPqb\n\tMhfA==",
        "X-Gm-Message-State": "ALoCoQl/ZhR7r63LJbWo/QEnHGeUI0EitIUusr1zD8jFnxGKeQZNifgCp2yxtO9fnCwc6jLIIg2h",
        "X-Received": "by 10.180.99.1 with SMTP id em1mr8544988wib.29.1416692673155;\n\tSat, 22 Nov 2014 13:44:33 -0800 (PST)",
        "From": "Thomas Monjalon <thomas.monjalon@6wind.com>",
        "To": "dev@dpdk.org",
        "Date": "Sat, 22 Nov 2014 22:43:42 +0100",
        "Message-Id": "<1416692622-28886-11-git-send-email-thomas.monjalon@6wind.com>",
        "X-Mailer": "git-send-email 2.1.3",
        "In-Reply-To": "<1416692622-28886-1-git-send-email-thomas.monjalon@6wind.com>",
        "References": "<1416692622-28886-1-git-send-email-thomas.monjalon@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH 10/10] eal: add option --master-lcore",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Simon Kuenzer <simon.kuenzer@neclab.eu>\n\nEnable users to specify the lcore id that is used as master lcore.\n\nSigned-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>\nSigned-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>\n---\n app/test/test.c                            |  1 +\n app/test/test_eal_flags.c                  | 51 ++++++++++++++++++++++++++++++\n lib/librte_eal/common/eal_common_options.c | 39 ++++++++++++++++++++---\n lib/librte_eal/common/eal_options.h        |  2 ++\n 4 files changed, 89 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/app/test/test.c b/app/test/test.c\nindex 9bee6bb..2fecff5 100644\n--- a/app/test/test.c\n+++ b/app/test/test.c\n@@ -82,6 +82,7 @@ do_recursive_call(void)\n \t} actions[] =  {\n \t\t\t{ \"run_secondary_instances\", test_mp_secondary },\n \t\t\t{ \"test_missing_c_flag\", no_action },\n+\t\t\t{ \"test_master_lcore_flag\", no_action },\n \t\t\t{ \"test_missing_n_flag\", no_action },\n \t\t\t{ \"test_no_hpet_flag\", no_action },\n \t\t\t{ \"test_whitelist_flag\", no_action },\ndiff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c\nindex 5ad89c5..6a6ef08 100644\n--- a/app/test/test_eal_flags.c\n+++ b/app/test/test_eal_flags.c\n@@ -549,6 +549,51 @@ test_missing_c_flag(void)\n }\n \n /*\n+ * Test --master-lcore option with matching coremask\n+ */\n+static int\n+test_master_lcore_flag(void)\n+{\n+#ifdef RTE_EXEC_ENV_BSDAPP\n+\t/* BSD target doesn't support prefixes at this point */\n+\tconst char *prefix = \"\";\n+#else\n+\tchar prefix[PATH_MAX], tmp[PATH_MAX];\n+\tif (get_current_prefix(tmp, sizeof(tmp)) == NULL) {\n+\t\tprintf(\"Error - unable to get current prefix!\\n\");\n+\t\treturn -1;\n+\t}\n+\tsnprintf(prefix, sizeof(prefix), \"--file-prefix=%s\", tmp);\n+#endif\n+\n+\t/* --master-lcore flag but no value */\n+\tconst char *argv1[] = { prgname, prefix, mp_flag, \"-n\", \"1\", \"-c\", \"3\", \"--master-lcore\"};\n+\t/* --master-lcore flag with invalid value */\n+\tconst char *argv2[] = { prgname, prefix, mp_flag, \"-n\", \"1\", \"-c\", \"3\", \"--master-lcore\", \"-1\"};\n+\tconst char *argv3[] = { prgname, prefix, mp_flag, \"-n\", \"1\", \"-c\", \"3\", \"--master-lcore\", \"X\"};\n+\t/* master lcore not in coremask */\n+\tconst char *argv4[] = { prgname, prefix, mp_flag, \"-n\", \"1\", \"-c\", \"3\", \"--master-lcore\", \"2\"};\n+\t/* valid value */\n+\tconst char *argv5[] = { prgname, prefix, mp_flag, \"-n\", \"1\", \"-c\", \"3\", \"--master-lcore\", \"1\"};\n+\t/* valid value set before coremask */\n+\tconst char *argv6[] = { prgname, prefix, mp_flag, \"-n\", \"1\", \"--master-lcore\", \"1\", \"-c\", \"3\"};\n+\n+\tif (launch_proc(argv1) == 0\n+\t\t\t|| launch_proc(argv2) == 0\n+\t\t\t|| launch_proc(argv3) == 0\n+\t\t\t|| launch_proc(argv4) == 0) {\n+\t\tprintf(\"Error - process ran without error with wrong --master-lcore\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (launch_proc(argv5) != 0\n+\t\t\t|| launch_proc(argv6) != 0) {\n+\t\tprintf(\"Error - process did not run ok with valid --master-lcore\\n\");\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n+/*\n  * Test that the app doesn't run without the -n flag. In all cases\n  * should give an error and fail to run.\n  * Since -n is not compulsory for MP, we instead use --no-huge and --no-shconf\n@@ -1237,6 +1282,12 @@ test_eal_flags(void)\n \t\treturn ret;\n \t}\n \n+\tret = test_master_lcore_flag();\n+\tif (ret < 0) {\n+\t\tprintf(\"Error in test_master_lcore_flag()\\n\");\n+\t\treturn ret;\n+\t}\n+\n \tret = test_missing_n_flag();\n \tif (ret < 0) {\n \t\tprintf(\"Error in test_missing_n_flag()\\n\");\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex c9df8f5..54bd31d 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -67,6 +67,7 @@ eal_short_options[] =\n const struct option\n eal_long_options[] = {\n \t{OPT_HUGE_DIR, 1, 0, OPT_HUGE_DIR_NUM},\n+\t{OPT_MASTER_LCORE, 1, 0, OPT_MASTER_LCORE_NUM},\n \t{OPT_PROC_TYPE, 1, 0, OPT_PROC_TYPE_NUM},\n \t{OPT_NO_SHCONF, 0, 0, OPT_NO_SHCONF_NUM},\n \t{OPT_NO_HPET, 0, 0, OPT_NO_HPET_NUM},\n@@ -186,8 +187,6 @@ eal_parse_coremask(const char *coremask)\n \t\t\t\t}\n \t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n \t\t\t\tlcore_config[idx].core_index = count;\n-\t\t\t\tif (count == 0)\n-\t\t\t\t\tcfg->master_lcore = idx;\n \t\t\t\tcount++;\n \t\t\t} else {\n \t\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n@@ -257,8 +256,6 @@ eal_parse_corelist(const char *corelist)\n \t\t\tfor (idx = min; idx <= max; idx++) {\n \t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n \t\t\t\tlcore_config[idx].core_index = count;\n-\t\t\t\tif (count == 0)\n-\t\t\t\t\tcfg->master_lcore = idx;\n \t\t\t\tcount++;\n \t\t\t}\n \t\t\tmin = RTE_MAX_LCORE;\n@@ -274,6 +271,22 @@ eal_parse_corelist(const char *corelist)\n \treturn 0;\n }\n \n+/* Changes the lcore id of the master thread */\n+static int\n+eal_parse_master_lcore(const char *arg)\n+{\n+\tchar *parsing_end;\n+\tstruct rte_config *cfg = rte_eal_get_configuration();\n+\n+\terrno = 0;\n+\tcfg->master_lcore = (uint32_t) strtol(arg, &parsing_end, 0);\n+\tif (errno || parsing_end[0] != 0)\n+\t\treturn -1;\n+\tif (cfg->master_lcore >= RTE_MAX_LCORE)\n+\t\treturn -1;\n+\treturn 0;\n+}\n+\n static int\n eal_parse_syslog(const char *facility, struct internal_config *conf)\n {\n@@ -439,6 +452,14 @@ eal_parse_common_option(int opt, const char *optarg,\n \t\tconf->process_type = eal_parse_proc_type(optarg);\n \t\tbreak;\n \n+\tcase OPT_MASTER_LCORE_NUM:\n+\t\tif (eal_parse_master_lcore(optarg) < 0) {\n+\t\t\tRTE_LOG(ERR, EAL, \"invalid parameter for --\"\n+\t\t\t\t\tOPT_MASTER_LCORE \"\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n+\n \tcase OPT_VDEV_NUM:\n \t\tif (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL,\n \t\t\t\toptarg) < 0) {\n@@ -480,10 +501,15 @@ int\n eal_adjust_config(struct internal_config *internal_cfg)\n {\n \tint i;\n+\tstruct rte_config *cfg = rte_eal_get_configuration();\n \n \tif (internal_config.process_type == RTE_PROC_AUTO)\n \t\tinternal_config.process_type = eal_proc_type_detect();\n \n+\t/* default master lcore is the first one */\n+\tif (cfg->master_lcore == 0)\n+\t\tcfg->master_lcore = rte_get_next_lcore(-1, 0, 0);\n+\n \t/* if no memory amounts were requested, this will result in 0 and\n \t * will be overridden later, right after eal_hugepage_info_init() */\n \tfor (i = 0; i < RTE_MAX_NUMA_NODES; i++)\n@@ -502,6 +528,10 @@ eal_check_common_options(struct internal_config *internal_cfg)\n \t\t\t\"-c or -l\\n\");\n \t\treturn -1;\n \t}\n+\tif (cfg->lcore_role[cfg->master_lcore] != ROLE_RTE) {\n+\t\tRTE_LOG(ERR, EAL, \"Master lcore is not enabled for DPDK\\n\");\n+\t\treturn -1;\n+\t}\n \n \tif (internal_cfg->process_type == RTE_PROC_INVALID) {\n \t\tRTE_LOG(ERR, EAL, \"Invalid process type specified\\n\");\n@@ -550,6 +580,7 @@ eal_common_usage(void)\n \t       \"  -l CORELIST  : List of cores to run on\\n\"\n \t       \"                 The argument format is <c1>[-c2][,c3[-c4],...]\\n\"\n \t       \"                 where c1, c2, etc are core indexes between 0 and %d\\n\"\n+\t       \"  --\"OPT_MASTER_LCORE\" ID: Core ID that is used as master\\n\"\n \t       \"  -n NUM       : Number of memory channels\\n\"\n \t       \"  -v           : Display version information on startup\\n\"\n \t       \"  -m MB        : memory to allocate (see also --\"OPT_SOCKET_MEM\")\\n\"\ndiff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h\nindex f58965c..e476f8d 100644\n--- a/lib/librte_eal/common/eal_options.h\n+++ b/lib/librte_eal/common/eal_options.h\n@@ -45,6 +45,8 @@ enum {\n \tOPT_LONG_MIN_NUM = 256,\n #define OPT_HUGE_DIR    \"huge-dir\"\n \tOPT_HUGE_DIR_NUM = OPT_LONG_MIN_NUM,\n+#define OPT_MASTER_LCORE \"master-lcore\"\n+\tOPT_MASTER_LCORE_NUM,\n #define OPT_PROC_TYPE   \"proc-type\"\n \tOPT_PROC_TYPE_NUM,\n #define OPT_NO_SHCONF   \"no-shconf\"\n",
    "prefixes": [
        "dpdk-dev",
        "10/10"
    ]
}