get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44283,
    "url": "http://patchwork.dpdk.org/api/patches/44283/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/155676c123bd8b8770dcd966c7aa347177a70660.1536073997.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<155676c123bd8b8770dcd966c7aa347177a70660.1536073997.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/155676c123bd8b8770dcd966c7aa347177a70660.1536073997.git.anatoly.burakov@intel.com",
    "date": "2018-09-04T15:15:49",
    "name": "[v3,8/9] mem: allow querying offset into segment fd",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "216c5a27a30d0f1da96b0a27a2d8bd717844aaeb",
    "submitter": {
        "id": 4,
        "url": "http://patchwork.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/155676c123bd8b8770dcd966c7aa347177a70660.1536073997.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 1177,
            "url": "http://patchwork.dpdk.org/api/series/1177/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=1177",
            "date": "2018-09-04T15:15:41",
            "name": "Improve running DPDK without hugetlbfs mounpoint",
            "version": 3,
            "mbox": "http://patchwork.dpdk.org/series/1177/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/44283/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/44283/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 EE1545B2E;\n\tTue,  4 Sep 2018 17:16:08 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 91709326D\n\tfor <dev@dpdk.org>; Tue,  4 Sep 2018 17:15:59 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Sep 2018 08:15:58 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga002.fm.intel.com with ESMTP; 04 Sep 2018 08:15:52 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw84FFpew025487; Tue, 4 Sep 2018 16:15:51 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w84FFpRY022325;\n\tTue, 4 Sep 2018 16:15:51 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w84FFpJf022317;\n\tTue, 4 Sep 2018 16:15:51 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,329,1531810800\"; d=\"scan'208\";a=\"82907296\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>, tiwei.bie@intel.com,\n\tray.kinsella@intel.com, zhihong.wang@intel.com,\n\tmaxime.coquelin@redhat.com, kuralamudhan.ramakrishnan@intel.com",
        "Date": "Tue,  4 Sep 2018 16:15:49 +0100",
        "Message-Id": "<155676c123bd8b8770dcd966c7aa347177a70660.1536073997.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1536073996.git.anatoly.burakov@intel.com>",
            "<cover.1536073996.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1536073996.git.anatoly.burakov@intel.com>",
            "<cover.1536072550.git.anatoly.burakov@intel.com>\n\t<cover.1536073996.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v3 8/9] mem: allow querying offset into segment fd",
        "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": "In a few cases, user may need to query offset into fd for a\nparticular memory segment (for example, to selectively map\npages). This commit adds a new API to do that.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v3:\n    - Fix single file segments mode not working\n\n lib/librte_eal/bsdapp/eal/eal_memalloc.c   |  6 +++\n lib/librte_eal/common/eal_common_memory.c  | 50 ++++++++++++++++++++++\n lib/librte_eal/common/eal_memalloc.h       |  3 ++\n lib/librte_eal/common/include/rte_memory.h | 49 +++++++++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_memalloc.c | 24 +++++++++++\n lib/librte_eal/rte_eal_version.map         |  2 +\n 6 files changed, 134 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal_memalloc.c b/lib/librte_eal/bsdapp/eal/eal_memalloc.c\nindex 80e4c3d4f..06afbcc99 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_memalloc.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_memalloc.c\n@@ -60,6 +60,12 @@ eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd)\n \treturn -ENOTSUP;\n }\n \n+int\n+eal_memalloc_get_seg_fd_offset(int list_idx, int seg_idx, size_t *offset)\n+{\n+\treturn -ENOTSUP;\n+}\n+\n int\n eal_memalloc_init(void)\n {\ndiff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex 4a80deaf5..0b69804ff 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -599,6 +599,56 @@ rte_memseg_get_fd(const struct rte_memseg *ms)\n \treturn ret;\n }\n \n+int __rte_experimental\n+rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg *ms,\n+\t\tsize_t *offset)\n+{\n+\tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n+\tstruct rte_memseg_list *msl;\n+\tstruct rte_fbarray *arr;\n+\tint msl_idx, seg_idx, ret;\n+\n+\tif (ms == NULL || offset == NULL) {\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+\n+\tmsl = rte_mem_virt2memseg_list(ms->addr);\n+\tif (msl == NULL) {\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+\tarr = &msl->memseg_arr;\n+\n+\tmsl_idx = msl - mcfg->memsegs;\n+\tseg_idx = rte_fbarray_find_idx(arr, ms);\n+\n+\tif (!rte_fbarray_is_used(arr, seg_idx)) {\n+\t\trte_errno = ENOENT;\n+\t\treturn -1;\n+\t}\n+\n+\tret = eal_memalloc_get_seg_fd_offset(msl_idx, seg_idx, offset);\n+\tif (ret < 0) {\n+\t\trte_errno = -ret;\n+\t\tret = -1;\n+\t}\n+\treturn ret;\n+}\n+\n+int __rte_experimental\n+rte_memseg_get_fd_offset(const struct rte_memseg *ms, size_t *offset)\n+{\n+\tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n+\tint ret;\n+\n+\trte_rwlock_read_lock(&mcfg->memory_hotplug_lock);\n+\tret = rte_memseg_get_fd_offset_thread_unsafe(ms, offset);\n+\trte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);\n+\n+\treturn ret;\n+}\n+\n /* init memory subsystem */\n int\n rte_eal_memory_init(void)\ndiff --git a/lib/librte_eal/common/eal_memalloc.h b/lib/librte_eal/common/eal_memalloc.h\nindex 70a214de4..af917c2f9 100644\n--- a/lib/librte_eal/common/eal_memalloc.h\n+++ b/lib/librte_eal/common/eal_memalloc.h\n@@ -84,6 +84,9 @@ eal_memalloc_get_seg_fd(int list_idx, int seg_idx);\n int\n eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd);\n \n+int\n+eal_memalloc_get_seg_fd_offset(int list_idx, int seg_idx, size_t *offset);\n+\n int\n eal_memalloc_init(void);\n \ndiff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h\nindex 0d2a30056..14bd277a4 100644\n--- a/lib/librte_eal/common/include/rte_memory.h\n+++ b/lib/librte_eal/common/include/rte_memory.h\n@@ -365,6 +365,55 @@ rte_memseg_get_fd(const struct rte_memseg *ms);\n int __rte_experimental\n rte_memseg_get_fd_thread_unsafe(const struct rte_memseg *ms);\n \n+/**\n+ * Get offset into segment file descriptor associated with a particular memseg\n+ * (if available).\n+ *\n+ * @note This function read-locks the memory hotplug subsystem, and thus cannot\n+ *       be used within memory-related callback functions.\n+ *\n+ * @param ms\n+ *   A pointer to memseg for which to get file descriptor.\n+ * @param offset\n+ *   A pointer to offset value where the result will be stored.\n+ *\n+ * @return\n+ *   Valid file descriptor in case of success.\n+ *   -1 in case of error, with ``rte_errno`` set to the following values:\n+ *     - EINVAL  - ``ms`` pointer was NULL or did not point to a valid memseg\n+ *     - EINVAL  - ``offset`` pointer was NULL\n+ *     - ENODEV  - ``ms`` fd is not available\n+ *     - ENOENT  - ``ms`` is an unused segment\n+ *     - ENOTSUP - segment fd's are not supported\n+ */\n+int __rte_experimental\n+rte_memseg_get_fd_offset(const struct rte_memseg *ms, size_t *offset);\n+\n+/**\n+ * Get offset into segment file descriptor associated with a particular memseg\n+ * (if available).\n+ *\n+ * @note This function does not perform any locking, and is only safe to call\n+ *       from within memory-related callback functions.\n+ *\n+ * @param ms\n+ *   A pointer to memseg for which to get file descriptor.\n+ * @param offset\n+ *   A pointer to offset value where the result will be stored.\n+ *\n+ * @return\n+ *   Valid file descriptor in case of success.\n+ *   -1 in case of error, with ``rte_errno`` set to the following values:\n+ *     - EINVAL  - ``ms`` pointer was NULL or did not point to a valid memseg\n+ *     - EINVAL  - ``offset`` pointer was NULL\n+ *     - ENODEV  - ``ms`` fd is not available\n+ *     - ENOENT  - ``ms`` is an unused segment\n+ *     - ENOTSUP - segment fd's are not supported\n+ */\n+int __rte_experimental\n+rte_memseg_get_fd_offset_thread_unsafe(const struct rte_memseg *ms,\n+\t\tsize_t *offset);\n+\n /**\n  * Dump the physical memory layout to a file.\n  *\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\nindex 21f842753..6fc9dc0ca 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n@@ -1406,6 +1406,30 @@ eal_memalloc_get_seg_fd(int list_idx, int seg_idx)\n \treturn fd;\n }\n \n+int\n+eal_memalloc_get_seg_fd_offset(int list_idx, int seg_idx, size_t *offset)\n+{\n+\tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n+\n+\t/* fd_list not initialized? */\n+\tif (fd_list[list_idx].len == 0)\n+\t\treturn -ENODEV;\n+\tif (internal_config.single_file_segments) {\n+\t\tsize_t pgsz = mcfg->memsegs[list_idx].page_sz;\n+\n+\t\t/* segment not active? */\n+\t\tif (fd_list[list_idx].memseg_list_fd < 0)\n+\t\t\treturn -ENOENT;\n+\t\t*offset = pgsz * seg_idx;\n+\t} else {\n+\t\t/* segment not active? */\n+\t\tif (fd_list[list_idx].fds[seg_idx] < 0)\n+\t\t\treturn -ENOENT;\n+\t\t*offset = 0;\n+\t}\n+\treturn 0;\n+}\n+\n int\n eal_memalloc_init(void)\n {\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex e659e19d6..ba159f7cd 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -321,7 +321,9 @@ EXPERIMENTAL {\n \trte_memseg_contig_walk;\n \trte_memseg_contig_walk_thread_unsafe;\n \trte_memseg_get_fd;\n+\trte_memseg_get_fd_offset;\n \trte_memseg_get_fd_thread_unsafe;\n+\trte_memseg_get_fd_offset_thread_unsafe;\n \trte_memseg_list_walk;\n \trte_memseg_list_walk_thread_unsafe;\n \trte_memseg_walk;\n",
    "prefixes": [
        "v3",
        "8/9"
    ]
}