From patchwork Wed Jul 19 21:37:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 791245 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xCVkp07Smz9t2t for ; Thu, 20 Jul 2017 07:38:10 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 74234B4B; Wed, 19 Jul 2017 21:38:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 6B96BA74 for ; Wed, 19 Jul 2017 21:38:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B275216A for ; Wed, 19 Jul 2017 21:38:04 +0000 (UTC) Received: from mfilter22-d.gandi.net (mfilter22-d.gandi.net [217.70.178.150]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 811BAA80CF for ; Wed, 19 Jul 2017 23:38:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter22-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter22-d.gandi.net (mfilter22-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id E7pq6wDnlPOd for ; Wed, 19 Jul 2017 23:38:02 +0200 (CEST) X-Originating-IP: 209.85.218.42 Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) (Authenticated sender: joe@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id D9140A80C8 for ; Wed, 19 Jul 2017 23:38:01 +0200 (CEST) Received: by mail-oi0-f42.google.com with SMTP id x187so12101594oig.3 for ; Wed, 19 Jul 2017 14:38:01 -0700 (PDT) X-Gm-Message-State: AIVw112mo4+klNS84ANJyu5YWJvItFRmB+GXf7noMhqC4DaGWULnpCdF 4Lf+de50YpTEYARqmMkElee1akaU2A== X-Received: by 10.202.89.10 with SMTP id n10mr2770021oib.95.1500500280370; Wed, 19 Jul 2017 14:38:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.136.67 with HTTP; Wed, 19 Jul 2017 14:37:39 -0700 (PDT) In-Reply-To: <1500471963-82198-1-git-send-email-sugesh.chandran@intel.com> References: <1500471963-82198-1-git-send-email-sugesh.chandran@intel.com> From: Joe Stringer Date: Wed, 19 Jul 2017 14:37:39 -0700 X-Gmail-Original-Message-ID: Message-ID: To: Sugesh Chandran X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: ovs dev Subject: Re: [ovs-dev] [PATCH v4 0/3] tunneling : Improving tunneling performance by avoiding dp recirc. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org On 19 July 2017 at 06:46, Sugesh Chandran wrote: > Openvswitch datapath recirculates packets for tunneling, i.e. > the incoming packets are encapsulated at first pass. Further actions are > applied on encapsulated packets on the second pass after recirculating. > The proposed patch compute and append the post tunnel actions at the time of > translation itself instead of recirculating at datapath. These actions are > solely depends on tunnel attributes so there is no need of datapath > recirculation. > > By avoiding the recirculation at datapath, the patch offers upto 30% > performance improvement for VxLAN tunneling in our testing. > The action execution logic is also extended with new CLONE action to define > the packet cloning when the actions are combined. The lenght in the CLONE > action specifies the size of nested action set. > > Signed-off-by: Sugesh Chandran > Signed-off-by: Zoltán Balogh > Co-authored-by: Zoltán Balogh > > v4 > - Rebased on latest master. > - Coding style fixes > - Provide comment for tunnel-push without post actions. > - Corrected new packet-aware test suites to pass userspace testsuites. > - Changes on cache_steal function to use memcpy and ofpbuf_put_uninit > functions. > > v3 > - Rebased on latest master > - Changed the xlate_cache copy function to avoid expensive ref update operations. > - Updated the new packet-aware test cases to handle the non-recirc tunnel case. > - Updated the commit message with performance results. > > v2 > - Rebased on latest master. > - Updated newely added packet-aware test case to honor tunnel combine actions. > - Folded related patches into single patch based on Joe's comments. > - Do the translation only once for tunnel combine instead of two. > > > Sugesh Chandran (3): > xlate: Clear tunnel mask along with other fields while combine > actions. > tunneling: Calculate and update packet l4_offset in tunnel push. > tunneling: Avoid datapath-recirc by combining recirc actions at xlate. > > lib/dpif-netdev.c | 18 +-- > lib/netdev-native-tnl.c | 2 + > ofproto/ofproto-dpif-xlate-cache.c | 32 +++- > ofproto/ofproto-dpif-xlate-cache.h | 13 +- > ofproto/ofproto-dpif-xlate.c | 238 +++++++++++++++++++++++++++- > ofproto/ofproto-dpif.c | 3 +- > tests/packet-type-aware.at | 27 ++-- > tests/system-userspace-packet-type-aware.at | 24 +-- > 8 files changed, 296 insertions(+), 61 deletions(-) > > -- > 2.7.4 > Thanks Sugesh and Zoltán, I applied this series to master with the following minor style incremental to the last patch: diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c index 5dbf5833dfb8..ef579409b0d0 100644 --- a/lib/netdev-native-tnl.c +++ b/lib/netdev-native-tnl.c @@ -139,7 +139,7 @@ netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, * * This function sets the IP header's ip_tot_len field (which should be zeroed * as part of 'header') and puts its value into '*ip_tot_size' as well. Also - * updates IP header checksum. + * updates IP header checksum, as well as the l3 and l4 offsets in 'packet'. * * Return pointer to the L4 header added to 'packet'. */ void * diff --git a/ofproto/ofproto-dpif-xlate-cache.c b/ofproto/ofproto-dpif-xlate-cache.c index 6947f2fd318d..d319d287eadb 100644 --- a/ofproto/ofproto-dpif-xlate-cache.c +++ b/ofproto/ofproto-dpif-xlate-cache.c @@ -300,9 +300,10 @@ xlate_cache_steal_entries(struct xlate_cache *dst, struct xlate_cache *src) if (!dst || !src) { return; } - void *p; struct ofpbuf *src_entries = &src->entries; struct ofpbuf *dst_entries = &dst->entries; + void *p; + p = ofpbuf_put_uninit(dst_entries, src_entries->size); memcpy(p, src_entries->data, src_entries->size); ofpbuf_clear(src_entries); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 0177f5c15b71..7f7adb280eaf 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3326,13 +3326,13 @@ validate_and_combine_post_tnl_actions(struct xlate_ctx *ctx, /* Update the CLONE action only when combined. */ nl_msg_end_nested(ctx->odp_actions, clone_ofs); } else { + nl_msg_cancel_nested(ctx->odp_actions, clone_ofs); /* XXX : There is no real use-case for a tunnel push without * any post actions. However keeping it now * as is to make the 'make check' happy. Should remove when all the * make check tunnel test case does something meaningful on a * tunnel encap packets. */ - nl_msg_cancel_nested(ctx->odp_actions, clone_ofs); odp_put_tnl_push_action(ctx->odp_actions, &tnl_push_data); }