get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1455,
    "url": "https://patches.dpdk.org/api/patches/1455/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1416692622-28886-6-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-6-git-send-email-thomas.monjalon@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1416692622-28886-6-git-send-email-thomas.monjalon@6wind.com",
    "date": "2014-11-22T21:43:37",
    "name": "[dpdk-dev,05/10] eal: factorize options sanity check",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "1cbde202d93e129d90a66c33cce0eac97c91f961",
    "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-6-git-send-email-thomas.monjalon@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1455/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1455/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 641027FC4;\n\tSat, 22 Nov 2014 22:33:48 +0100 (CET)",
            "from mail-wi0-f176.google.com (mail-wi0-f176.google.com\n\t[209.85.212.176]) by dpdk.org (Postfix) with ESMTP id AAA405910\n\tfor <dev@dpdk.org>; Sat, 22 Nov 2014 22:33:43 +0100 (CET)",
            "by mail-wi0-f176.google.com with SMTP id ex7so2350237wid.15\n\tfor <dev@dpdk.org>; Sat, 22 Nov 2014 13:44:24 -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.22 for <dev@dpdk.org>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 22 Nov 2014 13:44:23 -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:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=uQ18n7gtDct+Y0J5wqvYdtrkN3mkXP/jB/VmLDQ79bw=;\n\tb=CwOc/xnz6AxyM5OO4YFYyf4Kf/RDO0Masauf0u5tUvw9wcSxU2VBWE4q/v8n9jY2lv\n\tR3HmCGc6ucKKpOZiP4DK6mah9ZNTEkgPI4ilNVUrZFVVHO46asKrJoP3WzJV8RCmy3Y+\n\tJbENDmZC1/UyD2QzA2AWPCemp2rUmrm2SmDuvEYwIB4FhwQKSrf7xSmIYwocwm4eGkkx\n\tceJ2MrW4UuGelqcHVl0CV3VBD/ne3Ie2rbE6vSG6COlTVfuzKXkfrTl4Jq9q8231HG3N\n\tN1TFMQpFnrSubDybthyZbbb/+BfVzxdZBy8g4P3YJbZPWvdbZC1BuB4L272AXDrL4paj\n\tK+qw==",
        "X-Gm-Message-State": "ALoCoQmsHvy4QGlDiNevmm+4W601X/25cHtBlQqsslRTmtNZ5JTM/faY5TqwYifaOYEBRbIRBkAX",
        "X-Received": "by 10.180.101.104 with SMTP id ff8mr2098906wib.12.1416692664254; \n\tSat, 22 Nov 2014 13:44:24 -0800 (PST)",
        "From": "Thomas Monjalon <thomas.monjalon@6wind.com>",
        "To": "dev@dpdk.org",
        "Date": "Sat, 22 Nov 2014 22:43:37 +0100",
        "Message-Id": "<1416692622-28886-6-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 05/10] eal: factorize options sanity check",
        "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": "No need to have duplicated check for common options.\n\nSome flags are set for options -c and -m in order to simplify the\nchecks.\n\nSigned-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>\n---\n lib/librte_eal/bsdapp/eal/eal.c            | 54 ++------------------------\n lib/librte_eal/common/eal_common_options.c | 53 ++++++++++++++++++++++++++\n lib/librte_eal/common/eal_options.h        |  1 +\n lib/librte_eal/linuxapp/eal/eal.c          | 61 ++++--------------------------\n 4 files changed, 66 insertions(+), 103 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 391ce53..20a9c5f 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -316,7 +316,6 @@ eal_parse_args(int argc, char **argv)\n \tint opt, ret, i;\n \tchar **argvopt;\n \tint option_index;\n-\tint coremask_ok = 0;\n \tchar *prgname = argv[0];\n \n \targvopt = argv;\n@@ -339,13 +338,8 @@ eal_parse_args(int argc, char **argv)\n \t\t\treturn -1;\n \t\t}\n \t\t/* common parser handled this option */\n-\t\tif (ret == 0) {\n-\t\t\t/* special case, note that the common parser accepted\n-\t\t\t * the coremask option */\n-\t\t\tif (opt == 'c')\n-\t\t\t\tcoremask_ok = 1;\n+\t\tif (ret == 0)\n \t\t\tcontinue;\n-\t\t}\n \n \t\tswitch (opt) {\n \t\tdefault:\n@@ -366,51 +360,11 @@ eal_parse_args(int argc, char **argv)\n \t\t}\n \t}\n \n-\t/* sanity checks */\n-\tif (!coremask_ok) {\n-\t\tRTE_LOG(ERR, EAL, \"coremask not specified\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (internal_config.process_type == RTE_PROC_AUTO){\n+\tif (internal_config.process_type == RTE_PROC_AUTO)\n \t\tinternal_config.process_type = eal_proc_type_detect();\n-\t}\n-\tif (internal_config.process_type == RTE_PROC_INVALID){\n-\t\tRTE_LOG(ERR, EAL, \"Invalid process type specified\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (internal_config.process_type == RTE_PROC_PRIMARY &&\n-\t\t\tinternal_config.force_nchannel == 0) {\n-\t\tRTE_LOG(ERR, EAL, \"Number of memory channels (-n) not specified\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (index(internal_config.hugefile_prefix,'%') != NULL){\n-\t\tRTE_LOG(ERR, EAL, \"Invalid char, '%%', in '\"OPT_FILE_PREFIX\"' option\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (internal_config.memory > 0 && internal_config.force_sockets == 1) {\n-\t\tRTE_LOG(ERR, EAL, \"Options -m and --socket-mem cannot be specified \"\n-\t\t\t\t\"at the same time\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\t/* --no-huge doesn't make sense with either -m or --socket-mem */\n-\tif (internal_config.no_hugetlbfs &&\n-\t\t\t(internal_config.memory > 0 ||\n-\t\t\t\t\tinternal_config.force_sockets == 1)) {\n-\t\tRTE_LOG(ERR, EAL, \"Options -m or --socket-mem cannot be specified \"\n-\t\t\t\t\"together with --no-huge!\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n \n-\tif (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 0 &&\n-\t\trte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 0) {\n-\t\tRTE_LOG(ERR, EAL, \"Error: blacklist [-b] and whitelist \"\n-\t\t\t\"[-w] options cannot be used at the same time\\n\");\n+\t/* sanity checks */\n+\tif (eal_check_common_options(&internal_config) != 0) {\n \t\teal_usage(prgname);\n \t\treturn -1;\n \t}\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex ffc615a..630dfe0 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -85,6 +85,9 @@ eal_long_options[] = {\n \t{0, 0, 0, 0}\n };\n \n+static int lcores_parsed;\n+static int mem_parsed;\n+\n void\n eal_reset_internal_config(struct internal_config *internal_cfg)\n {\n@@ -197,6 +200,7 @@ eal_parse_coremask(const char *coremask)\n \t\treturn -1;\n \t/* Update the count of enabled logical cores of the EAL configuration */\n \tcfg->lcore_count = count;\n+\tlcores_parsed = 1;\n \treturn 0;\n }\n \n@@ -305,6 +309,7 @@ eal_parse_common_option(int opt, const char *optarg,\n \t\tconf->memory = atoi(optarg);\n \t\tconf->memory *= 1024ULL;\n \t\tconf->memory *= 1024ULL;\n+\t\tmem_parsed = 1;\n \t\tbreak;\n \t/* force number of channels */\n \tcase 'n':\n@@ -394,6 +399,54 @@ eal_parse_common_option(int opt, const char *optarg,\n \treturn 0;\n }\n \n+int\n+eal_check_common_options(struct internal_config *internal_cfg)\n+{\n+\tstruct rte_config *cfg = rte_eal_get_configuration();\n+\n+\tif (!lcores_parsed) {\n+\t\tRTE_LOG(ERR, EAL, \"CPU cores must be enabled with option \"\n+\t\t\t\"-c\\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+\t\treturn -1;\n+\t}\n+\tif (internal_cfg->process_type == RTE_PROC_PRIMARY &&\n+\t\t\tinternal_cfg->force_nchannel == 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Number of memory channels (-n) not \"\n+\t\t\t\"specified\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (index(internal_cfg->hugefile_prefix, '%') != NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Invalid char, '%%', in --\"OPT_FILE_PREFIX\" \"\n+\t\t\t\"option\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (mem_parsed && internal_cfg->force_sockets == 1) {\n+\t\tRTE_LOG(ERR, EAL, \"Options -m and --\"OPT_SOCKET_MEM\" cannot \"\n+\t\t\t\"be specified at the same time\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (internal_cfg->no_hugetlbfs &&\n+\t\t\t(mem_parsed || internal_cfg->force_sockets == 1)) {\n+\t\tRTE_LOG(ERR, EAL, \"Options -m or --\"OPT_SOCKET_MEM\" cannot \"\n+\t\t\t\"be specified together with --\"OPT_NO_HUGE\"\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 0 &&\n+\t\trte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Options blacklist (-b) and whitelist (-w) \"\n+\t\t\t\"cannot be used at the same time\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n void\n eal_common_usage(void)\n {\ndiff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h\nindex 7a08507..75351c0 100644\n--- a/lib/librte_eal/common/eal_options.h\n+++ b/lib/librte_eal/common/eal_options.h\n@@ -83,6 +83,7 @@ extern const struct option eal_long_options[];\n \n int eal_parse_common_option(int opt, const char *argv,\n \t\t\t    struct internal_config *conf);\n+int eal_check_common_options(struct internal_config *internal_cfg);\n void eal_common_usage(void);\n \n #endif /* EAL_OPTIONS_H */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex bb35669..f5de277 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -507,7 +507,6 @@ eal_parse_args(int argc, char **argv)\n \tint opt, ret, i;\n \tchar **argvopt;\n \tint option_index;\n-\tint coremask_ok = 0;\n \tchar *prgname = argv[0];\n \tstruct shared_driver *solib;\n \n@@ -531,13 +530,8 @@ eal_parse_args(int argc, char **argv)\n \t\t\treturn -1;\n \t\t}\n \t\t/* common parser handled this option */\n-\t\tif (ret == 0) {\n-\t\t\t/* special case, note that the common parser accepted\n-\t\t\t * the coremask option */\n-\t\t\tif (opt == 'c')\n-\t\t\t\tcoremask_ok = 1;\n+\t\tif (ret == 0)\n \t\t\tcontinue;\n-\t\t}\n \n \t\tswitch (opt) {\n \t\t/* force loading of external driver */\n@@ -622,58 +616,19 @@ eal_parse_args(int argc, char **argv)\n \t\t}\n \t}\n \n-\t/* sanity checks */\n-\tif (!coremask_ok) {\n-\t\tRTE_LOG(ERR, EAL, \"coremask not specified\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (internal_config.process_type == RTE_PROC_AUTO){\n+\tif (internal_config.process_type == RTE_PROC_AUTO)\n \t\tinternal_config.process_type = eal_proc_type_detect();\n-\t}\n-\tif (internal_config.process_type == RTE_PROC_INVALID){\n-\t\tRTE_LOG(ERR, EAL, \"Invalid process type specified\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (internal_config.process_type == RTE_PROC_PRIMARY &&\n-\t\t\tinternal_config.force_nchannel == 0) {\n-\t\tRTE_LOG(ERR, EAL, \"Number of memory channels (-n) not specified\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (index(internal_config.hugefile_prefix,'%') != NULL){\n-\t\tRTE_LOG(ERR, EAL, \"Invalid char, '%%', in '\"OPT_FILE_PREFIX\"' option\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\tif (internal_config.memory > 0 && internal_config.force_sockets == 1) {\n-\t\tRTE_LOG(ERR, EAL, \"Options -m and --socket-mem cannot be specified \"\n-\t\t\t\t\"at the same time\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\t/* --no-huge doesn't make sense with either -m or --socket-mem */\n-\tif (internal_config.no_hugetlbfs &&\n-\t\t\t(internal_config.memory > 0 ||\n-\t\t\t\t\tinternal_config.force_sockets == 1)) {\n-\t\tRTE_LOG(ERR, EAL, \"Options -m or --socket-mem cannot be specified \"\n-\t\t\t\t\"together with --no-huge!\\n\");\n+\n+\t/* sanity checks */\n+\tif (eal_check_common_options(&internal_config) != 0) {\n \t\teal_usage(prgname);\n \t\treturn -1;\n \t}\n+\n \t/* --xen-dom0 doesn't make sense with --socket-mem */\n \tif (internal_config.xen_dom0_support && internal_config.force_sockets == 1) {\n-\t\tRTE_LOG(ERR, EAL, \"Options --socket-mem cannot be specified \"\n-\t\t\t\t\t\"together with --xen_dom0!\\n\");\n-\t\teal_usage(prgname);\n-\t\treturn -1;\n-\t}\n-\n-\tif (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 0 &&\n-\t\trte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 0) {\n-\t\tRTE_LOG(ERR, EAL, \"Error: blacklist [-b] and whitelist \"\n-\t\t\t\"[-w] options cannot be used at the same time\\n\");\n+\t\tRTE_LOG(ERR, EAL, \"Options --\"OPT_SOCKET_MEM\" cannot be specified \"\n+\t\t\t\"together with --\"OPT_XEN_DOM0\"\\n\");\n \t\teal_usage(prgname);\n \t\treturn -1;\n \t}\n",
    "prefixes": [
        "dpdk-dev",
        "05/10"
    ]
}