Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/83870/?format=api
http://patches.dpdk.org/api/patches/83870/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201110022130.179352-1-yang_y_yi@163.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": "<20201110022130.179352-1-yang_y_yi@163.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20201110022130.179352-1-yang_y_yi@163.com", "date": "2020-11-10T02:21:30", "name": "[v2] gso: add VXLAN UDP GSO support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "d66b26e43e590d86dffda501c66aa4927cce8fa5", "submitter": { "id": 1806, "url": "http://patches.dpdk.org/api/people/1806/?format=api", "name": "yang_y_yi", "email": "yang_y_yi@163.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201110022130.179352-1-yang_y_yi@163.com/mbox/", "series": [ { "id": 13760, "url": "http://patches.dpdk.org/api/series/13760/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=13760", "date": "2020-11-10T02:21:30", "name": "[v2] gso: add VXLAN UDP GSO support", "version": 2, "mbox": "http://patches.dpdk.org/series/13760/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/83870/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/83870/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2B02CA052A;\n\tTue, 10 Nov 2020 03:21:42 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 040D4A8E9;\n\tTue, 10 Nov 2020 03:21:40 +0100 (CET)", "from mail-m975.mail.163.com (mail-m975.mail.163.com [123.126.97.5])\n by dpdk.org (Postfix) with ESMTP id 234FF5B3A\n for <dev@dpdk.org>; Tue, 10 Nov 2020 03:21:37 +0100 (CET)", "from yangyi0100.home.langchao.com (unknown [111.207.123.58])\n by smtp5 (Coremail) with SMTP id HdxpCgB3yrkq+alfzLjVBA--.7412S2;\n Tue, 10 Nov 2020 10:21:32 +0800 (CST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;\n s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=h0hJb\n XS/5M/+D1lTA7+ohUCOZ5TfpMHdFsEq7VUtQO0=; b=HU94ENV9XLMDNU5Gyfu9G\n vcNn2fPXOtrz3JJNzwb2v0ABngA1HUd8TZwRxNPKZqKYNLmTLvN1MYrKSckZg1BC\n +SAo9oGfCRjm5OgzDW/ztiv++S2snNc+PXKQsGMS3ILoTfUQwYUvO55PnlEXGJjM\n 8cr6LU8o15rQS1+mPEmzEk=", "From": "yang_y_yi@163.com", "To": "dev@dpdk.org", "Cc": "jiayu.hu@intel.com, konstantin.ananyev@intel.com, thomas@monjalon.net,\n yangyi01@inspur.com, yang_y_yi@163.com", "Date": "Tue, 10 Nov 2020 10:21:30 +0800", "Message-Id": "<20201110022130.179352-1-yang_y_yi@163.com>", "X-Mailer": "git-send-email 2.19.2.windows.1", "In-Reply-To": "<20200701064643.216084-1-yang_y_yi@163.com>", "References": "<20200701064643.216084-1-yang_y_yi@163.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-CM-TRANSID": "HdxpCgB3yrkq+alfzLjVBA--.7412S2", "X-Coremail-Antispam": "1Uf129KBjvJXoWxtF4UXrW3uF47CFykuw17Wrg_yoWDGw4xpF\n sxKr4ftrsxJF1xZr4DX3W5Xrs3ua95Ka17C3ykKryxXws7Ww10qay0gFy2kry3XrZ5Aw4I\n vFs0qay5CF1xCaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRrWrAUUUUU=", "X-Originating-IP": "[111.207.123.58]", "X-CM-SenderInfo": "51dqwsp1b1xqqrwthudrp/1tbiTAzYi1SIljjukQAAse", "Subject": "[dpdk-dev] [PATCH v2] gso: add VXLAN UDP GSO support", "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Yi Yang <yangyi01@inspur.com>\n\nMany NICs can't offload VXLAN UFO, so it is very important\nto do VXLAN UDP GSO by software to improve VM-to-VM UDP\nperformance, especially for the case that VM MTU is just\n1500 but not 9000.\n\nWith this enabled in DPDK, OVS DPDK can leverage it to\nimprove VM-to-VM UDP performance, performance gain is very\nhuge, over 2 times.\n\nSigned-off-by: Yi Yang <yangyi01@inspur.com>\n---\nChangelog:\n\nv1 -> v2:\n - Remove condition check for outer udp header because it\n is always true for VXLAN.\n - Remove inner udp header update because it is wrong and\n unnecessary.\n\n---\n .../generic_segmentation_offload_lib.rst | 14 ++--\n doc/guides/rel_notes/release_20_11.rst | 4 +\n lib/librte_gso/gso_common.h | 5 ++\n lib/librte_gso/gso_tunnel_udp4.c | 97 ++++++++++++++++++++++\n lib/librte_gso/gso_tunnel_udp4.h | 44 ++++++++++\n lib/librte_gso/meson.build | 2 +-\n lib/librte_gso/rte_gso.c | 8 ++\n 7 files changed, 166 insertions(+), 8 deletions(-)\n create mode 100644 lib/librte_gso/gso_tunnel_udp4.c\n create mode 100644 lib/librte_gso/gso_tunnel_udp4.h", "diff": "diff --git a/doc/guides/prog_guide/generic_segmentation_offload_lib.rst b/doc/guides/prog_guide/generic_segmentation_offload_lib.rst\nindex ad91c6e..c1d06e1 100644\n--- a/doc/guides/prog_guide/generic_segmentation_offload_lib.rst\n+++ b/doc/guides/prog_guide/generic_segmentation_offload_lib.rst\n@@ -46,7 +46,7 @@ Limitations\n - TCP\n - UDP\n - VxLAN\n- - GRE\n+ - GRE TCP\n \n See `Supported GSO Packet Types`_ for further details.\n \n@@ -157,14 +157,14 @@ does not modify it during segmentation. Therefore, after UDP GSO, only the\n first output packet has the original UDP header, and others just have l2\n and l3 headers.\n \n-VxLAN GSO\n-~~~~~~~~~\n+VxLAN IPv4 GSO\n+~~~~~~~~~~~~~~\n VxLAN packets GSO supports segmentation of suitably large VxLAN packets,\n-which contain an outer IPv4 header, inner TCP/IPv4 headers, and optional\n-inner and/or outer VLAN tag(s).\n+which contain an outer IPv4 header, inner TCP/IPv4 or UDP/IPv4 headers, and\n+optional inner and/or outer VLAN tag(s).\n \n-GRE GSO\n-~~~~~~~\n+GRE TCP/IPv4 GSO\n+~~~~~~~~~~~~~~~~\n GRE GSO supports segmentation of suitably large GRE packets, which contain\n an outer IPv4 header, inner TCP/IPv4 headers, and an optional VLAN tag.\n \ndiff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst\nindex 6bbd6ee..bb01738 100644\n--- a/doc/guides/rel_notes/release_20_11.rst\n+++ b/doc/guides/rel_notes/release_20_11.rst\n@@ -420,6 +420,10 @@ New Features\n leverage IOAT DMA channel with vhost asynchronous APIs.\n See the :doc:`../sample_app_ug/vhost` for more details.\n \n+* **Added VxLAN UDP/IPv4 GSO support.**\n+\n+ Added inner UDP/IPv4 support for VxLAN IPv4 GSO.\n+\n \n Removed Items\n -------------\ndiff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h\nindex a0b8343..4d5f303 100644\n--- a/lib/librte_gso/gso_common.h\n+++ b/lib/librte_gso/gso_common.h\n@@ -26,6 +26,11 @@\n \t\t(PKT_TX_TCP_SEG | PKT_TX_IPV4 | PKT_TX_OUTER_IPV4 | \\\n \t\t PKT_TX_TUNNEL_VXLAN))\n \n+#define IS_IPV4_VXLAN_UDP4(flag) (((flag) & (PKT_TX_UDP_SEG | PKT_TX_IPV4 | \\\n+\t\t\t\tPKT_TX_OUTER_IPV4 | PKT_TX_TUNNEL_MASK)) == \\\n+\t\t(PKT_TX_UDP_SEG | PKT_TX_IPV4 | PKT_TX_OUTER_IPV4 | \\\n+\t\t PKT_TX_TUNNEL_VXLAN))\n+\n #define IS_IPV4_GRE_TCP4(flag) (((flag) & (PKT_TX_TCP_SEG | PKT_TX_IPV4 | \\\n \t\t\t\tPKT_TX_OUTER_IPV4 | PKT_TX_TUNNEL_MASK)) == \\\n \t\t(PKT_TX_TCP_SEG | PKT_TX_IPV4 | PKT_TX_OUTER_IPV4 | \\\ndiff --git a/lib/librte_gso/gso_tunnel_udp4.c b/lib/librte_gso/gso_tunnel_udp4.c\nnew file mode 100644\nindex 0000000..1fc7a8d\n--- /dev/null\n+++ b/lib/librte_gso/gso_tunnel_udp4.c\n@@ -0,0 +1,97 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Inspur Corporation\n+ */\n+\n+#include \"gso_common.h\"\n+#include \"gso_tunnel_udp4.h\"\n+\n+#define IPV4_HDR_MF_BIT (1U << 13)\n+\n+static void\n+update_tunnel_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs,\n+\t\t\t uint16_t nb_segs)\n+{\n+\tstruct rte_ipv4_hdr *ipv4_hdr;\n+\tuint16_t outer_id, inner_id, tail_idx, i, length;\n+\tuint16_t outer_ipv4_offset, inner_ipv4_offset;\n+\tuint16_t outer_udp_offset;\n+\tuint16_t frag_offset = 0, is_mf;\n+\n+\touter_ipv4_offset = pkt->outer_l2_len;\n+\touter_udp_offset = outer_ipv4_offset + pkt->outer_l3_len;\n+\tinner_ipv4_offset = outer_udp_offset + pkt->l2_len;\n+\n+\t/* Outer IPv4 header. */\n+\tipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +\n+\t\t\touter_ipv4_offset);\n+\touter_id = rte_be_to_cpu_16(ipv4_hdr->packet_id);\n+\n+\t/* Inner IPv4 header. */\n+\tipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +\n+\t\t\tinner_ipv4_offset);\n+\tinner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id);\n+\n+\ttail_idx = nb_segs - 1;\n+\n+\tfor (i = 0; i < nb_segs; i++) {\n+\t\tupdate_ipv4_header(segs[i], outer_ipv4_offset, outer_id);\n+\t\tupdate_udp_header(segs[i], outer_udp_offset);\n+\t\tupdate_ipv4_header(segs[i], inner_ipv4_offset, inner_id);\n+\t\t/* For the case inner packet is UDP, we must keep UDP\n+\t\t * datagram boundary, it must be handled as IP fragment.\n+\t\t *\n+\t\t * Set IP fragment offset for inner IP header.\n+\t\t */\n+\t\tipv4_hdr = (struct rte_ipv4_hdr *)\n+\t\t\t(rte_pktmbuf_mtod(segs[i], char *) +\n+\t\t\t\tinner_ipv4_offset);\n+\t\tis_mf = i < tail_idx ? IPV4_HDR_MF_BIT : 0;\n+\t\tipv4_hdr->fragment_offset =\n+\t\t\trte_cpu_to_be_16(frag_offset | is_mf);\n+\t\tlength = segs[i]->pkt_len - inner_ipv4_offset - pkt->l3_len;\n+\t\tfrag_offset += (length >> 3);\n+\t\touter_id++;\n+\t}\n+}\n+\n+int\n+gso_tunnel_udp4_segment(struct rte_mbuf *pkt,\n+\t\tuint16_t gso_size,\n+\t\tstruct rte_mempool *direct_pool,\n+\t\tstruct rte_mempool *indirect_pool,\n+\t\tstruct rte_mbuf **pkts_out,\n+\t\tuint16_t nb_pkts_out)\n+{\n+\tstruct rte_ipv4_hdr *inner_ipv4_hdr;\n+\tuint16_t pyld_unit_size, hdr_offset, frag_off;\n+\tint ret;\n+\n+\thdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len;\n+\tinner_ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) +\n+\t\t\thdr_offset);\n+\t/*\n+\t * Don't process the packet whose MF bit or offset in the inner\n+\t * IPv4 header are non-zero.\n+\t */\n+\tfrag_off = rte_be_to_cpu_16(inner_ipv4_hdr->fragment_offset);\n+\tif (unlikely(IS_FRAGMENTED(frag_off)))\n+\t\treturn 0;\n+\n+\thdr_offset += pkt->l3_len;\n+\t/* Don't process the packet without data */\n+\tif ((hdr_offset + pkt->l4_len) >= pkt->pkt_len)\n+\t\treturn 0;\n+\n+\t/* pyld_unit_size must be a multiple of 8 because frag_off\n+\t * uses 8 bytes as unit.\n+\t */\n+\tpyld_unit_size = (gso_size - hdr_offset) & ~7U;\n+\n+\t/* Segment the payload */\n+\tret = gso_do_segment(pkt, hdr_offset, pyld_unit_size, direct_pool,\n+\t\t\tindirect_pool, pkts_out, nb_pkts_out);\n+\tif (ret > 1)\n+\t\tupdate_tunnel_ipv4_udp_headers(pkt, pkts_out, ret);\n+\n+\treturn ret;\n+}\ndiff --git a/lib/librte_gso/gso_tunnel_udp4.h b/lib/librte_gso/gso_tunnel_udp4.h\nnew file mode 100644\nindex 0000000..c49b43f\n--- /dev/null\n+++ b/lib/librte_gso/gso_tunnel_udp4.h\n@@ -0,0 +1,44 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Inspur Corporation\n+ */\n+\n+#ifndef _GSO_TUNNEL_UDP4_H_\n+#define _GSO_TUNNEL_UDP4_H_\n+\n+#include <stdint.h>\n+#include <rte_mbuf.h>\n+\n+/**\n+ * Segment a tunneling packet with inner UDP/IPv4 headers. This function\n+ * does not check if the input packet has correct checksums, and does not\n+ * update checksums for output GSO segments. Furthermore, it does not\n+ * process IP fragment packets.\n+ *\n+ * @param pkt\n+ * The packet mbuf to segment.\n+ * @param gso_size\n+ * The max length of a GSO segment, measured in bytes.\n+ * @param direct_pool\n+ * MBUF pool used for allocating direct buffers for output segments.\n+ * @param indirect_pool\n+ * MBUF pool used for allocating indirect buffers for output segments.\n+ * @param pkts_out\n+ * Pointer array used to store the MBUF addresses of output GSO\n+ * segments, when it succeeds. If the memory space in pkts_out is\n+ * insufficient, it fails and returns -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 filled in pkts_out on success.\n+ * - Return 0 if it needn't GSO.\n+ * - Return -ENOMEM if run out of memory in MBUF pools.\n+ * - Return -EINVAL for invalid parameters.\n+ */\n+int gso_tunnel_udp4_segment(struct rte_mbuf *pkt,\n+\t\tuint16_t gso_size,\n+\t\tstruct rte_mempool *direct_pool,\n+\t\tstruct rte_mempool *indirect_pool,\n+\t\tstruct rte_mbuf **pkts_out,\n+\t\tuint16_t nb_pkts_out);\n+#endif\ndiff --git a/lib/librte_gso/meson.build b/lib/librte_gso/meson.build\nindex ad8dd85..05904f2 100644\n--- a/lib/librte_gso/meson.build\n+++ b/lib/librte_gso/meson.build\n@@ -2,6 +2,6 @@\n # Copyright(c) 2017 Intel Corporation\n \n sources = files('gso_common.c', 'gso_tcp4.c', 'gso_udp4.c',\n- \t\t'gso_tunnel_tcp4.c', 'rte_gso.c')\n+\t\t'gso_tunnel_tcp4.c', 'gso_tunnel_udp4.c', 'rte_gso.c')\n headers = files('rte_gso.h')\n deps += ['ethdev']\ndiff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c\nindex 896350e..fb76a21 100644\n--- a/lib/librte_gso/rte_gso.c\n+++ b/lib/librte_gso/rte_gso.c\n@@ -11,6 +11,7 @@\n #include \"gso_common.h\"\n #include \"gso_tcp4.h\"\n #include \"gso_tunnel_tcp4.h\"\n+#include \"gso_tunnel_udp4.h\"\n #include \"gso_udp4.h\"\n \n #define ILLEGAL_UDP_GSO_CTX(ctx) \\\n@@ -60,6 +61,13 @@\n \t\tret = gso_tunnel_tcp4_segment(pkt, gso_size, ipid_delta,\n \t\t\t\tdirect_pool, indirect_pool,\n \t\t\t\tpkts_out, nb_pkts_out);\n+\t} else if (IS_IPV4_VXLAN_UDP4(pkt->ol_flags) &&\n+\t\t\t(gso_ctx->gso_types & (DEV_TX_OFFLOAD_VXLAN_TNL_TSO |\n+\t\t\t\t\t DEV_TX_OFFLOAD_UDP_TSO))) {\n+\t\tpkt->ol_flags &= (~PKT_TX_UDP_SEG);\n+\t\tret = gso_tunnel_udp4_segment(pkt, gso_size,\n+\t\t\t\tdirect_pool, indirect_pool,\n+\t\t\t\tpkts_out, nb_pkts_out);\n \t} else if (IS_IPV4_TCP(pkt->ol_flags) &&\n \t\t\t(gso_ctx->gso_types & DEV_TX_OFFLOAD_TCP_TSO)) {\n \t\tpkt->ol_flags &= (~PKT_TX_TCP_SEG);\n", "prefixes": [ "v2" ] }{ "id": 83870, "url": "