From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 13/20] testpmd: support gre tunnels in csum fwd engine
Date: Wed, 4 Feb 2015 10:25:18 +0100 [thread overview]
Message-ID: <1423041925-26956-14-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1423041925-26956-1-git-send-email-olivier.matz@6wind.com>
Add support for Ethernet over GRE and IP over GRE tunnels.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
app/test-pmd/cmdline.c | 6 ++--
app/test-pmd/csumonly.c | 87 +++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 84 insertions(+), 9 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 363da9a..b19869c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -322,9 +322,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" checksum with when transmitting a packet using the"
" csum forward engine.\n"
" ip|udp|tcp|sctp always concern the inner layer.\n"
- " outer-ip concerns the outer IP layer (in"
- " case the packet is recognized as a vxlan packet by"
- " the forward engine)\n"
+ " outer-ip concerns the outer IP layer in"
+ " case the packet is recognized as a tunnel packet by"
+ " the forward engine (vxlan and gre are supported)\n"
" Please check the NIC datasheet for HW limits.\n\n"
"csum parse-tunnel (on|off) (tx_port_id)\n"
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index ba9049f..6623704 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -100,6 +100,12 @@ struct testpmd_offload_info {
uint16_t tso_segsz;
};
+/* simplified GRE header (flags must be 0) */
+struct simple_gre_hdr {
+ uint16_t flags;
+ uint16_t proto;
+};
+
static uint16_t
get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags)
{
@@ -218,6 +224,60 @@ parse_vxlan(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info,
info->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */
}
+/* Parse a gre header */
+static void
+parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info)
+{
+ struct ether_hdr *eth_hdr;
+ struct ipv4_hdr *ipv4_hdr;
+ struct ipv6_hdr *ipv6_hdr;
+
+ /* if flags != 0; it's not supported */
+ if (gre_hdr->flags != 0)
+ return;
+
+ if (gre_hdr->proto == _htons(ETHER_TYPE_IPv4)) {
+ info->is_tunnel = 1;
+ info->outer_ethertype = info->ethertype;
+ info->outer_l2_len = info->l2_len;
+ info->outer_l3_len = info->l3_len;
+
+ ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr +
+ sizeof(struct simple_gre_hdr));
+
+ parse_ipv4(ipv4_hdr, info);
+ info->ethertype = _htons(ETHER_TYPE_IPv4);
+ info->l2_len = 0;
+
+ } else if (gre_hdr->proto == _htons(ETHER_TYPE_IPv6)) {
+ info->is_tunnel = 1;
+ info->outer_ethertype = info->ethertype;
+ info->outer_l2_len = info->l2_len;
+ info->outer_l3_len = info->l3_len;
+
+ ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr +
+ sizeof(struct simple_gre_hdr));
+
+ info->ethertype = _htons(ETHER_TYPE_IPv6);
+ parse_ipv6(ipv6_hdr, info);
+ info->l2_len = 0;
+
+ } else if (gre_hdr->proto == _htons(0x6558)) { /* ETH_P_TEB in linux */
+ info->is_tunnel = 1;
+ info->outer_ethertype = info->ethertype;
+ info->outer_l2_len = info->l2_len;
+ info->outer_l3_len = info->l3_len;
+
+ eth_hdr = (struct ether_hdr *)((char *)gre_hdr +
+ sizeof(struct simple_gre_hdr));
+
+ parse_ethernet(eth_hdr, info);
+ } else
+ return;
+
+ info->l2_len += sizeof(struct simple_gre_hdr);
+}
+
/* modify the IPv4 or IPv4 source address of a packet */
static void
change_ip_addresses(void *l3_hdr, uint16_t ethertype)
@@ -368,6 +428,8 @@ uint16_t testpmd_ol_flags)
* Ether / (vlan) / IP|IP6 / UDP|TCP|SCTP .
* Ether / (vlan) / outer IP|IP6 / outer UDP / VxLAN / Ether / IP|IP6 /
* UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / GRE / Ether / IP|IP6 / UDP|TCP|SCTP
+ * Ether / (vlan) / outer IP|IP6 / GRE / IP|IP6 / UDP|TCP|SCTP
*
* The testpmd command line for this forward engine sets the flags
* TESTPMD_TX_OFFLOAD_* in ports[tx_port].tx_ol_flags. They control
@@ -437,12 +499,25 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
parse_ethernet(eth_hdr, &info);
l3_hdr = (char *)eth_hdr + info.l2_len;
- /* check if it's a supported tunnel (only vxlan for now) */
- if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) &&
- info.l4_proto == IPPROTO_UDP) {
- struct udp_hdr *udp_hdr;
- udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info.l3_len);
- parse_vxlan(udp_hdr, &info, m->ol_flags);
+ /* check if it's a supported tunnel */
+ if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) {
+ if (info.l4_proto == IPPROTO_UDP) {
+ struct udp_hdr *udp_hdr;
+ udp_hdr = (struct udp_hdr *)((char *)l3_hdr +
+ info.l3_len);
+ parse_vxlan(udp_hdr, &info, m->ol_flags);
+ } else if (info.l4_proto == IPPROTO_GRE) {
+ struct simple_gre_hdr *gre_hdr;
+ gre_hdr = (struct simple_gre_hdr *)
+ ((char *)l3_hdr + info.l3_len);
+ parse_gre(gre_hdr, &info);
+ }
+ }
+ info.l4_proto == IPPROTO_GRE) {
+ struct simple_gre_hdr *gre_hdr;
+ gre_hdr = (struct simple_gre_hdr *)((char *)l3_hdr +
+ info.l3_len);
+ parse_gre(gre_hdr, &info);
}
/* update l3_hdr and outer_l3_hdr if a tunnel was parsed */
--
2.1.4
next prev parent reply other threads:[~2015-02-04 9:26 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 23:36 [dpdk-dev] [RFC 00/16] enhance checksum offload API Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 01/16] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 02/16] mbuf: enhance the API documentation of offload flags Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 03/16] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 04/16] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
2015-01-23 8:06 ` Liu, Jijiang
2015-01-23 8:47 ` Zhang, Helin
2015-01-23 9:06 ` Olivier MATZ
2015-01-21 23:36 ` [dpdk-dev] [RFC 05/16] mbuf: remove " Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 06/16] ethdev: add outer IP offload capability flag Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 07/16] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 08/16] testpmd: replace tx_checksum command by csum Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 09/16] testpmd: move csum_show in a function Olivier Matz
2015-01-23 11:03 ` Liu, Jijiang
2015-01-23 17:53 ` Olivier MATZ
2015-01-21 23:36 ` [dpdk-dev] [RFC 10/16] testpmd: add csum parse_tunnel command Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 11/16] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
2015-01-23 11:21 ` Liu, Jijiang
2015-01-23 17:49 ` Olivier MATZ
2015-01-21 23:36 ` [dpdk-dev] [RFC 12/16] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 13/16] testpmd: use a structure to store offload info " Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 14/16] testpmd: introduce parse_vxlan " Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 15/16] testpmd: support gre tunnels " Olivier Matz
2015-01-21 23:36 ` [dpdk-dev] [RFC 16/16] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-01-21 23:41 ` [dpdk-dev] [RFC 00/16] enhance checksum offload API Olivier MATZ
2015-01-22 10:00 ` Thomas Monjalon
2015-01-22 1:01 ` Stephen Hemminger
2015-01-23 9:52 ` Olivier MATZ
2015-01-23 7:54 ` Liu, Jijiang
2015-01-30 13:15 ` [dpdk-dev] [PATCH 00/20] enhance tx " Olivier Matz
2015-01-30 13:15 ` [dpdk-dev] [PATCH 01/20] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-01-30 13:15 ` [dpdk-dev] [PATCH 02/20] mbuf: enhance the API documentation of offload flags Olivier Matz
2015-01-30 13:15 ` [dpdk-dev] [PATCH 03/20] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
2015-01-30 13:15 ` [dpdk-dev] [PATCH 04/20] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 05/20] mbuf: remove " Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 06/20] testpmd: replace tx_checksum command by csum Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 07/20] testpmd: move csum_show in a function Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 08/20] testpmd: add csum parse_tunnel command Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 09/20] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 10/20] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 11/20] testpmd: use a structure to store offload info " Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 12/20] testpmd: introduce parse_vxlan " Olivier Matz
2015-02-02 1:49 ` Liu, Jijiang
2015-01-30 13:16 ` [dpdk-dev] [PATCH 13/20] testpmd: support gre tunnels " Olivier Matz
2015-02-02 3:04 ` Liu, Jijiang
2015-01-30 13:16 ` [dpdk-dev] [PATCH 14/20] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 15/20] ethdev: add outer IP offload capability flag Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 16/20] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 17/20] testpmd: add a warning if outer ip cksum requested but not supported Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 18/20] testpmd: fix TSO when using outer checksum offloads Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 19/20] i40e: fix offloading of outer checksum for ip in ip tunnels Olivier Matz
2015-01-30 13:16 ` [dpdk-dev] [PATCH 20/20] i40e: add debug logs for tx context descriptors Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 00/20] enhance tx checksum offload API Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 01/20] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 02/20] mbuf: enhance the API documentation of offload flags Olivier Matz
2015-02-10 5:38 ` Zhang, Helin
2015-02-10 16:54 ` Olivier MATZ
2015-02-11 7:15 ` Liu, Jijiang
2015-02-11 15:15 ` Olivier MATZ
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 03/20] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
2015-02-10 6:03 ` Zhang, Helin
2015-02-10 17:06 ` Olivier MATZ
2015-02-11 5:32 ` Zhang, Helin
2015-02-11 17:13 ` Olivier MATZ
2015-02-13 2:25 ` Zhang, Helin
2015-02-13 8:41 ` Olivier MATZ
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 04/20] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
2015-02-10 6:40 ` Zhang, Helin
2015-02-10 17:08 ` Olivier MATZ
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 05/20] mbuf: remove " Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 06/20] testpmd: replace tx_checksum command by csum Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 07/20] testpmd: move csum_show in a function Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 08/20] testpmd: add csum parse_tunnel command Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 09/20] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 10/20] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 11/20] testpmd: use a structure to store offload info " Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 12/20] testpmd: introduce parse_vxlan " Olivier Matz
2015-02-04 9:25 ` Olivier Matz [this message]
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 14/20] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 15/20] ethdev: add outer IP offload capability flag Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 16/20] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 17/20] testpmd: add a warning if outer ip cksum requested but not supported Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 18/20] testpmd: fix TSO when using outer checksum offloads Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 19/20] i40e: fix offloading of outer checksum for ip in ip tunnels Olivier Matz
2015-02-04 9:25 ` [dpdk-dev] [PATCH v2 20/20] i40e: add debug logs for tx context descriptors Olivier Matz
2015-02-09 1:10 ` [dpdk-dev] [PATCH v2 00/20] enhance tx checksum offload API Liu, Jijiang
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 " Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 01/20] mbuf: remove PKT_TX_IPV4_CSUM Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 02/20] mbuf: enhance the API documentation of offload flags Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 03/20] i40e: call i40e_txd_enable_checksum only for offloaded packets Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 04/20] i40e: remove the use of PKT_TX_UDP_TUNNEL_PKT flag Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 05/20] mbuf: remove " Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 06/20] testpmd: replace tx_checksum command by csum Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 07/20] testpmd: move csum_show in a function Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 08/20] testpmd: add csum parse_tunnel command Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 09/20] testpmd: rename vxlan in outer_ip in csum commands Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 10/20] testpmd: introduce parse_ipv* in csum fwd engine Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 11/20] testpmd: use a structure to store offload info " Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 12/20] testpmd: introduce parse_vxlan " Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 13/20] testpmd: support gre tunnels " Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 14/20] testpmd: support ipip tunnel in csum forward engine Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 15/20] ethdev: add outer IP offload capability flag Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 16/20] i40e: advertise outer IPv4 checksum capability Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 17/20] testpmd: add a warning if outer ip cksum requested but not supported Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 18/20] testpmd: fix TSO when using outer checksum offloads Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 19/20] i40e: fix offloading of outer checksum for ip in ip tunnels Olivier Matz
2015-02-13 9:22 ` [dpdk-dev] [PATCH v3 20/20] i40e: add debug logs for tx context descriptors Olivier Matz
2015-02-15 6:22 ` [dpdk-dev] [PATCH v3 00/20] enhance tx checksum offload API Liu, Jijiang
2015-02-16 18:23 ` Thomas Monjalon
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=1423041925-26956-14-git-send-email-olivier.matz@6wind.com \
--to=olivier.matz@6wind.com \
--cc=dev@dpdk.org \
/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).