From patchwork Wed Jul 19 16:04:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fischetti, Antonio" X-Patchwork-Id: 791159 X-Patchwork-Delegate: dlu998@gmail.com 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 3xCMNr3lTlz9s3w for ; Thu, 20 Jul 2017 02:07:08 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6F159B8C; Wed, 19 Jul 2017 16:05:09 +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 E5C16B6E for ; Wed, 19 Jul 2017 16:05:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 74288CD for ; Wed, 19 Jul 2017 16:05:03 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 19 Jul 2017 09:05:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,381,1496127600"; d="scan'208";a="994775417" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2017 09:05:02 -0700 From: antonio.fischetti@intel.com To: dev@openvswitch.org Date: Wed, 19 Jul 2017 17:04:56 +0100 Message-Id: <1500480297-7530-4-git-send-email-antonio.fischetti@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1500480297-7530-1-git-send-email-antonio.fischetti@intel.com> References: <1500480297-7530-1-git-send-email-antonio.fischetti@intel.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2 4/5] conntrack: pass current time to conntrack_execute. 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Current time is passed to conntrack_execute so it doesn't have to recompute it again. Signed-off-by: Antonio Fischetti Acked by: Sugesh Chandran --- In a firewall testbench set up with table=0, priority=1 actions=drop table=0, priority=10,arp actions=NORMAL table=0, priority=100,ct_state=-trk,ip actions=ct(table=1) table=1, ct_state=+new+trk,ip,in_port=1 actions=ct(commit),output:2 table=1, ct_state=+est+trk,ip,in_port=1 actions=output:2 table=1, ct_state=+new+trk,ip,in_port=2 actions=drop table=1, ct_state=+est+trk,ip,in_port=2 actions=output:1 I saw the following performance improvement. I measured packet Rx rate (regardless of packet loss). Bidirectional test with 64B UDP packets. +-------------------+----------------+ | Orig OvS-DPDK + | Previous case | | patches #1,2,3 | + this patch | -------------------+-------------------+----------------+ 10 UDP connections | 2.60, 2.64 | 2.62, 2.66 | -------------------+-------------------+----------------+ lib/conntrack.c | 4 ++-- lib/conntrack.h | 3 ++- lib/dpif-netdev.c | 2 +- tests/test-conntrack.c | 8 +++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index de46a6b..a6ccf2e 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -840,11 +840,11 @@ conntrack_execute(struct conntrack *ct, struct dp_packet_batch *pkt_batch, const uint32_t *setmark, const struct ovs_key_ct_labels *setlabel, const char *helper, - const struct nat_action_info_t *nat_action_info) + const struct nat_action_info_t *nat_action_info, + long long now) { struct dp_packet **pkts = pkt_batch->packets; size_t cnt = pkt_batch->count; - long long now = time_msec(); struct conn_lookup_ctx ctx; if (helper) { diff --git a/lib/conntrack.h b/lib/conntrack.h index defde4c..53d0f22 100644 --- a/lib/conntrack.h +++ b/lib/conntrack.h @@ -95,7 +95,8 @@ int conntrack_execute(struct conntrack *, struct dp_packet_batch *, uint16_t zone, const uint32_t *setmark, const struct ovs_key_ct_labels *setlabel, const char *helper, - const struct nat_action_info_t *nat_action_info); + const struct nat_action_info_t *nat_action_info, + long long now); struct conntrack_dump { struct conntrack *ct; diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 79efce6..8c776ff 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -5384,7 +5384,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_, conntrack_execute(&dp->conntrack, packets_, aux->flow->dl_type, force, commit, zone, setmark, setlabel, helper, - nat_action_info_ref); + nat_action_info_ref, now); break; } diff --git a/tests/test-conntrack.c b/tests/test-conntrack.c index 6a77db8..b27d181 100644 --- a/tests/test-conntrack.c +++ b/tests/test-conntrack.c @@ -84,12 +84,13 @@ ct_thread_main(void *aux_) struct dp_packet_batch *pkt_batch; ovs_be16 dl_type; size_t i; + long long now = time_msec(); pkt_batch = prepare_packets(batch_size, change_conn, aux->tid, &dl_type); ovs_barrier_block(&barrier); for (i = 0; i < n_pkts; i += batch_size) { conntrack_execute(&ct, pkt_batch, dl_type, false, true, 0, NULL, NULL, - NULL, NULL); + NULL, NULL, now); } ovs_barrier_block(&barrier); destroy_packets(pkt_batch); @@ -154,6 +155,7 @@ pcap_batch_execute_conntrack(struct conntrack *ct, { struct dp_packet_batch new_batch; ovs_be16 dl_type = htons(0); + long long now = time_msec(); dp_packet_batch_init(&new_batch); @@ -172,7 +174,7 @@ pcap_batch_execute_conntrack(struct conntrack *ct, if (flow.dl_type != dl_type) { conntrack_execute(ct, &new_batch, dl_type, false, true, 0, - NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, now); dp_packet_batch_init(&new_batch); } new_batch.packets[new_batch.count++] = packet;; @@ -180,7 +182,7 @@ pcap_batch_execute_conntrack(struct conntrack *ct, if (!dp_packet_batch_is_empty(&new_batch)) { conntrack_execute(ct, &new_batch, dl_type, false, true, 0, NULL, NULL, - NULL, NULL); + NULL, NULL, now); } }