get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2208,
    "url": "https://patches.dpdk.org/api/patches/2208/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1420565213-17429-6-git-send-email-rkerur@gmail.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": "<1420565213-17429-6-git-send-email-rkerur@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1420565213-17429-6-git-send-email-rkerur@gmail.com",
    "date": "2015-01-06T17:26:52",
    "name": "[dpdk-dev,v4,6/7] Move common functions in eal_memory.c",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "1b18e90cce6747ea95a225c5f38705c52895df1a",
    "submitter": {
        "id": 134,
        "url": "https://patches.dpdk.org/api/people/134/?format=api",
        "name": "Ravi Kerur",
        "email": "rkerur@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1420565213-17429-6-git-send-email-rkerur@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/2208/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/2208/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 CF8475A74;\n\tTue,  6 Jan 2015 18:27:27 +0100 (CET)",
            "from mail-pa0-f50.google.com (mail-pa0-f50.google.com\n\t[209.85.220.50]) by dpdk.org (Postfix) with ESMTP id 6C0635A42\n\tfor <dev@dpdk.org>; Tue,  6 Jan 2015 18:27:19 +0100 (CET)",
            "by mail-pa0-f50.google.com with SMTP id bj1so31410694pad.37\n\tfor <dev@dpdk.org>; Tue, 06 Jan 2015 09:27:18 -0800 (PST)",
            "from iaas-l305162.englab.brocade.com ([144.49.130.148])\n\tby mx.google.com with ESMTPSA id\n\tnl14sm46887340pdb.81.2015.01.06.09.27.17\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 06 Jan 2015 09:27:18 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=cmip5T6D/Dahb4VX3MGTS2pSkaWN/jJONvzWR2lnNn0=;\n\tb=gdlZOxhvLKZ+7oIuiOdfOS3yzH4mOm3y0jLYegxnyCsitLbS6c8PokJlVD08gkXbRH\n\tXuOe+wfSarfVAURdH54gJiCNsLETy2l3327crC41xSiZ8w6//ox2MdqbdaXC6xK7V5W3\n\tn3eje3bISEXulbzCHd4rwrtViaVjUUDMk76PWGHBvKElk7w6B0FWIO5ihBTh2wDFLnLa\n\tlprVLuasoqvuvG50BhkXUbZwwa+OhklkzZ6nH9kRxuk26fGSd4KNewpTClKID4ePpVqf\n\t5WTnMspbJkOI2xYdmk3rc+ugBXeRxYgPKpOrn92cKRczM0UM5GSrhEFq1LqPRyZ0JlDW\n\tFjLw==",
        "X-Received": "by 10.68.69.109 with SMTP id d13mr157836887pbu.57.1420565238608; \n\tTue, 06 Jan 2015 09:27:18 -0800 (PST)",
        "From": "Ravi Kerur <rkerur@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue,  6 Jan 2015 12:26:52 -0500",
        "Message-Id": "<1420565213-17429-6-git-send-email-rkerur@gmail.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1420565213-17429-1-git-send-email-rkerur@gmail.com>",
        "References": "<1420565170-17365-1-git-send-email-rkerur@gmail.com>\n\t<1420565213-17429-1-git-send-email-rkerur@gmail.com>",
        "Subject": "[dpdk-dev] [PATCH v4 6/7] Move common functions in eal_memory.c",
        "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": "Changes in v4\nMake rte_eal_hugepage_init and rte_eal_hugepage_attach as\nwrapper functions for BSD.\n\nChanges in v3\nChanged subject to be more explicit on file name inclusion.\n\nChanges in v2\nUse common function names rte_eal_hugepage_init and\nrte_eal_hugepage_attach for BSD and Linux. Update comments about its\nactuality in function declaration.\n\nChanges in v1\nMove common functions in eal_memory.c to librte_eal/common/\neal_common_memory.c file.\n\nFollowing functions are moved to eal_common_memory.c file\n\nstatic int rte_eal_memdevice_init(void); int rte_eal_memory_init(void);\n\nFix checkpatch warnings and errors.\n\nSigned-off-by: Ravi Kerur <rkerur@gmail.com>\n---\n lib/librte_eal/bsdapp/eal/eal_memory.c    | 47 +++++++++++--------------------\n lib/librte_eal/common/eal_common_memory.c | 38 +++++++++++++++++++++++--\n lib/librte_eal/common/eal_private.h       | 22 +++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_memory.c  | 36 ++---------------------\n 4 files changed, 76 insertions(+), 67 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c\nindex 65ee87d..7a7d9d7 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_memory.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c\n@@ -59,7 +59,7 @@ rte_mem_virt2phy(const void *virtaddr)\n \treturn RTE_BAD_PHYS_ADDR;\n }\n \n-static int\n+static inline int\n rte_eal_contigmem_init(void)\n {\n \tstruct rte_mem_config *mcfg;\n@@ -130,7 +130,16 @@ rte_eal_contigmem_init(void)\n \treturn 0;\n }\n \n-static int\n+/*\n+ * Wrapper function to initialize contigmem.\n+ */\n+int\n+rte_eal_hugepage_init(void)\n+{\n+\treturn rte_eal_contigmem_init();\n+}\n+\n+static inline int\n rte_eal_contigmem_attach(void)\n {\n \tconst struct hugepage_info *hpi;\n@@ -190,35 +199,11 @@ error:\n \treturn -1;\n }\n \n-\n-static int\n-rte_eal_memdevice_init(void)\n-{\n-\tstruct rte_config *config;\n-\n-\tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n-\t\treturn 0;\n-\n-\tconfig = rte_eal_get_configuration();\n-\tconfig->mem_config->nchannel = internal_config.force_nchannel;\n-\tconfig->mem_config->nrank = internal_config.force_nrank;\n-\n-\treturn 0;\n-}\n-\n-/* init memory subsystem */\n+/*\n+ * Wrapper function to attach contigmem.\n+ */\n int\n-rte_eal_memory_init(void)\n+rte_eal_hugepage_attach(void)\n {\n-\tRTE_LOG(INFO, EAL, \"Setting up physically contiguous memory...\\n\");\n-\tconst int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?\n-\t\t\trte_eal_contigmem_init() :\n-\t\t\trte_eal_contigmem_attach();\n-\tif (retval < 0)\n-\t\treturn -1;\n-\n-\tif (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)\n-\t\treturn -1;\n-\n-\treturn 0;\n+\treturn rte_eal_contigmem_attach();\n }\ndiff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex 77830f8..cb27930 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -46,6 +46,7 @@\n #include <rte_log.h>\n \n #include \"eal_private.h\"\n+#include \"eal_internal_cfg.h\"\n \n /*\n  * Return a pointer to a read-only table of struct rte_physmem_desc\n@@ -70,7 +71,7 @@ rte_eal_get_physmem_size(void)\n \t/* get pointer to global configuration */\n \tmcfg = rte_eal_get_configuration()->mem_config;\n \n-\tfor (i=0; i<RTE_MAX_MEMSEG; i++) {\n+\tfor (i = 0; i < RTE_MAX_MEMSEG; i++) {\n \t\tif (mcfg->memseg[i].addr == NULL)\n \t\t\tbreak;\n \n@@ -90,7 +91,7 @@ rte_dump_physmem_layout(FILE *f)\n \t/* get pointer to global configuration */\n \tmcfg = rte_eal_get_configuration()->mem_config;\n \n-\tfor (i=0; i<RTE_MAX_MEMSEG; i++) {\n+\tfor (i = 0; i < RTE_MAX_MEMSEG; i++) {\n \t\tif (mcfg->memseg[i].addr == NULL)\n \t\t\tbreak;\n \n@@ -119,3 +120,36 @@ unsigned rte_memory_get_nrank(void)\n {\n \treturn rte_eal_get_configuration()->mem_config->nrank;\n }\n+\n+static int\n+rte_eal_memdevice_init(void)\n+{\n+\tstruct rte_config *config;\n+\n+\tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n+\t\treturn 0;\n+\n+\tconfig = rte_eal_get_configuration();\n+\tconfig->mem_config->nchannel = internal_config.force_nchannel;\n+\tconfig->mem_config->nrank = internal_config.force_nrank;\n+\n+\treturn 0;\n+}\n+\n+/* init memory subsystem */\n+int\n+rte_eal_memory_init(void)\n+{\n+\tRTE_LOG(INFO, EAL, \"Setting up physically contiguous memory...\\n\");\n+\tconst int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?\n+\t\t\trte_eal_hugepage_init() :\n+\t\t\trte_eal_hugepage_attach();\n+\n+\tif (retval < 0)\n+\t\treturn -1;\n+\n+\tif (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex f907e79..71ba5fd 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -326,4 +326,26 @@ int set_tsc_freq_from_clock(void);\n  */\n void rte_set_tsc_hz(uint64_t tsc_hz);\n \n+/**\n+ * This function prepares physical memory mapping\n+ * i.e. hugepages on Linux and\n+ *      contigmem on BSD.\n+ * It is a wrapper function for BSD which will\n+ * internally call contigmem_init.\n+ *\n+ * This function is private to the EAL.\n+ */\n+int rte_eal_hugepage_init(void);\n+\n+/**\n+ * This function creates memory mapping in secondary\n+ * i.e. hugepages on Linux and\n+ *      contigmem on BSD.\n+ * It is a wrapper function for BSD which will\n+ * internally call contigmem_attach.\n+ *\n+ * This function is private to the EAL.\n+ */\n+int rte_eal_hugepage_attach(void);\n+\n #endif /* _EAL_PRIVATE_H_ */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex bae2507..f4d91df 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memory.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c\n@@ -1031,7 +1031,7 @@ calc_num_pages_per_socket(uint64_t * memory,\n  *  6. unmap the first mapping\n  *  7. fill memsegs in configuration with contiguous zones\n  */\n-static int\n+int\n rte_eal_hugepage_init(void)\n {\n \tstruct rte_mem_config *mcfg;\n@@ -1369,7 +1369,7 @@ getFileSize(int fd)\n  * configuration and finds the hugepages which form that segment, mapping them\n  * in order to form a contiguous block in the virtual memory space\n  */\n-static int\n+int\n rte_eal_hugepage_attach(void)\n {\n \tconst struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n@@ -1530,35 +1530,3 @@ error:\n \treturn -1;\n }\n \n-static int\n-rte_eal_memdevice_init(void)\n-{\n-\tstruct rte_config *config;\n-\n-\tif (rte_eal_process_type() == RTE_PROC_SECONDARY)\n-\t\treturn 0;\n-\n-\tconfig = rte_eal_get_configuration();\n-\tconfig->mem_config->nchannel = internal_config.force_nchannel;\n-\tconfig->mem_config->nrank = internal_config.force_nrank;\n-\n-\treturn 0;\n-}\n-\n-\n-/* init memory subsystem */\n-int\n-rte_eal_memory_init(void)\n-{\n-\tRTE_LOG(INFO, EAL, \"Setting up memory...\\n\");\n-\tconst int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?\n-\t\t\trte_eal_hugepage_init() :\n-\t\t\trte_eal_hugepage_attach();\n-\tif (retval < 0)\n-\t\treturn -1;\n-\n-\tif (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)\n-\t\treturn -1;\n-\n-\treturn 0;\n-}\n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "6/7"
    ]
}