Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/28340/?format=api
http://patches.dpdk.org/api/patches/28340/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1504598270-60080-2-git-send-email-jiayu.hu@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": "<1504598270-60080-2-git-send-email-jiayu.hu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1504598270-60080-2-git-send-email-jiayu.hu@intel.com", "date": "2017-09-05T07:57:46", "name": "[dpdk-dev,v2,1/5] gso: add Generic Segmentation Offload API framework", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8ef08c37a4af20c13a8a0428b32bcb502de3737a", "submitter": { "id": 539, "url": "http://patches.dpdk.org/api/people/539/?format=api", "name": "Hu, Jiayu", "email": "jiayu.hu@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1504598270-60080-2-git-send-email-jiayu.hu@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/28340/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/28340/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 DF86D3798;\n\tTue, 5 Sep 2017 09:55:36 +0200 (CEST)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 080623798\n\tfor <dev@dpdk.org>; Tue, 5 Sep 2017 09:55:33 +0200 (CEST)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Sep 2017 00:55:33 -0700", "from dpdk15.sh.intel.com ([10.67.111.77])\n\tby orsmga001.jf.intel.com with ESMTP; 05 Sep 2017 00:55:25 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.41,479,1498546800\"; d=\"scan'208\";\n\ta=\"1169183452\"", "From": "Jiayu Hu <jiayu.hu@intel.com>", "To": "dev@dpdk.org", "Cc": "konstantin.ananyev@intel.com, mark.b.kavanagh@intel.com,\n\tjianfeng.tan@intel.com, Jiayu Hu <jiayu.hu@intel.com>", "Date": "Tue, 5 Sep 2017 15:57:46 +0800", "Message-Id": "<1504598270-60080-2-git-send-email-jiayu.hu@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1504598270-60080-1-git-send-email-jiayu.hu@intel.com>", "References": "<1503584144-63181-1-git-send-email-jiayu.hu@intel.com>\n\t<1504598270-60080-1-git-send-email-jiayu.hu@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 1/5] gso: 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. Each of the newly-created GSO\nsegments is organized as a two-segment MBUF, where the first segment is a\nstandard MBUF, which stores a copy of packet header, and the second is an\nindirect MBUF which points to a section of data in the input packet.\nrte_gso_segment() reduces the refcnt of the input packet by 1. Therefore,\nwhen all GSO segments are freed, the input packet is freed automatically.\nAdditionally, since each GSO segment has multiple MBUFs (i.e. 2 MBUFs),\nthe driver of the interface which the GSO segments are sent to should\nsupport to transmit multi-segment packets.\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 | 48 +++++++++++++\n lib/librte_gso/rte_gso.h | 133 +++++++++++++++++++++++++++++++++++++\n lib/librte_gso/rte_gso_version.map | 7 ++\n mk/rte.app.mk | 1 +\n 7 files changed, 245 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..fef6725\n--- /dev/null\n+++ b/lib/librte_gso/rte_gso.c\n@@ -0,0 +1,48 @@\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 __rte_unused,\n+\t\tstruct rte_mbuf **pkts_out,\n+\t\tuint16_t nb_pkts_out)\n+{\n+\tif (pkt == NULL || pkts_out == NULL || nb_pkts_out < 1)\n+\t\treturn -EINVAL;\n+\n+\tpkts_out[0] = pkt;\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..eb4ac4b\n--- /dev/null\n+++ b/lib/librte_gso/rte_gso.h\n@@ -0,0 +1,133 @@\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+/* GSO IP id flags for the IPv4 header */\n+#define RTE_GSO_IPID_FIXED (1 << 0)\n+/**< Use fixed IP ids for output GSO segments */\n+#define RTE_GSO_IPID_INCREASE (1 << 1)\n+/**< Use incremental IP ids for output GSO segments */\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+\tuint32_t gso_types;\n+\t/**< packet types to perform GSO. For example, if applications\n+\t * want to segment TCP/IPv4 packets, set (RTE_PTYPE_L2_ETHER |\n+\t * RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_TCP) to gso_types.\n+\t */\n+\tuint16_t gso_size;\n+\t/**< maximum size of an output GSO segment, including packet\n+\t * header and payload, measured in bytes.\n+\t */\n+\tuint8_t ipid_flag;\n+\t/**< flag to indicate GSO uses fixed or incremental IP ids for\n+\t * IPv4 headers of output GSO segments.\n+\t */\n+};\n+\n+/**\n+ * Segmentation function, which supports processing of both single- and\n+ * multi- segment packets.\n+ *\n+ * Note that we refer to the packets that are segmented from the input\n+ * packet as 'GSO segments'. rte_gso_segment() assumes the input packet\n+ * has correct checksums, and it doesn't update checksums for output\n+ * GSO segments. Additionally, it doesn't process IP fragment packets.\n+ *\n+ * Each of the newly-created GSO segments is organized as a two-segment\n+ * MBUF, where the first segment is a standard MBUF, which stores a copy\n+ * of packet header, and the second is an indirect MBUF which points to\n+ * a section of data in the input packet. Since each GSO segment has\n+ * multiple MBUFs (i.e. 2 MBUFs), the driver of the interface which the\n+ * GSO segments are sent to should support to transmit multi-segment\n+ * packets.\n+ *\n+ * If the input packet is GSOed, its mbuf refcnt reduces by 1. Therefore,\n+ * when all GSO segments are freed, the input packet is freed automatically.\n+ *\n+ * If the memory space in pkts_out or MBUF pools is insufficient, this\n+ * function fails, and it returns (-1) * errno. Otherwise, GSO successes,\n+ * and this function returns the number of output GSO segments filled in\n+ * pkts_out.\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 store the MBUF addresses of output GSO\n+ * segments, when rte_gso_segment() successes.\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 filled in pkts_out on success.\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", "v2", "1/5" ] }{ "id": 28340, "url": "