From: Mark Kavanagh <mark.b.kavanagh@intel.com>
To: dev@dpdk.org
Cc: jiayu.hu@intel.com, jianfeng.tan@intel.com,
konstantin.ananyev@intel.com, ferruh.yigit@intel.com,
thomas@monjalon.net, Mark Kavanagh <mark.b.kavanagh@intel.com>
Subject: [dpdk-dev] [PATCH v5 4/6] gso: add GRE GSO support
Date: Thu, 28 Sep 2017 23:13:51 +0100 [thread overview]
Message-ID: <1506636833-25851-5-git-send-email-mark.b.kavanagh@intel.com> (raw)
In-Reply-To: <1505806379-71355-1-git-send-email-jiayu.hu@intel.com>
This patch adds GSO support for GRE-tunneled packets. Supported GRE
packets must contain an outer IPv4 header, and inner TCP/IPv4 headers.
They may also contain a single VLAN tag. GRE GSO doesn't check if all
input packets have correct checksums and doesn't update checksums for
output packets. Additionally, it doesn't process IP fragmented packets.
As with VxLAN GSO, GRE GSO uses a two-segment MBUF to organize each
output packet, which requires multi-segment mbuf support in the TX
functions of the NIC driver. Also, if a packet is GSOed, GRE GSO reduces
its MBUF refcnt by 1. As a result, when all of its GSOed segments are
freed, the packet is freed automatically.
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
doc/guides/rel_notes/release_17_11.rst | 3 +++
lib/librte_gso/gso_common.h | 5 +++++
lib/librte_gso/gso_tunnel_tcp4.c | 14 ++++++++++----
lib/librte_gso/rte_gso.c | 8 +++++---
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst
index 25b8a78..808f537 100644
--- a/doc/guides/rel_notes/release_17_11.rst
+++ b/doc/guides/rel_notes/release_17_11.rst
@@ -51,6 +51,9 @@ New Features
* VxLAN packets, which must have an outer IPv4 header (prepended by
an optional VLAN tag), and contain an inner TCP/IPv4 packet (with
an optional VLAN tag).
+ * GRE packets, which must contain an outer IPv4 header (prepended by
+ an optional VLAN tag), and inner TCP/IPv4 headers (with an optional
+ VLAN tag).
The GSO library doesn't check if the input packets have correct
checksums, and doesn't update checksums for output packets.
diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h
index c051295..1e99cc0 100644
--- a/lib/librte_gso/gso_common.h
+++ b/lib/librte_gso/gso_common.h
@@ -55,6 +55,11 @@
(PKT_TX_TCP_SEG | PKT_TX_IPV4 | PKT_TX_OUTER_IPV4 | \
PKT_TX_TUNNEL_VXLAN))
+#define IS_IPV4_GRE_TCP4(flag) (((flag) & (PKT_TX_TCP_SEG | PKT_TX_IPV4 | \
+ PKT_TX_OUTER_IPV4 | PKT_TX_TUNNEL_GRE)) == \
+ (PKT_TX_TCP_SEG | PKT_TX_IPV4 | PKT_TX_OUTER_IPV4 | \
+ PKT_TX_TUNNEL_GRE))
+
/**
* Internal function which updates the UDP header of a packet, following
* segmentation. This is required to update the header's datagram length field.
diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c
index 34bbbd7..d79fc6b 100644
--- a/lib/librte_gso/gso_tunnel_tcp4.c
+++ b/lib/librte_gso/gso_tunnel_tcp4.c
@@ -42,11 +42,13 @@
struct tcp_hdr *tcp_hdr;
uint32_t sent_seq;
uint16_t outer_id, inner_id, tail_idx, i;
- uint16_t outer_ipv4_offset, inner_ipv4_offset, udp_offset, tcp_offset;
+ uint16_t outer_ipv4_offset, inner_ipv4_offset;
+ uint16_t udp_gre_offset, tcp_offset;
+ uint8_t update_udp_hdr;
outer_ipv4_offset = pkt->outer_l2_len;
- udp_offset = outer_ipv4_offset + pkt->outer_l3_len;
- inner_ipv4_offset = udp_offset + pkt->l2_len;
+ udp_gre_offset = outer_ipv4_offset + pkt->outer_l3_len;
+ inner_ipv4_offset = udp_gre_offset + pkt->l2_len;
tcp_offset = inner_ipv4_offset + pkt->l3_len;
/* Outer IPv4 header. */
@@ -63,9 +65,13 @@
sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq);
tail_idx = nb_segs - 1;
+ /* Only update UDP header for VxLAN packets. */
+ update_udp_hdr = (pkt->ol_flags & PKT_TX_TUNNEL_VXLAN) ? 1 : 0;
+
for (i = 0; i < nb_segs; i++) {
update_ipv4_header(segs[i], outer_ipv4_offset, outer_id);
- update_udp_header(segs[i], udp_offset);
+ if (update_udp_hdr)
+ update_udp_header(segs[i], udp_gre_offset);
update_ipv4_header(segs[i], inner_ipv4_offset, inner_id);
update_tcp_header(segs[i], tcp_offset, sent_seq, i < tail_idx);
outer_id++;
diff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c
index 6095689..b748ab1 100644
--- a/lib/librte_gso/rte_gso.c
+++ b/lib/librte_gso/rte_gso.c
@@ -60,8 +60,9 @@
if ((gso_ctx->gso_size >= pkt->pkt_len) || (gso_ctx->gso_types &
(DEV_TX_OFFLOAD_TCP_TSO |
- DEV_TX_OFFLOAD_VXLAN_TNL_TSO)) !=
- gso_ctx->gso_types) {
+ DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+ DEV_TX_OFFLOAD_GRE_TNL_TSO)) !=
+ gso_ctx->gso_types) {
pkt->ol_flags &= (~PKT_TX_TCP_SEG);
pkts_out[0] = pkt;
return 1;
@@ -73,7 +74,8 @@
ipid_delta = (gso_ctx->ipid_flag != RTE_GSO_IPID_FIXED);
ol_flags = pkt->ol_flags;
- if (IS_IPV4_VXLAN_TCP4(pkt->ol_flags)) {
+ if (IS_IPV4_VXLAN_TCP4(pkt->ol_flags) ||
+ IS_IPV4_GRE_TCP4(pkt->ol_flags)) {
pkt->ol_flags &= (~PKT_TX_TCP_SEG);
ret = gso_tunnel_tcp4_segment(pkt, gso_size, ipid_delta,
direct_pool, indirect_pool,
--
1.9.3
next prev parent reply other threads:[~2017-09-28 22:14 UTC|newest]
Thread overview: 157+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 14:15 [dpdk-dev] [PATCH 0/5] Support TCP/IPv4, VxLAN and GRE GSO in DPDK Jiayu Hu
2017-08-24 14:15 ` [dpdk-dev] [PATCH 1/5] lib: add Generic Segmentation Offload API framework Jiayu Hu
2017-08-30 1:38 ` Ananyev, Konstantin
2017-08-30 7:57 ` Jiayu Hu
2017-08-24 14:15 ` [dpdk-dev] [PATCH 2/5] gso/lib: add TCP/IPv4 GSO support Jiayu Hu
2017-08-30 1:38 ` Ananyev, Konstantin
2017-08-30 2:55 ` Jiayu Hu
2017-08-30 9:25 ` Kavanagh, Mark B
2017-08-30 9:39 ` Ananyev, Konstantin
2017-08-30 9:59 ` Ananyev, Konstantin
2017-08-30 13:27 ` Kavanagh, Mark B
2017-08-30 9:03 ` Jiayu Hu
2017-09-04 3:31 ` Jiayu Hu
2017-09-04 9:54 ` Ananyev, Konstantin
2017-09-05 1:09 ` Hu, Jiayu
2017-09-11 13:04 ` Ananyev, Konstantin
2017-08-24 14:15 ` [dpdk-dev] [PATCH 3/5] lib/gso: add VxLAN " Jiayu Hu
2017-08-24 14:15 ` [dpdk-dev] [PATCH 4/5] lib/gso: add GRE " Jiayu Hu
2017-08-24 14:15 ` [dpdk-dev] [PATCH 5/5] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Jiayu Hu
2017-08-30 1:37 ` [dpdk-dev] [PATCH 0/5] Support TCP/IPv4, VxLAN and GRE GSO in DPDK Ananyev, Konstantin
2017-08-30 7:36 ` Jiayu Hu
2017-08-30 10:49 ` Ananyev, Konstantin
2017-08-30 13:32 ` Kavanagh, Mark B
2017-09-05 7:57 ` [dpdk-dev] [PATCH v2 " Jiayu Hu
2017-09-05 7:57 ` [dpdk-dev] [PATCH v2 1/5] gso: add Generic Segmentation Offload API framework Jiayu Hu
2017-09-05 7:57 ` [dpdk-dev] [PATCH v2 2/5] gso: add TCP/IPv4 GSO support Jiayu Hu
2017-09-05 7:57 ` [dpdk-dev] [PATCH v2 3/5] gso: add VxLAN " Jiayu Hu
2017-09-05 7:57 ` [dpdk-dev] [PATCH v2 4/5] gso: add GRE " Jiayu Hu
2017-09-05 7:57 ` [dpdk-dev] [PATCH v2 5/5] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Jiayu Hu
2017-09-12 2:43 ` [dpdk-dev] [PATCH v3 0/5] Support TCP/IPv4, VxLAN and GRE GSO in DPDK Jiayu Hu
2017-09-12 2:43 ` [dpdk-dev] [PATCH v3 1/5] gso: add Generic Segmentation Offload API framework Jiayu Hu
2017-09-12 10:36 ` Ananyev, Konstantin
2017-09-13 2:11 ` Jiayu Hu
2017-09-14 18:33 ` Ferruh Yigit
2017-09-15 1:12 ` Hu, Jiayu
2017-09-12 2:43 ` [dpdk-dev] [PATCH v3 2/5] gso: add TCP/IPv4 GSO support Jiayu Hu
2017-09-12 11:17 ` Ananyev, Konstantin
2017-09-13 2:48 ` Jiayu Hu
2017-09-13 9:38 ` Ananyev, Konstantin
2017-09-13 10:23 ` Hu, Jiayu
2017-09-13 14:52 ` Kavanagh, Mark B
2017-09-13 15:13 ` Ananyev, Konstantin
2017-09-14 0:59 ` Hu, Jiayu
2017-09-14 8:35 ` Kavanagh, Mark B
2017-09-14 8:39 ` Ananyev, Konstantin
2017-09-14 9:00 ` Kavanagh, Mark B
2017-09-14 9:10 ` Ananyev, Konstantin
2017-09-14 9:35 ` Kavanagh, Mark B
2017-09-12 14:17 ` Ananyev, Konstantin
2017-09-13 10:44 ` Jiayu Hu
2017-09-13 22:10 ` Ananyev, Konstantin
2017-09-14 6:07 ` Jiayu Hu
2017-09-14 8:47 ` Ananyev, Konstantin
2017-09-14 9:29 ` Hu, Jiayu
2017-09-14 9:35 ` Ananyev, Konstantin
2017-09-14 10:01 ` Hu, Jiayu
2017-09-14 15:42 ` Kavanagh, Mark B
2017-09-14 18:38 ` Ananyev, Konstantin
2017-09-15 7:54 ` Hu, Jiayu
2017-09-15 8:15 ` Ananyev, Konstantin
2017-09-15 8:17 ` Ananyev, Konstantin
2017-09-15 8:38 ` Hu, Jiayu
2017-09-14 8:51 ` Kavanagh, Mark B
2017-09-14 9:45 ` Hu, Jiayu
2017-09-12 2:43 ` [dpdk-dev] [PATCH v3 3/5] gso: add VxLAN " Jiayu Hu
2017-09-12 2:43 ` [dpdk-dev] [PATCH v3 4/5] gso: add GRE " Jiayu Hu
2017-09-12 2:43 ` [dpdk-dev] [PATCH v3 5/5] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Jiayu Hu
2017-09-14 18:33 ` Ferruh Yigit
2017-09-15 1:13 ` Hu, Jiayu
2017-09-19 7:32 ` [dpdk-dev] [PATCH v4 0/5] Support TCP/IPv4, VxLAN and GRE GSO in DPDK Jiayu Hu
2017-09-19 7:32 ` [dpdk-dev] [PATCH v4 1/5] gso: add Generic Segmentation Offload API framework Jiayu Hu
2017-09-19 7:32 ` [dpdk-dev] [PATCH v4 2/5] gso: add TCP/IPv4 GSO support Jiayu Hu
2017-09-20 7:03 ` Yao, Lei A
2017-09-19 7:32 ` [dpdk-dev] [PATCH v4 3/5] gso: add VxLAN " Jiayu Hu
2017-09-20 3:11 ` Tan, Jianfeng
2017-09-20 3:17 ` Hu, Jiayu
2017-09-19 7:32 ` [dpdk-dev] [PATCH v4 4/5] gso: add GRE " Jiayu Hu
2017-09-20 2:53 ` Tan, Jianfeng
2017-09-20 6:01 ` Hu, Jiayu
2017-09-19 7:32 ` [dpdk-dev] [PATCH v4 5/5] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Jiayu Hu
2017-09-28 22:13 ` [dpdk-dev] [PATCH v5 0/6] Support TCP/IPv4, VxLAN and GRE GSO in DPDK Mark Kavanagh
2017-10-02 16:45 ` [dpdk-dev] [PATCH v6 0/6] Support TCP/IPv4, VxLAN, " Mark Kavanagh
2017-10-02 16:45 ` [dpdk-dev] [PATCH v6 1/6] gso: add Generic Segmentation Offload API framework Mark Kavanagh
2017-10-04 13:11 ` Ananyev, Konstantin
2017-10-04 13:21 ` Kavanagh, Mark B
2017-10-02 16:45 ` [dpdk-dev] [PATCH v6 2/6] gso: add TCP/IPv4 GSO support Mark Kavanagh
2017-10-04 13:32 ` Ananyev, Konstantin
2017-10-04 14:30 ` Kavanagh, Mark B
2017-10-04 14:49 ` Ananyev, Konstantin
2017-10-04 14:59 ` Kavanagh, Mark B
2017-10-04 13:35 ` Ananyev, Konstantin
2017-10-04 14:22 ` Kavanagh, Mark B
2017-10-02 16:45 ` [dpdk-dev] [PATCH v6 3/6] gso: add VxLAN " Mark Kavanagh
2017-10-04 14:12 ` Ananyev, Konstantin
2017-10-04 14:35 ` Kavanagh, Mark B
2017-10-04 16:13 ` Kavanagh, Mark B
2017-10-04 16:17 ` Ananyev, Konstantin
2017-10-02 16:45 ` [dpdk-dev] [PATCH v6 4/6] gso: add GRE " Mark Kavanagh
2017-10-04 14:15 ` Ananyev, Konstantin
2017-10-04 14:36 ` Kavanagh, Mark B
2017-10-02 16:45 ` [dpdk-dev] [PATCH v6 5/6] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Mark Kavanagh
2017-10-04 15:08 ` Ananyev, Konstantin
2017-10-04 16:23 ` Kavanagh, Mark B
2017-10-04 16:26 ` Ananyev, Konstantin
2017-10-04 16:51 ` Kavanagh, Mark B
2017-10-02 16:45 ` [dpdk-dev] [PATCH v6 6/6] doc: add GSO programmer's guide Mark Kavanagh
2017-10-04 13:51 ` Mcnamara, John
2017-10-05 11:02 ` [dpdk-dev] [PATCH v7 0/6] Support TCP/IPv4, VxLAN, and GRE GSO in DPDK Mark Kavanagh
2017-10-05 11:02 ` [dpdk-dev] [PATCH v7 1/6] gso: add Generic Segmentation Offload API framework Mark Kavanagh
2017-10-05 11:02 ` [dpdk-dev] [PATCH v7 2/6] gso: add TCP/IPv4 GSO support Mark Kavanagh
2017-10-05 11:02 ` [dpdk-dev] [PATCH v7 3/6] gso: add VxLAN " Mark Kavanagh
2017-10-05 11:02 ` [dpdk-dev] [PATCH v7 4/6] gso: add GRE " Mark Kavanagh
2017-10-05 11:02 ` [dpdk-dev] [PATCH v7 5/6] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Mark Kavanagh
2017-10-05 11:02 ` [dpdk-dev] [PATCH v7 6/6] doc: add GSO programmer's guide Mark Kavanagh
2017-10-05 13:22 ` [dpdk-dev] [PATCH v7 0/6] Support TCP/IPv4, VxLAN, and GRE GSO in DPDK Ananyev, Konstantin
2017-10-05 14:39 ` Kavanagh, Mark B
2017-10-05 15:43 ` [dpdk-dev] [PATCH v8 " Mark Kavanagh
2017-10-05 17:12 ` Ananyev, Konstantin
2017-10-05 20:16 ` Kavanagh, Mark B
2017-10-05 20:36 ` [dpdk-dev] [PATCH v9 " Mark Kavanagh
2017-10-05 22:24 ` Ananyev, Konstantin
2017-10-06 8:24 ` [dpdk-dev] FW: " Kavanagh, Mark B
2017-10-06 10:35 ` [dpdk-dev] " Kavanagh, Mark B
2017-10-06 23:32 ` Ferruh Yigit
2017-10-06 23:34 ` Ferruh Yigit
2017-10-07 14:56 ` [dpdk-dev] [PATCH v10 " Jiayu Hu
2017-10-07 14:56 ` [dpdk-dev] [PATCH v10 1/6] gso: add Generic Segmentation Offload API framework Jiayu Hu
2017-10-07 14:56 ` [dpdk-dev] [PATCH v10 2/6] gso: add TCP/IPv4 GSO support Jiayu Hu
2017-10-07 14:56 ` [dpdk-dev] [PATCH v10 3/6] gso: add VxLAN " Jiayu Hu
2017-10-07 14:56 ` [dpdk-dev] [PATCH v10 4/6] gso: add GRE " Jiayu Hu
2017-10-07 14:56 ` [dpdk-dev] [PATCH v10 5/6] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Jiayu Hu
2017-10-07 14:56 ` [dpdk-dev] [PATCH v10 6/6] doc: add GSO programmer's guide Jiayu Hu
2017-10-08 3:40 ` [dpdk-dev] [PATCH v10 0/6] Support TCP/IPv4, VxLAN, and GRE GSO in DPDK Ferruh Yigit
2017-10-05 20:36 ` [dpdk-dev] [PATCH v9 1/6] gso: add Generic Segmentation Offload API framework Mark Kavanagh
2017-10-05 20:36 ` [dpdk-dev] [PATCH v9 2/6] gso: add TCP/IPv4 GSO support Mark Kavanagh
2017-10-05 20:36 ` [dpdk-dev] [PATCH v9 3/6] gso: add VxLAN " Mark Kavanagh
2017-10-05 20:36 ` [dpdk-dev] [PATCH v9 4/6] gso: add GRE " Mark Kavanagh
2017-10-05 20:36 ` [dpdk-dev] [PATCH v9 5/6] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Mark Kavanagh
2017-10-05 20:36 ` [dpdk-dev] [PATCH v9 6/6] doc: add GSO programmer's guide Mark Kavanagh
2017-10-06 13:34 ` Mcnamara, John
2017-10-06 13:41 ` Kavanagh, Mark B
2017-10-05 15:43 ` [dpdk-dev] [PATCH v8 1/6] gso: add Generic Segmentation Offload API framework Mark Kavanagh
2017-10-05 15:44 ` [dpdk-dev] [PATCH v8 2/6] gso: add TCP/IPv4 GSO support Mark Kavanagh
2017-10-05 15:44 ` [dpdk-dev] [PATCH v8 3/6] gso: add VxLAN " Mark Kavanagh
2017-10-05 15:44 ` [dpdk-dev] [PATCH v8 4/6] gso: add GRE " Mark Kavanagh
2017-10-05 15:44 ` [dpdk-dev] [PATCH v8 5/6] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Mark Kavanagh
2017-10-05 15:44 ` [dpdk-dev] [PATCH v8 6/6] doc: add GSO programmer's guide Mark Kavanagh
2017-10-05 17:57 ` Mcnamara, John
2017-09-28 22:13 ` [dpdk-dev] [PATCH v5 1/6] gso: add Generic Segmentation Offload API framework Mark Kavanagh
2017-09-28 22:13 ` [dpdk-dev] [PATCH v5 2/6] gso: add TCP/IPv4 GSO support Mark Kavanagh
2017-09-29 3:12 ` Jiayu Hu
2017-09-29 9:05 ` Kavanagh, Mark B
2017-09-28 22:13 ` [dpdk-dev] [PATCH v5 3/6] gso: add VxLAN " Mark Kavanagh
2017-09-28 22:13 ` Mark Kavanagh [this message]
2017-09-28 22:13 ` [dpdk-dev] [PATCH v5 5/6] app/testpmd: enable TCP/IPv4, VxLAN and GRE GSO Mark Kavanagh
2017-09-28 22:13 ` [dpdk-dev] [PATCH v5 6/6] doc: add GSO programmer's guide Mark Kavanagh
2017-09-28 22:18 ` [dpdk-dev] [PATCH v5 2/6] gso: add TCP/IPv4 GSO support Mark Kavanagh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506636833-25851-5-git-send-email-mark.b.kavanagh@intel.com \
--to=mark.b.kavanagh@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=jianfeng.tan@intel.com \
--cc=jiayu.hu@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).