From patchwork Thu Jan 18 18:20:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Yipeng1" X-Patchwork-Id: 863245 X-Patchwork-Delegate: ian.stokes@intel.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 3zN34N1FbMz9t2f for ; Fri, 19 Jan 2018 12:23:32 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id AF7AC10D3; Fri, 19 Jan 2018 01:23:00 +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 D6FFCFA4 for ; Fri, 19 Jan 2018 01:22:57 +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 6C39D419 for ; Fri, 19 Jan 2018 01:22:57 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jan 2018 17:22:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,379,1511856000"; d="scan'208";a="11524483" Received: from skx-yipeng.jf.intel.com ([10.54.81.175]) by fmsmga008.fm.intel.com with ESMTP; 18 Jan 2018 17:22:56 -0800 From: Yipeng Wang To: dev@openvswitch.org, jan.scheurich@ericsson.com Date: Thu, 18 Jan 2018 10:20:22 -0800 Message-Id: <1516299624-452546-3-git-send-email-yipeng1.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516299624-452546-1-git-send-email-yipeng1.wang@intel.com> References: <1516299624-452546-1-git-send-email-yipeng1.wang@intel.com> X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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 Cc: charlie.tai@intel.com Subject: [ovs-dev] [RFC 2/4] dpif-netdev: Fix EMC key length 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 EMC's key length is not initialized when insertion. Initialize the key length before insertion. The code might be put in another place, for now I just put it in dfc_lookup. Signed-off-by: Yipeng Wang --- lib/dpif-netdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index b9f4b6d..3e87992 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2295,7 +2295,7 @@ dfc_insert(struct dp_netdev_pmd_thread *pmd, } static inline struct dp_netdev_flow * -dfc_lookup(struct dfc_cache *cache, const struct netdev_flow_key *key, +dfc_lookup(struct dfc_cache *cache, struct netdev_flow_key *key, bool *exact_match) { struct dp_netdev_flow *flow; @@ -2317,6 +2317,7 @@ dfc_lookup(struct dfc_cache *cache, const struct netdev_flow_key *key, /* Found a match in DFC. Insert into EMC for subsequent lookups. * We use probabilistic insertion here so that mainly elephant * flows enter EMC. */ + key->len = netdev_flow_key_size(miniflow_n_values(&key->mf)); emc_probabilistic_insert(&cache->emc_cache, key, flow); *exact_match = false; return flow;