From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 7B0111BBAD for ; Fri, 27 Oct 2017 04:56:27 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6700F15AD; Thu, 26 Oct 2017 19:56:26 -0700 (PDT) Received: from ubuntu-jianbo.shanghai.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 968983F24A; Thu, 26 Oct 2017 19:56:25 -0700 (PDT) From: Jianbo Liu To: dev@dpdk.org, cristian.dumitrescu@intel.com Cc: Jianbo Liu Date: Fri, 27 Oct 2017 10:55:19 +0800 Message-Id: <1509072919-17348-1-git-send-email-jianbo.liu@arm.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: avoid the failure of creating hash table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 02:56:27 -0000 Hash table function will check if the input bucket size is power of 2, so the parameter should be rounded up before sending to the creating function. Signed-off-by: Jianbo Liu --- examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c | 2 +- examples/ip_pipeline/pipeline/pipeline_routing_be.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c index 9846777..929d81c 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c @@ -499,7 +499,7 @@ static void *pipeline_fc_init(struct pipeline_params *params, .key_mask = (p_fc->key_mask_present) ? p_fc->key_mask : NULL, .n_keys = p_fc->n_flows, - .n_buckets = p_fc->n_flows / 4, + .n_buckets = rte_align32pow2(p_fc->n_flows / 4), .f_hash = hash_func[(p_fc->key_size / 8) - 1], .seed = 0, }; diff --git a/examples/ip_pipeline/pipeline/pipeline_routing_be.c b/examples/ip_pipeline/pipeline/pipeline_routing_be.c index 7aaf467..0414f24 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing_be.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing_be.c @@ -1355,7 +1355,8 @@ struct arp_table_entry { .key_offset = p_rt->params.arp_key_offset, .key_mask = NULL, .n_keys = p_rt->params.n_arp_entries, - .n_buckets = p_rt->params.n_arp_entries / 4, + .n_buckets = + rte_align32pow2(p_rt->params.n_arp_entries / 4), .f_hash = hash_default_key8, .seed = 0, }; -- 1.9.1