From patchwork Mon Jun 19 10:11:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fischetti, Antonio" X-Patchwork-Id: 777673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wrmx20Kn8z9s76 for ; Mon, 19 Jun 2017 20:12:06 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id AF418BA3; Mon, 19 Jun 2017 10:12:01 +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 BBCE0B5F for ; Mon, 19 Jun 2017 10:12:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 29DA81A8 for ; Mon, 19 Jun 2017 10:12:00 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2017 03:11:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,360,1493708400"; d="scan'208";a="116595159" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by fmsmga006.fm.intel.com with ESMTP; 19 Jun 2017 03:11:58 -0700 From: antonio.fischetti@intel.com To: dev@openvswitch.org Date: Mon, 19 Jun 2017 11:11:55 +0100 Message-Id: <1497867118-4195-1-git-send-email-antonio.fischetti@intel.com> X-Mailer: git-send-email 1.7.0.7 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 1/4] dpif-netdev: Avoid reading RSS hash when EMC is disabled. 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 From: Antonio Fischetti When EMC is disabled the reading of RSS hash is skipped. For packets that are not recirculated it retrieves the hash value without considering the recirc id. This is mostly a preliminary change for the next patch in this series. Signed-off-by: Antonio Fischetti --- In our testbench we used monodirectional traffic with 64B UDP packets PDM threads: 2 Traffic gen. streams: 1 we saw the following performance improvement: Orig 11.49 Mpps With Patch#1: 11.62 Mpps lib/dpif-netdev.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 02af32e..fd2ed52 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -4584,13 +4584,33 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, if (!md_is_valid) { pkt_metadata_init(&packet->md, port_no); + miniflow_extract(packet, &key->mf); + /* This is not a recirculated packet. */ + if (OVS_LIKELY(cur_min)) { + /* EMC is enabled. We can retrieve the 5-tuple hash + * without considering the recirc id. */ + if (OVS_LIKELY(dp_packet_rss_valid(packet))) { + key->hash = dp_packet_get_rss_hash(packet); + } else { + key->hash = miniflow_hash_5tuple(&key->mf, 0); + dp_packet_set_rss_hash(packet, key->hash); + } + flow = emc_lookup(flow_cache, key); + } else { + /* EMC is disabled, skip emc_lookup. */ + flow = NULL; + } + } else { + /* Recirculated packets. */ + miniflow_extract(packet, &key->mf); + if (OVS_LIKELY(cur_min)) { + key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf); + flow = emc_lookup(flow_cache, key); + } else { + flow = NULL; + } } - miniflow_extract(packet, &key->mf); key->len = 0; /* Not computed yet. */ - key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf); - - /* If EMC is disabled skip emc_lookup */ - flow = (cur_min == 0) ? NULL: emc_lookup(flow_cache, key); if (OVS_LIKELY(flow)) { dp_netdev_queue_batches(packet, flow, &key->mf, batches, n_batches);