get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60083,
    "url": "http://patches.dpdk.org/api/patches/60083/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190928003758.18489-5-stephen@networkplumber.org/",
    "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": "<20190928003758.18489-5-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190928003758.18489-5-stephen@networkplumber.org",
    "date": "2019-09-28T00:37:57",
    "name": "[4/5] mbuf: add a pktmbuf copy routine",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a6aa7093facefdae502c21c1714d44c27c9d7232",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190928003758.18489-5-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 6597,
            "url": "http://patches.dpdk.org/api/series/6597/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6597",
            "date": "2019-09-28T00:37:53",
            "name": "mbuf related patches",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/6597/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/60083/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/60083/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 2F3201BE96;\n\tSat, 28 Sep 2019 02:38:15 +0200 (CEST)",
            "from mail-pg1-f195.google.com (mail-pg1-f195.google.com\n\t[209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 04A071B948\n\tfor <dev@dpdk.org>; Sat, 28 Sep 2019 02:38:07 +0200 (CEST)",
            "by mail-pg1-f195.google.com with SMTP id i30so4326683pgl.0\n\tfor <dev@dpdk.org>; Fri, 27 Sep 2019 17:38:06 -0700 (PDT)",
            "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n\tby smtp.gmail.com with ESMTPSA id\n\tt13sm3494942pfh.12.2019.09.27.17.38.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 27 Sep 2019 17:38:05 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=YGTy358oZ3HU/DV9pSNDqY3tMnkYEw+Q0RgMPLx2tFk=;\n\tb=zU15/1U9+oJVsGskyI7DMTPU0xR0wE+cA+O1+0XgoKRXiPDhrmg2P1vG1mxpVG1RqC\n\t8u72bIgHERu7xdL3cUuBRrAz+E8964wzIE0gqB1bnZdUmy2TVRLUBajLgJfSBljee8fj\n\tXVrjFFQl4KtQ7zT55uA3cBnKs4DpXemn8l5RWXG0N6idedlhL+Py6UPaiLpv0fOF75wO\n\tQxgS9aoyi6zIom6Swu8xeh34YoLZL6UqajU+JpFgXjJ2GV59ox7haCCWf3TatFt6CoAc\n\tpodvEvtbgZqAQ7/Qtd9mDl196uBbZa9DmABxbmnPLYktDe3SXSbxphv1HYkPb2ZlxwDy\n\tJCiA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=YGTy358oZ3HU/DV9pSNDqY3tMnkYEw+Q0RgMPLx2tFk=;\n\tb=QPLACT1g4+xx+0FQL2TgmSkkhT0Hok8ChsKd6V6/c1HnagyIORKflvYFUoOtG+ViGO\n\tfRoXk9Tdo4UR59TMzcT6TBso+drckcyuftccbQUcDwakitdaQjwzVvUoD8rR6Dz23w/M\n\tjuTj1UlnfKdLGVFlG8b+2c3U/1famVlDekwTvSRx7MpTj5w+DF8VtBx8sJTiComjMcVt\n\tzFQ2X5PcKQDfFY6Zm5TazghF+BU8pWUiVKZLZKn3eLonEcWDo1CGriczzMHGaOqTZv6Z\n\t2vl9Pteom+85kY460tPfapgzcCCGqL8Rs4tlItWQKo2488jHyp29KseVrPrvxY9IQ6hy\n\tP5Cw==",
        "X-Gm-Message-State": "APjAAAUJ5KfPQTecqcIgXLvnR5qwd/PZLeoBh8jwWtUkJiR1YyasNoyE\n\tEWLi3v+/bxttjfLJoi1FUBZvzoHjqwI=",
        "X-Google-Smtp-Source": "APXvYqxika6pmJghabtkb23aJLMINerAOmrhHCqKXgrSDuzuYDlzcD3X1N6AlbstU1vzhJN7R1S3ZQ==",
        "X-Received": "by 2002:a62:fb06:: with SMTP id x6mr7842606pfm.186.1569631085922;\n\tFri, 27 Sep 2019 17:38:05 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>",
        "Date": "Fri, 27 Sep 2019 17:37:57 -0700",
        "Message-Id": "<20190928003758.18489-5-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190928003758.18489-1-stephen@networkplumber.org>",
        "References": "<20190928003758.18489-1-stephen@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 4/5] mbuf: add a pktmbuf copy routine",
        "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": "This is a commonly used operation that surprisingly the\nDPDK has not supported. The new rte_pktmbuf_copy does a\ndeep copy of packet. This is a complete copy including\nmeta-data.\n\nIt handles the case where the source mbuf comes from a pool\nwith larger data area than the destination pool. The routine\nalso has options for skipping data, or truncating at a fixed\nlength.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n lib/librte_mbuf/rte_mbuf.c           | 70 ++++++++++++++++++++++++++++\n lib/librte_mbuf/rte_mbuf.h           | 26 +++++++++++\n lib/librte_mbuf/rte_mbuf_version.map |  1 +\n 3 files changed, 97 insertions(+)",
    "diff": "diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c\nindex 12d0258a120d..6888d6bd5dfc 100644\n--- a/lib/librte_mbuf/rte_mbuf.c\n+++ b/lib/librte_mbuf/rte_mbuf.c\n@@ -324,6 +324,76 @@ rte_pktmbuf_linearize(struct rte_mbuf *mbuf)\n \treturn 0;\n }\n \n+/* Create a deep copy of mbuf */\n+struct rte_mbuf *\n+rte_pktmbuf_copy(const struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\t uint32_t off, uint32_t len)\n+{\n+\tconst struct rte_mbuf *seg = m;\n+\tstruct rte_mbuf *mc, *m_last, **prev;\n+\n+\tif (unlikely(off >= m->pkt_len))\n+\t\treturn NULL;\n+\n+\tmc = rte_pktmbuf_alloc(mp);\n+\tif (unlikely(mc == NULL))\n+\t\treturn NULL;\n+\n+\tif (len > m->pkt_len - off)\n+\t\tlen = m->pkt_len - off;\n+\n+\t/* clone meta data from original */\n+\tmc->port = m->port;\n+\tmc->vlan_tci = m->vlan_tci;\n+\tmc->vlan_tci_outer = m->vlan_tci_outer;\n+\tmc->tx_offload = m->tx_offload;\n+\tmc->hash = m->hash;\n+\tmc->packet_type = m->packet_type;\n+\tmc->timestamp = m->timestamp;\n+\n+\tprev = &mc->next;\n+\tm_last = mc;\n+\twhile (len > 0) {\n+\t\tuint32_t copy_len;\n+\n+\t\twhile (off >= seg->data_len) {\n+\t\t\toff -= seg->data_len;\n+\t\t\tseg = seg->next;\n+\t\t}\n+\n+\t\t/* current buffer is full, chain a new one */\n+\t\tif (rte_pktmbuf_tailroom(m_last) == 0) {\n+\t\t\tm_last = rte_pktmbuf_alloc(mp);\n+\t\t\tif (unlikely(m_last == NULL)) {\n+\t\t\t\trte_pktmbuf_free(mc);\n+\t\t\t\treturn NULL;\n+\t\t\t}\n+\t\t\t++mc->nb_segs;\n+\t\t\t*prev = m_last;\n+\t\t\tprev = &m_last->next;\n+\t\t}\n+\n+\t\tcopy_len = RTE_MIN(seg->data_len - off, len);\n+\t\tif (copy_len > rte_pktmbuf_tailroom(m_last))\n+\t\t\tcopy_len = rte_pktmbuf_tailroom(m_last);\n+\n+\t\t/* append from seg to m_last */\n+\t\trte_memcpy(rte_pktmbuf_mtod_offset(m_last, char *,\n+\t\t\t\t\t\t   m_last->data_len),\n+\t\t\t   rte_pktmbuf_mtod_offset(seg, char *,\n+\t\t\t\t\t\t   off),\n+\t\t\t   copy_len);\n+\n+\t\tm_last->data_len += copy_len;\n+\t\tmc->pkt_len += copy_len;\n+\t\toff += copy_len;\n+\t\tlen -= copy_len;\n+\t}\n+\n+\t__rte_mbuf_sanity_check(mc, 1);\n+\treturn mc;\n+}\n+\n /* dump a mbuf on console */\n void\n rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)\ndiff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h\nindex a6e78e4ea7a6..77266a07c75b 100644\n--- a/lib/librte_mbuf/rte_mbuf.h\n+++ b/lib/librte_mbuf/rte_mbuf.h\n@@ -1927,6 +1927,32 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)\n struct rte_mbuf *\n rte_pktmbuf_clone(struct rte_mbuf *md, struct rte_mempool *mp);\n \n+/**\n+ * Creates a full copy of a given packet mbuf.\n+ *\n+ * Copies all the data from a given packet mbuf to a newly allocated\n+ * set of mbufs.\n+ *\n+ * @param m\n+ *   The packet mbuf to be cloned.\n+ * @param mp\n+ *   The mempool from which the \"clone\" mbufs are allocated.\n+ * @param offset\n+ *   The number of bytes to skip before copying.\n+ *   If the mbuf does not have that many bytes, it is an error\n+ *   and NULL is returned.\n+ * @param length\n+ *   The upper limit on bytes to copy.  Passing UINT32_MAX\n+ *   means all data (after offset).\n+ * @return\n+ *   - The pointer to the new \"clone\" mbuf on success.\n+ *   - NULL if allocation fails.\n+ */\n+__rte_experimental\n+struct rte_mbuf *\n+rte_pktmbuf_copy(const struct rte_mbuf *m, struct rte_mempool *mp,\n+\t\t uint32_t offset, uint32_t length);\n+\n /**\n  * Adds given value to the refcnt of all packet mbuf segments.\n  *\ndiff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map\nindex 9cc43e24bfa4..3742ed114e7c 100644\n--- a/lib/librte_mbuf/rte_mbuf_version.map\n+++ b/lib/librte_mbuf/rte_mbuf_version.map\n@@ -57,4 +57,5 @@ EXPERIMENTAL {\n \tglobal:\n \n \trte_mbuf_check;\n+\trte_pktmbuf_copy;\n } DPDK_18.08;\n",
    "prefixes": [
        "4/5"
    ]
}