From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 81CDAC320 for ; Thu, 4 Jun 2015 01:10:32 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 03 Jun 2015 16:10:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,549,1427785200"; d="scan'208";a="704934625" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2015 16:10:28 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t53NAQwY006139; Thu, 4 Jun 2015 00:10:26 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t53NAQOS005745; Thu, 4 Jun 2015 00:10:26 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id t53NAQns005741; Thu, 4 Jun 2015 00:10:26 +0100 From: Konstantin Ananyev To: dev@dpdk.org Date: Thu, 4 Jun 2015 00:10:17 +0100 Message-Id: <1433373024-5558-2-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433373024-5558-1-git-send-email-konstantin.ananyev@intel.com> References: <1433373024-5558-1-git-send-email-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCH 1/8] ACL: fix invalid rule wildness calculation for RTE_ACL_FIELD_TYPE_BITMASK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2015 23:10:33 -0000 Signed-off-by: Konstantin Ananyev --- lib/librte_acl/acl_bld.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c index db23b7b..e2db9bf 100644 --- a/lib/librte_acl/acl_bld.c +++ b/lib/librte_acl/acl_bld.c @@ -1362,6 +1362,9 @@ acl_calc_wildness(struct rte_acl_build_rule *head, for (n = 0; n < config->num_fields; n++) { double wild = 0; + uint64_t msk_val = + RTE_LEN2MASK(CHAR_BIT * config->defs[n].size, + typeof(msk_val)); double size = CHAR_BIT * config->defs[n].size; int field_index = config->defs[n].field_index; const struct rte_acl_field *fld = rule->f->field + @@ -1369,8 +1372,8 @@ acl_calc_wildness(struct rte_acl_build_rule *head, switch (rule->config->defs[n].type) { case RTE_ACL_FIELD_TYPE_BITMASK: - wild = (size - __builtin_popcount( - fld->mask_range.u8)) / + wild = (size - __builtin_popcountll( + fld->mask_range.u64 & msk_val)) / size; break; -- 1.8.5.3