get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 15510,
    "url": "https://patches.dpdk.org/api/patches/15510/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1472481335-21226-2-git-send-email-olivier.matz@6wind.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": "<1472481335-21226-2-git-send-email-olivier.matz@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1472481335-21226-2-git-send-email-olivier.matz@6wind.com",
    "date": "2016-08-29T14:35:20",
    "name": "[dpdk-dev,v2,01/16] mbuf: add function to read packet data",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8ba27d9fc476b94afd62e9a03fa05ac937a8ec13",
    "submitter": {
        "id": 8,
        "url": "https://patches.dpdk.org/api/people/8/?format=api",
        "name": "Olivier Matz",
        "email": "olivier.matz@6wind.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1472481335-21226-2-git-send-email-olivier.matz@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/15510/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/15510/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 C6D822BD1;\n\tMon, 29 Aug 2016 16:35:55 +0200 (CEST)",
            "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n\t[62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 570832BB4\n\tfor <dev@dpdk.org>; Mon, 29 Aug 2016 16:35:52 +0200 (CEST)",
            "from glumotte.dev.6wind.com (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 3206424E2A;\n\tMon, 29 Aug 2016 16:35:52 +0200 (CEST)"
        ],
        "From": "Olivier Matz <olivier.matz@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "cunming.liang@intel.com, john.mcnamara@intel.com,\n\tandrey.chilikin@intel.com, konstantin.ananyev@intel.com",
        "Date": "Mon, 29 Aug 2016 16:35:20 +0200",
        "Message-Id": "<1472481335-21226-2-git-send-email-olivier.matz@6wind.com>",
        "X-Mailer": "git-send-email 2.8.1",
        "In-Reply-To": "<1472481335-21226-1-git-send-email-olivier.matz@6wind.com>",
        "References": "<1467733310-20875-1-git-send-email-olivier.matz@6wind.com>\n\t<1472481335-21226-1-git-send-email-olivier.matz@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH v2 01/16] mbuf: add function to read packet data",
        "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": "Introduce a new function to read the packet data from an mbuf chain. It\nlinearizes the data if required, and also ensures that the mbuf is large\nenough.\n\nThis function is used in next commits that add a software parser to\nretrieve the packet type.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n doc/guides/rel_notes/release_16_11.rst |  4 ++++\n lib/librte_mbuf/rte_mbuf.c             | 36 ++++++++++++++++++++++++++++++++++\n lib/librte_mbuf/rte_mbuf.h             | 35 +++++++++++++++++++++++++++++++++\n lib/librte_mbuf/rte_mbuf_version.map   |  7 +++++++\n 4 files changed, 82 insertions(+)",
    "diff": "diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst\nindex 66916af..280f298 100644\n--- a/doc/guides/rel_notes/release_16_11.rst\n+++ b/doc/guides/rel_notes/release_16_11.rst\n@@ -36,6 +36,10 @@ New Features\n \n      This section is a comment. Make sure to start the actual text at the margin.\n \n+* **Added function to read packet data.**\n+\n+  Added a new function ``rte_pktmbuf_read()`` to read the packet data from an\n+  mbuf chain, linearizing if required.\n \n Resolved Issues\n ---------------\ndiff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c\nindex 4846b89..fb2b962 100644\n--- a/lib/librte_mbuf/rte_mbuf.c\n+++ b/lib/librte_mbuf/rte_mbuf.c\n@@ -59,6 +59,7 @@\n #include <rte_string_fns.h>\n #include <rte_hexdump.h>\n #include <rte_errno.h>\n+#include <rte_memcpy.h>\n \n /*\n  * ctrlmbuf constructor, given as a callback function to\n@@ -262,6 +263,41 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)\n \t}\n }\n \n+/* read len data bytes in a mbuf at specified offset (internal) */\n+const void *__rte_pktmbuf_read(const struct rte_mbuf *m, uint32_t off,\n+\tuint32_t len, void *buf)\n+{\n+\tconst struct rte_mbuf *seg = m;\n+\tuint32_t buf_off = 0, copy_len;\n+\n+\tif (off + len > rte_pktmbuf_pkt_len(m))\n+\t\treturn NULL;\n+\n+\twhile (off >= rte_pktmbuf_data_len(seg) &&\n+\t\t\trte_pktmbuf_data_len(seg) != 0) {\n+\t\toff -= rte_pktmbuf_data_len(seg);\n+\t\tseg = seg->next;\n+\t}\n+\n+\tif (off + len <= rte_pktmbuf_data_len(seg))\n+\t\treturn rte_pktmbuf_mtod_offset(seg, char *, off);\n+\n+\t/* rare case: header is split among several segments */\n+\twhile (len > 0) {\n+\t\tcopy_len = rte_pktmbuf_data_len(seg) - off;\n+\t\tif (copy_len > len)\n+\t\t\tcopy_len = len;\n+\t\trte_memcpy((char *)buf + buf_off,\n+\t\t\trte_pktmbuf_mtod_offset(seg, char *, off), copy_len);\n+\t\toff = 0;\n+\t\tbuf_off += copy_len;\n+\t\tlen -= copy_len;\n+\t\tseg = seg->next;\n+\t}\n+\n+\treturn buf;\n+}\n+\n /*\n  * Get the name of a RX offload flag. Must be kept synchronized with flag\n  * definitions in rte_mbuf.h.\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex 7ea66ed..7d94f82 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -1951,6 +1951,41 @@ static inline int rte_pktmbuf_is_contiguous(const struct rte_mbuf *m)\n }\n \n /**\n+ * @internal used by rte_pktmbuf_read().\n+ */\n+const void *__rte_pktmbuf_read(const struct rte_mbuf *m, uint32_t off,\n+\tuint32_t len, void *buf);\n+\n+/**\n+ * Read len data bytes in a mbuf at specified offset.\n+ *\n+ * If the data is contiguous, return the pointer in the mbuf data, else\n+ * copy the data in the buffer provided by the user and return its\n+ * pointer.\n+ *\n+ * @param m\n+ *   The pointer to the mbuf.\n+ * @param off\n+ *   The offset of the data in the mbuf.\n+ * @param len\n+ *   The amount of bytes to read.\n+ * @param buf\n+ *   The buffer where data is copied if it is not contigous in mbuf\n+ *   data. Its length should be at least equal to the len parameter.\n+ * @return\n+ *   The pointer to the data, either in the mbuf if it is contiguous,\n+ *   or in the user buffer. If mbuf is too small, NULL is returned.\n+ */\n+static inline const void *rte_pktmbuf_read(const struct rte_mbuf *m,\n+\tuint32_t off, uint32_t len, void *buf)\n+{\n+\tif (likely(off + len <= rte_pktmbuf_data_len(m)))\n+\t\treturn rte_pktmbuf_mtod_offset(m, char *, off);\n+\telse\n+\t\treturn __rte_pktmbuf_read(m, off, len, buf);\n+}\n+\n+/**\n  * Chain an mbuf to another, thereby creating a segmented packet.\n  *\n  * Note: The implementation will do a linear walk over the segments to find\ndiff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map\nindex e10f6bd..79e4dd8 100644\n--- a/lib/librte_mbuf/rte_mbuf_version.map\n+++ b/lib/librte_mbuf/rte_mbuf_version.map\n@@ -18,3 +18,10 @@ DPDK_2.1 {\n \trte_pktmbuf_pool_create;\n \n } DPDK_2.0;\n+\n+DPDK_16.11 {\n+\tglobal:\n+\n+\t__rte_pktmbuf_read;\n+\n+} DPDK_2.1;\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "01/16"
    ]
}