Show a patch.

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

{
    "id": 2,
    "url": "https://patches.dpdk.org/api/patches/2/",
    "web_url": "https://patches.dpdk.org/patch/2/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<1398867282-15076-1-git-send-email-david.marchand@6wind.com>",
    "date": "2014-04-30T14:14:42",
    "name": "[dpdk-dev,RFC] eal: change core mask input format",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "66fc186fe546a2e69bd4db426ebf9384dd3b53ff",
    "submitter": {
        "id": 3,
        "url": "https://patches.dpdk.org/api/people/3/",
        "name": "David Marchand",
        "email": "david.marchand@6wind.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/2/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2/checks/",
    "tags": {},
    "headers": {
        "Received": [
            "from mail-we0-f182.google.com (mail-we0-f182.google.com\n\t[74.125.82.182]) by dpdk.org (Postfix) with ESMTP id C6553AFD5\n\tfor <dev@dpdk.org>; Wed, 30 Apr 2014 16:14:46 +0200 (CEST)",
            "by mail-we0-f182.google.com with SMTP id u57so1715080wes.41\n\tfor <dev@dpdk.org>; Wed, 30 Apr 2014 07:14:50 -0700 (PDT)",
            "from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237])\n\tby mx.google.com with ESMTPSA id\n\tgp15sm36382431wjc.10.2014.04.30.07.14.49 for <multiple recipients>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 30 Apr 2014 07:14:49 -0700 (PDT)"
        ],
        "From": "David Marchand <david.marchand@6wind.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Message-Id": "<1398867282-15076-1-git-send-email-david.marchand@6wind.com>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "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;\n\tbh=GEuJkBZDHu/ygypC7wdp412xNPcxpTLgGt9mmhmPnzI=;\n\tb=GMDcF8BYT8EOY0iB/Gnk5s1QMxIMFZclBMXlyxupgAjE/lIorB9lc/twfZDAxex1iq\n\ty9wxwVg8IFrdktmA34qxGpCfww/0LuoaTBcEZCgR2FyTkfJO/s7Op6hUmGSeXWPFMk+j\n\twgV1Un/ig5AaCVs7iMnvjRFZLWdMUfHRID5Q47pJ8V9A4/mKaFyTgvnKDozyCOXurCyz\n\tVhwU87edyXtFQeMSr957MIQ/LHvWe2KssDOnsZ6CnAL4WRSsGdlij9H5sXruGOBvAR1a\n\t0xAcuogFv+UunRYcbSiZ7sQeobrHJi68uWQTP7PFQe5ahlV3mAPsCyrKMAWuLRJrFHaj\n\tSWwQ==",
        "Subject": "[dpdk-dev] [PATCH RFC] eal: change core mask input format",
        "Date": "Wed, 30 Apr 2014 16:14:42 +0200",
        "Precedence": "list",
        "X-List-Received-Date": "Wed, 30 Apr 2014 14:14:47 -0000",
        "X-BeenThere": "dev@dpdk.org",
        "X-Received": "by 10.180.7.133 with SMTP id j5mr3860344wia.55.1398867290715;\n\tWed, 30 Apr 2014 07:14:50 -0700 (PDT)",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<david.marchand@6wind.com>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "X-Gm-Message-State": "ALoCoQlKlwHMYvu5kutPupN5mIdzXKzCUR2gwSddCzmCa4qS3N1nBVjk2FeG49pPESrlImDays1t",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "To": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "From: Didier Pallard <didier.pallard@6wind.com>\n\nIn current version, coremask can only be specified using a bitmask.\nIt will now be possible to specify core masks in 2 different ways:\n- Using a bitmask (-c 0xnnn): bitmask must be in hex format and start with 0x\n- Using a core set description in following format: -c [c1[-c2]][,c3[-c4]]...\n\n-c 0-7,16-23,31 being equivalent to -c 0x80FF00FF\n\nSigned-off-by: Didier Pallard <didier.pallard@6wind.com>\n---\n lib/librte_eal/bsdapp/eal/eal.c   |  103 ++++++++++++++++++++++++----------\n lib/librte_eal/linuxapp/eal/eal.c |  111 ++++++++++++++++++++++++++-----------\n 2 files changed, 152 insertions(+), 62 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex f8a6fc1..5c181b3 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -302,10 +302,13 @@ rte_config_init(void)\n static void\n eal_usage(const char *prgname)\n {\n-\tprintf(\"\\nUsage: %s -c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]\"\n+\tprintf(\"\\nUsage: %s -c CORESET -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]\"\n \t       \"[--proc-type primary|secondary|auto] \\n\\n\"\n \t       \"EAL options:\\n\"\n-\t       \"  -c COREMASK  : A hexadecimal bitmask of cores to run on\\n\"\n+\t       \"  -c CORESET   : Set of cores to run on, supports two different formats:\\n\"\n+\t       \"                 - A hexadecimal bitmask of cores starting with 0x\\n\"\n+\t       \"                 - A list of cores in following format c1[-c2][,c3[-c4]]...\\n\"\n+\t       \"                   where c1,c2,c3,... are core indexes between 0 and %d\\n\"\n \t       \"  -n NUM       : Number of memory channels\\n\"\n \t\t   \"  -v           : Display version information on startup\\n\"\n \t       \"                 (multiple -b options are allowed)\\n\"\n@@ -330,7 +333,7 @@ eal_usage(const char *prgname)\n \t       \"  --\"OPT_NO_PCI\"   : disable pci\\n\"\n \t       \"  --\"OPT_NO_SHCONF\": no shared config (mmap'd files)\\n\"\n \t       \"\\n\",\n-\t       prgname);\n+\t       prgname, RTE_MAX_LCORE-1);\n \t/* Allow the application to print its usage message too if hook is set */\n \tif ( rte_application_usage_hook ) {\n \t\tprintf(\"===== Application Usage =====\\n\\n\");\n@@ -384,37 +387,79 @@ eal_parse_coremask(const char *coremask)\n \twhile (isblank(*coremask))\n \t\tcoremask++;\n \tif (coremask[0] == '0' && ((coremask[1] == 'x')\n-\t\t||  (coremask[1] == 'X')) )\n+\t\t||  (coremask[1] == 'X')) ) {\n \t\tcoremask += 2;\n-\ti = strnlen(coremask, sysconf(_SC_ARG_MAX));\n-\twhile ((i > 0) && isblank(coremask[i - 1]))\n-\t\ti--;\n-\tif (i == 0)\n-\t\treturn -1;\n+\t\ti = strnlen(coremask, sysconf(_SC_ARG_MAX));\n+\t\twhile ((i > 0) && isblank(coremask[i - 1]))\n+\t\t\ti--;\n+\t\tif (i == 0)\n+\t\t\treturn -1;\n \n-\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n-\t\tc = coremask[i];\n-\t\tif (isxdigit(c) == 0) {\n-\t\t\t/* invalid characters */\n-\t\t\treturn (-1);\n-\t\t}\n-\t\tval = xdigit2val(c);\n-\t\tfor(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {\n-\t\t\tif((1 << j) & val) {\n-\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\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+\t\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n+\t\t\tc = coremask[i];\n+\t\t\tif (isxdigit(c) == 0) {\n+\t\t\t\t/* invalid characters */\n+\t\t\t\treturn (-1);\n+\t\t\t}\n+\t\t\tval = xdigit2val(c);\n+\t\t\tfor(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {\n+\t\t\t\tif((1 << j) & val) {\n+\t\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n+\t\t\t\t\tif(count == 0)\n+\t\t\t\t\t\tcfg->master_lcore = idx;\n+\t\t\t\t\tcount++;\n+\t\t\t\t} else  {\n+\t\t\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\t\t\t\t}\n \t\t\t}\n \t\t}\n-\t}\n-\tfor(; i >= 0; i--)\n-\t\tif(coremask[i] != '0')\n+\n+\t\tfor(; i >= 0; i--)\n+\t\t\tif(coremask[i] != '0')\n+\t\t\t\treturn -1;\n+\t\tfor(; idx < RTE_MAX_LCORE; idx++)\n+\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\t} else {\n+\t\tchar *end = NULL;\n+\t\tint min, max;\n+\n+\t\t/* Reset core roles */\n+\t\tfor(idx = 0; idx < RTE_MAX_LCORE; idx++)\n+\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\n+\t\t/* else this is a list of cores */\n+\t\tmin = RTE_MAX_LCORE;\n+\t\tdo {\n+\t\t\twhile (isblank(*coremask))\n+\t\t\t\tcoremask++;\n+\t\t\tidx = strtoul(coremask, &end, 10);\n+\t\t\tif (end != NULL) {\n+\t\t\t\twhile (isblank(*end))\n+\t\t\t\t\tend++;\n+\t\t\t\tif (*end == '-') {\n+\t\t\t\t\tmin = idx;\n+\t\t\t\t\tcoremask = end + 1;\n+\t\t\t\t} else if ((*end == ',') || (*end == '\\0')) {\n+\t\t\t\t\tmax = idx;\n+\t\t\t\t\tif (min == RTE_MAX_LCORE)\n+\t\t\t\t\t\tmin = idx;\n+\t\t\t\t\tfor (idx=min; idx<=max; idx++) {\n+\t\t\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n+\t\t\t\t\t\tif(count == 0)\n+\t\t\t\t\t\t\tcfg->master_lcore = idx;\n+\t\t\t\t\t\tcount++;\n+\t\t\t\t\t}\n+\t\t\t\t\tmin = RTE_MAX_LCORE;\n+\t\t\t\t\tif (*end != '\\0')\n+\t\t\t\t\t\tcoremask = end + 1;\n+\t\t\t\t} else {\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t} while ((*coremask != '\\0') && (end != NULL) && (*end != '\\0'));\n+\t\tif ((*coremask == '\\0') || (end == NULL) || (*end != '\\0'))\n \t\t\treturn -1;\n-\tfor(; idx < RTE_MAX_LCORE; idx++)\n-\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\t}\n \tif(count == 0)\n \t\treturn -1;\n \treturn 0;\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex d7a59de..de082ab 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -330,10 +330,13 @@ eal_hugedirs_unlock(void)\n static void\n eal_usage(const char *prgname)\n {\n-\tprintf(\"\\nUsage: %s -c COREMASK -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]\"\n+\tprintf(\"\\nUsage: %s -c CORESET -n NUM [-m NB] [-r NUM] [-b <domain:bus:devid.func>]\"\n \t       \"[--proc-type primary|secondary|auto] \\n\\n\"\n \t       \"EAL options:\\n\"\n-\t       \"  -c COREMASK  : A hexadecimal bitmask of cores to run on\\n\"\n+\t       \"  -c CORESET   : Set of cores to run on, supports two different formats:\\n\"\n+\t       \"                 - A hexadecimal bitmask of cores starting with 0x\\n\"\n+\t       \"                 - A list of cores in following format c1[-c2][,c3[-c4]]...\\n\"\n+\t       \"                   where c1,c2,c3,... are core indexes between 0 and %d\\n\"\n \t       \"  -n NUM       : Number of memory channels\\n\"\n \t\t   \"  -v           : Display version information on startup\\n\"\n \t       \"  -d LIB.so    : add driver (can be used multiple times)\\n\"\n@@ -368,7 +371,7 @@ eal_usage(const char *prgname)\n \t       \"  --\"OPT_NO_HPET\"  : disable hpet\\n\"\n \t       \"  --\"OPT_NO_SHCONF\": no shared config (mmap'd files)\\n\"\n \t       \"\\n\",\n-\t       prgname);\n+\t       prgname, RTE_MAX_LCORE-1);\n \t/* Allow the application to print its usage message too if hook is set */\n \tif ( rte_application_usage_hook ) {\n \t\tprintf(\"===== Application Usage =====\\n\\n\");\n@@ -422,42 +425,84 @@ eal_parse_coremask(const char *coremask)\n \twhile (isblank(*coremask))\n \t\tcoremask++;\n \tif (coremask[0] == '0' && ((coremask[1] == 'x')\n-\t\t||  (coremask[1] == 'X')) )\n+\t\t||  (coremask[1] == 'X')) ) {\n \t\tcoremask += 2;\n-\ti = strnlen(coremask, PATH_MAX);\n-\twhile ((i > 0) && isblank(coremask[i - 1]))\n-\t\ti--;\n-\tif (i == 0)\n-\t\treturn -1;\n+\t\ti = strnlen(coremask, PATH_MAX);\n+\t\twhile ((i > 0) && isblank(coremask[i - 1]))\n+\t\t\ti--;\n+\t\tif (i == 0)\n+\t\t\treturn -1;\n \n-\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n-\t\tc = coremask[i];\n-\t\tif (isxdigit(c) == 0) {\n-\t\t\t/* invalid characters */\n-\t\t\treturn (-1);\n-\t\t}\n-\t\tval = xdigit2val(c);\n-\t\tfor(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {\n-\t\t\tif((1 << j) & val) {\n-\t\t\t\tif (!lcore_config[idx].detected) {\n-\t\t\t\t\tRTE_LOG(ERR, EAL, \"lcore %u \"\n-\t\t\t\t\t        \"unavailable\\n\", idx);\n-\t\t\t\t\treturn -1;\n+\t\tfor (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) {\n+\t\t\tc = coremask[i];\n+\t\t\tif (isxdigit(c) == 0) {\n+\t\t\t\t/* invalid characters */\n+\t\t\t\treturn (-1);\n+\t\t\t}\n+\t\t\tval = xdigit2val(c);\n+\t\t\tfor(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) {\n+\t\t\t\tif((1 << j) & val) {\n+\t\t\t\t\tif (!lcore_config[idx].detected) {\n+\t\t\t\t\t\tRTE_LOG(ERR, EAL, \"lcore %u \"\n+\t\t\t\t\t\t\t\t\"unavailable\\n\", idx);\n+\t\t\t\t\t\treturn -1;\n+\t\t\t\t\t}\n+\t\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n+\t\t\t\t\tif(count == 0)\n+\t\t\t\t\t\tcfg->master_lcore = idx;\n+\t\t\t\t\tcount++;\n+\t\t\t\t} else  {\n+\t\t\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n \t\t\t\t}\n-\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\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 \t\t\t}\n \t\t}\n-\t}\n-\tfor(; i >= 0; i--)\n-\t\tif(coremask[i] != '0')\n+\n+\t\tfor(; i >= 0; i--)\n+\t\t\tif(coremask[i] != '0')\n+\t\t\t\treturn -1;\n+\t\tfor(; idx < RTE_MAX_LCORE; idx++)\n+\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\t} else {\n+\t\tchar *end = NULL;\n+\t\tint min, max;\n+\n+\t\t/* Reset core roles */\n+\t\tfor(idx = 0; idx < RTE_MAX_LCORE; idx++)\n+\t\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\n+\t\t/* else this is a list of cores */\n+\t\tmin = RTE_MAX_LCORE;\n+\t\tdo {\n+\t\t\twhile (isblank(*coremask))\n+\t\t\t\tcoremask++;\n+\t\t\tidx = strtoul(coremask, &end, 10);\n+\t\t\tif (end != NULL) {\n+\t\t\t\twhile (isblank(*end))\n+\t\t\t\t\tend++;\n+\t\t\t\tif (*end == '-') {\n+\t\t\t\t\tmin = idx;\n+\t\t\t\t\tcoremask = end + 1;\n+\t\t\t\t} else if ((*end == ',') || (*end == '\\0')) {\n+\t\t\t\t\tmax = idx;\n+\t\t\t\t\tif (min == RTE_MAX_LCORE)\n+\t\t\t\t\t\tmin = idx;\n+\t\t\t\t\tfor (idx=min; idx<=max; idx++) {\n+\t\t\t\t\t\tcfg->lcore_role[idx] = ROLE_RTE;\n+\t\t\t\t\t\tif(count == 0)\n+\t\t\t\t\t\t\tcfg->master_lcore = idx;\n+\t\t\t\t\t\tcount++;\n+\t\t\t\t\t}\n+\t\t\t\t\tmin = RTE_MAX_LCORE;\n+\t\t\t\t\tif (*end != '\\0')\n+\t\t\t\t\t\tcoremask = end + 1;\n+\t\t\t\t} else {\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t} while ((*coremask != '\\0') && (end != NULL) && (*end != '\\0'));\n+\t\tif ((*coremask == '\\0') || (end == NULL) || (*end != '\\0'))\n \t\t\treturn -1;\n-\tfor(; idx < RTE_MAX_LCORE; idx++)\n-\t\tcfg->lcore_role[idx] = ROLE_OFF;\n+\t}\n \tif(count == 0)\n \t\treturn -1;\n \t/* Update the count of enabled logical cores of the EAL configuration */\n",
    "prefixes": [
        "dpdk-dev",
        "RFC"
    ]
}