get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7721,
    "url": "https://patches.dpdk.org/api/patches/7721/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445068109-8943-1-git-send-email-nissimn@radware.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": "<1445068109-8943-1-git-send-email-nissimn@radware.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1445068109-8943-1-git-send-email-nissimn@radware.com",
    "date": "2015-10-17T07:48:29",
    "name": "[dpdk-dev,v2] eal:Map rte cfg and uio at the end of hugepage mem",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "660965e39df4f53131476f7a12f9964b7a921a33",
    "submitter": {
        "id": 209,
        "url": "https://patches.dpdk.org/api/people/209/?format=api",
        "name": "Nissim Nisimov",
        "email": "NissimN@Radware.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445068109-8943-1-git-send-email-nissimn@radware.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7721/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7721/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 8BFF58E76;\n\tSat, 17 Oct 2015 09:48:41 +0200 (CEST)",
            "from mailout1.radware.com (unknown [192.115.180.130])\n\tby dpdk.org (Postfix) with ESMTP id 8C0A15927\n\tfor <dev@dpdk.org>; Sat, 17 Oct 2015 09:48:39 +0200 (CEST)",
            "from mailsrvdev.il.corp.radware.com (176.200.121.206) by\n\tILCAS2.corp.radware.com (176.200.120.122) with Microsoft SMTP Server\n\tid 14.3.210.2; Sat, 17 Oct 2015 10:48:37 +0300",
            "from RDE000c295c31fd-1.3 (unknown [10.172.2.30])\tby\n\tmailsrvdev.il.corp.radware.com (Postfix) with ESMTP id 99B967FA2E;\n\tSat, 17 Oct 2015 10:48:37 +0300 (IDT)",
            "by RDE000c295c31fd-1.3 (Postfix, from userid 1694)\tid 7591A524796; \n\tSat, 17 Oct 2015 10:48:37 +0300 (IDT)"
        ],
        "From": "Nissim Nisimov <nissimn@radware.com>",
        "To": "<dev@dpdk.org>",
        "Date": "Sat, 17 Oct 2015 10:48:29 +0300",
        "Message-ID": "<1445068109-8943-1-git-send-email-nissimn@radware.com>",
        "X-Mailer": "git-send-email 2.6.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "Subject": "[dpdk-dev] [PATCH v2] eal:Map rte cfg and uio at the end of\n\thugepage mem",
        "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": "* this patch removes unnecessary call to rte_eal_memory_init() introduced in the first version.\n\nProblem:\nIn DPDK Primary/Secondary module we assume mapping same regions of virtual memory addresses for Primary process and Secondary.\nAn issue may occur when the Primary and secondary processes are not symmetric in such way that the code is not the same (for example, Primary process is a traffic distributer and secondary is a worker). The result may be that specific virtual address region in the first process won't be available in the second process.\n\nChanges done at eal init:\nmap all related rte configuration and uio sections close to the end of huge pages memory (that mean rte_eal_memory_init() should be called before rte_config_init() in primary process)\nAccording to our observations there will be more probability to success when allocating rte_config and uio memzones after huge pages sections (actually uio is already allocated after the huge pages area)\n\nSigned-off-by: Nissim Nisimov <nissimn@radware.com>\n---\n lib/librte_eal/linuxapp/eal/eal.c         | 28 +++++++++++++++++++++-------\n lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 10 +++++++---\n 2 files changed, 28 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 33e1067..f85eb63 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -87,6 +87,7 @@\n \n #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10)\n \n+void *pci_find_max_end_va(void);\n /* Allow the application to print its usage message too if set */\n static rte_usage_hook_t\trte_application_usage_hook = NULL;\n \n@@ -189,12 +190,15 @@ rte_eal_config_create(void)\n \t\treturn;\n \n \t/* map the config before hugepage address so that we don't waste a page */\n-\tif (internal_config.base_virtaddr != 0)\n+\tif (internal_config.base_virtaddr != 0){\n \t\trte_mem_cfg_addr = (void *)\n \t\t\tRTE_ALIGN_FLOOR(internal_config.base_virtaddr -\n \t\t\tsizeof(struct rte_mem_config), sysconf(_SC_PAGE_SIZE));\n-\telse\n-\t\trte_mem_cfg_addr = NULL;\n+        }\n+\telse{\n+\t\trte_mem_cfg_addr = pci_find_max_end_va();\n+                RTE_LOG(INFO, EAL, \"rte_mem_cfg_addr =  0x%llx PType=%s\\n\",(unsigned long long)rte_mem_cfg_addr,rte_config.process_type == RTE_PROC_PRIMARY ? \"PRIMARY\" : \"SECONDARY\");\n+        }\n \n \tif (mem_cfg_fd < 0){\n \t\tmem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);\n@@ -227,7 +231,7 @@ rte_eal_config_create(void)\n \t/* store address of the config in the config itself so that secondary\n \t * processes could later map the config into this exact location */\n \trte_config.mem_config->mem_cfg_addr = (uintptr_t) rte_mem_cfg_addr;\n-\n+        \n }\n \n /* attach to an existing shared memory config */\n@@ -784,6 +788,13 @@ rte_eal_init(int argc, char **argv)\n \n \trte_srand(rte_rdtsc());\n \n+        /* Primary process should allocate hugepages before configuration */\n+\tif(internal_config.process_type == RTE_PROC_PRIMARY){\n+\t\tRTE_LOG(INFO, EAL, \"Calling rte_eal_memory_init as =%s\\n\",(rte_config.process_type == RTE_PROC_PRIMARY) ? \"PRIMARY\" : \"SECONDARY\");\n+\t\tif (rte_eal_memory_init() < 0)\n+\t\t\trte_panic(\"Cannot init memory\\n\");\n+\t}\n+\n \trte_config_init();\n \n \tif (rte_eal_pci_init() < 0)\n@@ -793,9 +804,12 @@ rte_eal_init(int argc, char **argv)\n \tif (rte_eal_ivshmem_init() < 0)\n \t\trte_panic(\"Cannot init IVSHMEM\\n\");\n #endif\n-\n-\tif (rte_eal_memory_init() < 0)\n-\t\trte_panic(\"Cannot init memory\\n\");\n+        /* secondary process will call memory init only after calling to rte_config_init() */\n+\tif(internal_config.process_type == RTE_PROC_SECONDARY){\n+\t\tRTE_LOG(INFO, EAL, \"Calling rte_eal_memory_init as =%s\\n\",rte_config.process_type == RTE_PROC_PRIMARY ? \"PRIMARY\" : \"SECONDARY\");\n+\t\tif (rte_eal_memory_init() < 0)\n+\t\t\trte_panic(\"Cannot init memory\\n\");\n+\t}\n \n \t/* the directories are locked during eal_hugepage_info_init */\n \teal_hugedirs_unlock();\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\nindex ac50e13..6812c37 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n@@ -338,9 +338,13 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \t}\n \n \t/* try mapping somewhere close to the end of hugepages */\n-\tif (pci_map_addr == NULL)\n-\t\tpci_map_addr = pci_find_max_end_va();\n-\n+\tif (pci_map_addr == NULL){\n+\t\tif (internal_config.base_virtaddr != 0){\n+                \tpci_map_addr = pci_find_max_end_va();\n+                } else{\n+                \tpci_map_addr = (void*)RTE_PTR_ALIGN(((char*)rte_eal_get_configuration()->mem_config->mem_cfg_addr + sizeof(struct rte_mem_config)),sysconf(_SC_PAGE_SIZE));\n+                }\n+        }\n \tmapaddr = pci_map_resource(pci_map_addr, fd, 0,\n \t\t\t(size_t)dev->mem_resource[res_idx].len, 0);\n \tclose(fd);\n",
    "prefixes": [
        "dpdk-dev",
        "v2"
    ]
}