From patchwork Fri Aug 25 13:56:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fischetti, Antonio" X-Patchwork-Id: 805882 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 3xf2lb3DNcz9sPs for ; Fri, 25 Aug 2017 23:56:59 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 667869EE; Fri, 25 Aug 2017 13:56:55 +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 3228B92F for ; Fri, 25 Aug 2017 13:56:54 +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 5AB91193 for ; Fri, 25 Aug 2017 13:56:29 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Aug 2017 06:56:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.41,425,1498546800"; d="scan'208"; a="1188107479" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by fmsmga001.fm.intel.com with ESMTP; 25 Aug 2017 06:56:28 -0700 From: antonio.fischetti@intel.com To: dev@openvswitch.org Date: Fri, 25 Aug 2017 14:56:27 +0100 Message-Id: <1503669387-27600-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, RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v4] 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 When EMC is disabled the reading of RSS hash is skipped. Also, for packets that are not recirculated it retrieves the hash value without considering the recirc id. Signed-off-by: Antonio Fischetti --- V4 - reworked to remove dependencies from other patches in patchset "Skip EMC for recirc pkts and other optimizations." https://mail.openvswitch.org/pipermail/ovs-dev/2017-August/337320.html - measurements were repeated with the latest head of master. Port-to-Port Test ================= Software built with "-O2 -march=native -g". I measured the Rx rate regardless of pkt loss by sending 1 UDP flow, 64B packets, at the line-rate. 2 PMDs with 3 Tx queues. Flows setup: in_port=dpdk0 actions=output:dpdk1 in_port=dpdk1 actions=output:dpdk0 Results ------- Values are for the Rx rate in Mpps, regardless of packet loss. RSS column: Yes: RSS hash is provided by the NIC No: RSS is disabled and the 5-tuple hash must be computed in software. Note: to simulate RSS disabled I added the line dp_packet_rss_valid(struct dp_packet *p) { +return false; #ifdef DPDK_NETDEV EMC column: Yes: default probability insertion, No: EMC disabled. Orig means Commit ID: 75f9e007e7f7eb91461e238f882d1c539c56bb8d +--------------+----------------+ +-----+-----+ Orig | Orig + this | | RSS | EMC | | patch | +-----+-----+--------------+----------------+ | Yes | Yes | 12.02, 11.38 | 12.18, 11.32 | | Yes | No | 8.35, 8.36 | 8.36, 8.38 | +-----+-----+--------------+----------------+ | No | Yes | 9.91, 11.15 | 9.84, 11.08 | | No | No | 7.83, 7.87 | 8.33, 8.35 | +-----+-----+--------------+----------------+ --- lib/dpif-netdev.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index e2cd931..1157998 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -4567,6 +4567,22 @@ dp_netdev_upcall(struct dp_netdev_pmd_thread *pmd, struct dp_packet *packet_, } static inline uint32_t +dpif_netdev_packet_get_rss_hash_orig_pkt(struct dp_packet *packet, + const struct miniflow *mf) +{ + uint32_t hash; + + if (OVS_LIKELY(dp_packet_rss_valid(packet))) { + hash = dp_packet_get_rss_hash(packet); + } else { + hash = miniflow_hash_5tuple(mf, 0); + dp_packet_set_rss_hash(packet, hash); + } + + return hash; +} + +static inline uint32_t dpif_netdev_packet_get_rss_hash(struct dp_packet *packet, const struct miniflow *mf) { @@ -4701,10 +4717,18 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, } 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 EMC is disabled skip hash computation and emc_lookup */ + if (OVS_LIKELY(cur_min)) { + if (!md_is_valid) { + key->hash = dpif_netdev_packet_get_rss_hash_orig_pkt(packet, + &key->mf); + } else { + key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf); + } + flow = emc_lookup(flow_cache, key); + } else { + flow = NULL; + } if (OVS_LIKELY(flow)) { dp_netdev_queue_batches(packet, flow, &key->mf, batches, n_batches);