From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 5A03FB3E2 for ; Fri, 13 Feb 2015 10:23:12 +0100 (CET) Received: by mail-wg0-f51.google.com with SMTP id y19so15366028wgg.10 for ; Fri, 13 Feb 2015 01:23:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KDanClwT2yYWAlurcF7K+D5hxkY1pzsbI3Y96k1rYjk=; b=Dvr7eAK5yfcWWW06K7iUMq0fZFgAlvveFDGN/W1A14T+TrYgScwOYOqVqh/+RrYKq2 op/dfuFKWcf419JJJClMF4uoS+0i0kiL58P0xP11jMI+8Z8GbWWQ3KkU/uI0uoUlvxts BgjW0q/lNa+XrAp/PesoFHW53ckZZY+6XB+8tqvkIZl4ZhFZYUP81uopQc0KBCdNZHgW fYDxIg8MCg/KeiKkhZCauATCz9LPAy1a2/eAD7fTW4F0/d8txCzCMPL8QFqj9fkJkLEd dvKI9wdG4+NJnuD8r7QLCqNEheQxFF8g5xKJ1PLMVBYcQG9T33v1DZTd8JbVkQNUrd+S ozfQ== X-Gm-Message-State: ALoCoQmCsIVOI7qmYUc+0KZwPnvBdocuW71d2k4OvWgKm2VmwCg/QD7PgxePgKUoHjYBG6XAysxj X-Received: by 10.180.73.1 with SMTP id h1mr14632051wiv.10.1423819392220; Fri, 13 Feb 2015 01:23:12 -0800 (PST) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id a5sm2100153wib.20.2015.02.13.01.23.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Feb 2015 01:23:11 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Fri, 13 Feb 2015 10:22:45 +0100 Message-Id: <1423819371-24222-15-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1423819371-24222-1-git-send-email-olivier.matz@6wind.com> References: <1423041925-26956-1-git-send-email-olivier.matz@6wind.com> <1423819371-24222-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v3 14/20] testpmd: support ipip tunnel in csum forward engine X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2015 09:23:13 -0000 Add support for IP over IP tunnels. Signed-off-by: Olivier Matz --- app/test-pmd/cmdline.c | 2 +- app/test-pmd/csumonly.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b19869c..fc08183 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -324,7 +324,7 @@ static void cmd_help_long_parsed(void *parsed_result, " 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 tunnel packet by" - " the forward engine (vxlan and gre are supported)\n" + " the forward engine (vxlan, gre and ipip 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 2582bf1..bee652a 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -283,6 +283,35 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->l2_len += sizeof(struct simple_gre_hdr); } + +/* Parse an encapsulated ip or ipv6 header */ +static void +parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) +{ + struct ipv4_hdr *ipv4_hdr = encap_ip; + struct ipv6_hdr *ipv6_hdr = encap_ip; + uint8_t ip_version; + + ip_version = (ipv4_hdr->version_ihl & 0xf0) >> 4; + + if (ip_version != 4 && ip_version != 6) + return; + + info->is_tunnel = 1; + info->outer_ethertype = info->ethertype; + info->outer_l2_len = info->l2_len; + info->outer_l3_len = info->l3_len; + + if (ip_version == 4) { + parse_ipv4(ipv4_hdr, info); + info->ethertype = _htons(ETHER_TYPE_IPv4); + } else { + parse_ipv6(ipv6_hdr, info); + info->ethertype = _htons(ETHER_TYPE_IPv6); + } + info->l2_len = 0; +} + /* modify the IPv4 or IPv4 source address of a packet */ static void change_ip_addresses(void *l3_hdr, uint16_t ethertype) @@ -438,6 +467,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, * 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 + * Ether / (vlan) / outer IP|IP6 / 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 @@ -519,6 +549,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) gre_hdr = (struct simple_gre_hdr *) ((char *)l3_hdr + info.l3_len); parse_gre(gre_hdr, &info); + } else if (info.l4_proto == IPPROTO_IPIP) { + void *encap_ip_hdr; + encap_ip_hdr = (char *)l3_hdr + info.l3_len; + parse_encap_ip(encap_ip_hdr, &info); } } -- 2.1.4