get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 55474,
    "url": "http://patches.dpdk.org/api/patches/55474/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/658a39af271ae33f9df20678da0655216646702c.1561635211.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<658a39af271ae33f9df20678da0655216646702c.1561635211.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/658a39af271ae33f9df20678da0655216646702c.1561635211.git.anatoly.burakov@intel.com",
    "date": "2019-06-27T11:33:46",
    "name": "[v2,2/2] eal/freebsd: add config reattach",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "478c941dfca0e65f5466e1392803bc1d0b93a2e9",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/658a39af271ae33f9df20678da0655216646702c.1561635211.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 5196,
            "url": "http://patches.dpdk.org/api/series/5196/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5196",
            "date": "2019-06-27T11:33:45",
            "name": "[v2,1/2] eal/freebsd: fix missing write to internal config",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/5196/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/55474/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/55474/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id EAC542BE2;\n\tThu, 27 Jun 2019 13:33:54 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 659D31E20;\n\tThu, 27 Jun 2019 13:33:50 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jun 2019 04:33:49 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby orsmga004.jf.intel.com with ESMTP; 27 Jun 2019 04:33:48 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.63,423,1557212400\"; d=\"scan'208\";a=\"313765424\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>, david.marchand@redhat.com,\n\tstable@dpdk.org",
        "Date": "Thu, 27 Jun 2019 12:33:46 +0100",
        "Message-Id": "<658a39af271ae33f9df20678da0655216646702c.1561635211.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": [
            "<cb2b14f4e38dbc746c87d48ef45d724737d5b17b.1561635211.git.anatoly.burakov@intel.com>",
            "<f4c041a147e3b6b29d70e056653fd3c163e1d4ce.1561477829.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cb2b14f4e38dbc746c87d48ef45d724737d5b17b.1561635211.git.anatoly.burakov@intel.com>",
            "<f4c041a147e3b6b29d70e056653fd3c163e1d4ce.1561477829.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v2 2/2] eal/freebsd: add config reattach",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Linux EAL will attach the shared config at an arbitrary address,\nfind out where the shared config is mapped in the primary, and\nthen will reattach it at that exact address.\n\nFreeBSD version doesn't seem to go for that extra reattach step,\nwhich makes one wonder how did it ever work in the first place.\n\nFix the FreeBSD init to also reattach shared config to the exact\nsame place the primary process has it.\n\nFixes: 764bf26873b9 (\"add FreeBSD support\")\nCc: bruce.richardson@intel.com\nCc: stable@dpdk.org\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v2:\n    - Rebase on top of latest master\n    - Fix fd handling\n    - Fix mmap PROT flags on first map\n\n lib/librte_eal/freebsd/eal/eal.c | 49 ++++++++++++++++++++++++++++++--\n 1 file changed, 46 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex 3e15af792..fac43b017 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -288,10 +288,11 @@ rte_eal_config_attach(void)\n \t}\n \n \trte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),\n-\t\t\t\tPROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);\n-\tclose(mem_cfg_fd);\n-\tmem_cfg_fd = -1;\n+\t\t\t\tPROT_READ, MAP_SHARED, mem_cfg_fd, 0);\n+\t/* don't close the fd here, it will be closed on reattach */\n \tif (rte_mem_cfg_addr == MAP_FAILED) {\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n \t\tRTE_LOG(ERR, EAL, \"Cannot mmap memory for rte_config! error %i (%s)\\n\",\n \t\t\terrno, strerror(errno));\n \t\treturn -1;\n@@ -302,6 +303,46 @@ rte_eal_config_attach(void)\n \treturn 0;\n }\n \n+/* reattach the shared config at exact memory location primary process has it */\n+static int\n+rte_eal_config_reattach(void)\n+{\n+\tstruct rte_mem_config *mem_config;\n+\tvoid *rte_mem_cfg_addr;\n+\n+\tif (internal_config.no_shconf)\n+\t\treturn 0;\n+\n+\t/* save the address primary process has mapped shared config to */\n+\trte_mem_cfg_addr =\n+\t\t\t(void *)(uintptr_t)rte_config.mem_config->mem_cfg_addr;\n+\n+\t/* unmap original config */\n+\tmunmap(rte_config.mem_config, sizeof(struct rte_mem_config));\n+\n+\t/* remap the config at proper address */\n+\tmem_config = (struct rte_mem_config *) mmap(rte_mem_cfg_addr,\n+\t\t\tsizeof(*mem_config), PROT_READ | PROT_WRITE, MAP_SHARED,\n+\t\t\tmem_cfg_fd, 0);\n+\tclose(mem_cfg_fd);\n+\tmem_cfg_fd = -1;\n+\n+\tif (mem_config == MAP_FAILED) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot mmap memory for rte_config! error %i (%s)\\n\",\n+\t\t\t\terrno, strerror(errno));\n+\t\treturn -1;\n+\t} else if (mem_config != rte_mem_cfg_addr) {\n+\t\t/* errno is stale, don't use */\n+\t\tRTE_LOG(ERR, EAL, \"Cannot mmap memory for rte_config at [%p], got [%p]\\n\",\n+\t\t\t  rte_mem_cfg_addr, mem_config);\n+\t\treturn -1;\n+\t}\n+\n+\trte_config.mem_config = mem_config;\n+\n+\treturn 0;\n+}\n+\n /* Detect if we are a primary or a secondary process */\n enum rte_proc_type_t\n eal_proc_type_detect(void)\n@@ -342,6 +383,8 @@ rte_config_init(void)\n \t\tif (rte_eal_config_attach() < 0)\n \t\t\treturn -1;\n \t\trte_eal_mcfg_wait_complete(rte_config.mem_config);\n+\t\tif (rte_eal_config_reattach() < 0)\n+\t\t\treturn -1;\n \t\tbreak;\n \tcase RTE_PROC_AUTO:\n \tcase RTE_PROC_INVALID:\n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}