get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 27874,
    "url": "https://patches.dpdk.org/api/patches/27874/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1503584144-63181-2-git-send-email-jiayu.hu@intel.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": "<1503584144-63181-2-git-send-email-jiayu.hu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1503584144-63181-2-git-send-email-jiayu.hu@intel.com",
    "date": "2017-08-24T14:15:40",
    "name": "[dpdk-dev,1/5] lib: add Generic Segmentation Offload API framework",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ae61682b6c6f331bad139b32dab8ae8a01b561ca",
    "submitter": {
        "id": 539,
        "url": "https://patches.dpdk.org/api/people/539/?format=api",
        "name": "Hu, Jiayu",
        "email": "jiayu.hu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1503584144-63181-2-git-send-email-jiayu.hu@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/27874/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/27874/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 C76717D3E;\n\tThu, 24 Aug 2017 16:13:43 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 3CD5D7D0B\n\tfor <dev@dpdk.org>; Thu, 24 Aug 2017 16:13:40 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Aug 2017 07:13:39 -0700",
            "from dpdk15.sh.intel.com ([10.67.111.77])\n\tby orsmga005.jf.intel.com with ESMTP; 24 Aug 2017 07:13:38 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,421,1498546800\"; d=\"scan'208\";a=\"141575649\"",
        "From": "Jiayu Hu <jiayu.hu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "mark.b.kavanagh@intel.com, konstantin.ananyev@intel.com,\n\tjianfeng.tan@intel.com, Jiayu Hu <jiayu.hu@intel.com>",
        "Date": "Thu, 24 Aug 2017 22:15:40 +0800",
        "Message-Id": "<1503584144-63181-2-git-send-email-jiayu.hu@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1503584144-63181-1-git-send-email-jiayu.hu@intel.com>",
        "References": "<1503584144-63181-1-git-send-email-jiayu.hu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 1/5] lib: add Generic Segmentation Offload API\n\tframework",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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": "Generic Segmentation Offload (GSO) is a SW technique to split large\npackets into small ones. Akin to TSO, GSO enables applications to\noperate on large packets, thus reducing per-packet processing overhead.\n\nTo enable more flexibility to applications, DPDK GSO is implemented\nas a standalone library. Applications explicitly use the GSO library\nto segment packets. This patch introduces the GSO API framework to DPDK.\n\nThe GSO library provides a segmentation API, rte_gso_segment(), for\napplications. It splits an input packet into small ones in each\ninvocation. The GSO library refers to these small packets generated\nby rte_gso_segment() as GSO segments. When all GSO segments are freed,\nthe input packet is freed automatically.\n\nSigned-off-by: Jiayu Hu <jiayu.hu@intel.com>\nSigned-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>\n---\n config/common_base                 |   5 ++\n lib/Makefile                       |   2 +\n lib/librte_gso/Makefile            |  49 ++++++++++++++++\n lib/librte_gso/rte_gso.c           |  47 ++++++++++++++++\n lib/librte_gso/rte_gso.h           | 111 +++++++++++++++++++++++++++++++++++++\n lib/librte_gso/rte_gso_version.map |   7 +++\n mk/rte.app.mk                      |   1 +\n 7 files changed, 222 insertions(+)\n create mode 100644 lib/librte_gso/Makefile\n create mode 100644 lib/librte_gso/rte_gso.c\n create mode 100644 lib/librte_gso/rte_gso.h\n create mode 100644 lib/librte_gso/rte_gso_version.map",
    "diff": "diff --git a/config/common_base b/config/common_base\nindex 5e97a08..603e340 100644\n--- a/config/common_base\n+++ b/config/common_base\n@@ -652,6 +652,11 @@ CONFIG_RTE_LIBRTE_IP_FRAG_TBL_STAT=n\n CONFIG_RTE_LIBRTE_GRO=y\n \n #\n+# Compile GSO library\n+#\n+CONFIG_RTE_LIBRTE_GSO=y\n+\n+#\n # Compile librte_meter\n #\n CONFIG_RTE_LIBRTE_METER=y\ndiff --git a/lib/Makefile b/lib/Makefile\nindex 86caba1..3d123f4 100644\n--- a/lib/Makefile\n+++ b/lib/Makefile\n@@ -108,6 +108,8 @@ DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder\n DEPDIRS-librte_reorder := librte_eal librte_mempool librte_mbuf\n DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump\n DEPDIRS-librte_pdump := librte_eal librte_mempool librte_mbuf librte_ether\n+DIRS-$(CONFIG_RTE_LIBRTE_GSO) += librte_gso\n+DEPDIRS-librte_gso := librte_eal librte_mbuf librte_ether librte_net\n \n ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)\n DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni\ndiff --git a/lib/librte_gso/Makefile b/lib/librte_gso/Makefile\nnew file mode 100644\nindex 0000000..aeaacbc\n--- /dev/null\n+++ b/lib/librte_gso/Makefile\n@@ -0,0 +1,49 @@\n+#   BSD LICENSE\n+#\n+#   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+#   All rights reserved.\n+#\n+#   Redistribution and use in source and binary forms, with or without\n+#   modification, are permitted provided that the following conditions\n+#   are met:\n+#\n+#     * Redistributions of source code must retain the above copyright\n+#       notice, this list of conditions and the following disclaimer.\n+#     * Redistributions in binary form must reproduce the above copyright\n+#       notice, this list of conditions and the following disclaimer in\n+#       the documentation and/or other materials provided with the\n+#       distribution.\n+#     * Neither the name of Intel Corporation nor the names of its\n+#       contributors may be used to endorse or promote products derived\n+#       from this software without specific prior written permission.\n+#\n+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+#   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+\n+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+# library name\n+LIB = librte_gso.a\n+\n+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3\n+\n+EXPORT_MAP := rte_gso_version.map\n+\n+LIBABIVER := 1\n+\n+#source files\n+SRCS-$(CONFIG_RTE_LIBRTE_GSO) += rte_gso.c\n+\n+# install this header file\n+SYMLINK-$(CONFIG_RTE_LIBRTE_GSO)-include += rte_gso.h\n+\n+include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c\nnew file mode 100644\nindex 0000000..b81afce\n--- /dev/null\n+++ b/lib/librte_gso/rte_gso.c\n@@ -0,0 +1,47 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include \"rte_gso.h\"\n+\n+int\n+rte_gso_segment(struct rte_mbuf *pkt,\n+\t\tstruct rte_gso_ctx gso_ctx,\n+\t\tstruct rte_mbuf **pkts_out,\n+\t\tuint16_t nb_pkts_out __rte_unused)\n+{\n+\tif (pkt == NULL || pkts_out == NULL || gso_ctx.direct_pool ==\n+\t\t\tNULL || gso_ctx.indirect_pool == NULL)\n+\t\treturn -EINVAL;\n+\n+\treturn 1;\n+}\ndiff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h\nnew file mode 100644\nindex 0000000..5a8389a\n--- /dev/null\n+++ b/lib/librte_gso/rte_gso.h\n@@ -0,0 +1,111 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_GSO_H_\n+#define _RTE_GSO_H_\n+\n+/**\n+ * @file\n+ * Interface to GSO library\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <stdint.h>\n+#include <rte_mbuf.h>\n+\n+/**\n+ * GSO context structure.\n+ */\n+struct rte_gso_ctx {\n+\tstruct rte_mempool *direct_pool;\n+\t/**< MBUF pool for allocating direct buffers, which are used\n+\t * to store packet headers for GSO segments.\n+\t */\n+\tstruct rte_mempool *indirect_pool;\n+\t/**< MBUF pool for allocating indirect buffers, which are used\n+\t * to locate packet payloads for GSO segments. The indirect\n+\t * buffer doesn't contain any data, but simply points to an\n+\t * offset within the packet to segment.\n+\t */\n+\tuint64_t gso_types;\n+\t/**< GSO types to perform */\n+\tuint16_t gso_size;\n+\t/**< maximum size of a GSO segment, measured in bytes */\n+};\n+\n+/**\n+ * Segmentation function, which supports processing of both single- and\n+ * multi- segment packets. rte_gso_segment() assumes the input packet\n+ * has correct checksums, and it doesn't process IP fragment packets.\n+ * Additionally, it assumes that 'pkts_out' is large enough to hold all GSO\n+ * segments.\n+ *\n+ * We refer to the packets that are segmented from the input packet as 'GSO\n+ * segments'. If the input packet is GSOed, its mbuf refcnt reduces by 1.\n+ * Therefore, when all GSO segments are freed, the input packet is freed\n+ * automatically. If the input packet doesn't match the criteria for GSO\n+ * (e.g. 'pkt's length is small and doesn't need segmentation), the packet\n+ * is skipped and this function returns 1. If the available memory space\n+ * in MBUF pools is insufficient, the packet is skipped and return -ENOMEM.\n+ *\n+ * @param pkt\n+ *  The packet mbuf to segment.\n+ * @param ctx\n+ *  GSO context object.\n+ * @param pkts_out\n+ *  Pointer array used to stores the mbuf addresses of GSO segments.\n+ *  Applications must ensure pkts_out is large enough to hold all GSO\n+ *  segments. If the memory space in pkts_out is insufficient, the input\n+ *  packet is skipped and return -EINVAL.\n+ * @param nb_pkts_out\n+ *  The max number of items that pkts_out can keep.\n+ *\n+ * @return\n+ *  - The number of GSO segments created on success.\n+ *  - Return 1 if no GSO is performed.\n+ *  - Return -ENOMEM if run out of memory in MBUF pools.\n+ *  - Return -EINVAL for invalid parameters.\n+ */\n+int rte_gso_segment(struct rte_mbuf *pkt,\n+\t\tstruct rte_gso_ctx ctx,\n+\t\tstruct rte_mbuf **pkts_out,\n+\t\tuint16_t nb_pkts_out);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_GSO_H_ */\ndiff --git a/lib/librte_gso/rte_gso_version.map b/lib/librte_gso/rte_gso_version.map\nnew file mode 100644\nindex 0000000..e1fd453\n--- /dev/null\n+++ b/lib/librte_gso/rte_gso_version.map\n@@ -0,0 +1,7 @@\n+DPDK_17.11 {\n+\tglobal:\n+\n+\trte_gso_segment;\n+\n+\tlocal: *;\n+};\ndiff --git a/mk/rte.app.mk b/mk/rte.app.mk\nindex c25fdd9..d4c9873 100644\n--- a/mk/rte.app.mk\n+++ b/mk/rte.app.mk\n@@ -66,6 +66,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PDUMP)          += -lrte_pdump\n _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)    += -lrte_distributor\n _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)        += -lrte_ip_frag\n _LDLIBS-$(CONFIG_RTE_LIBRTE_GRO)            += -lrte_gro\n+_LDLIBS-$(CONFIG_RTE_LIBRTE_GSO)            += -lrte_gso\n _LDLIBS-$(CONFIG_RTE_LIBRTE_METER)          += -lrte_meter\n _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)          += -lrte_sched\n _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)            += -lrte_lpm\n",
    "prefixes": [
        "dpdk-dev",
        "1/5"
    ]
}