From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E139ADE0 for ; Mon, 8 Jun 2015 12:43:53 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 08 Jun 2015 03:41:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,573,1427785200"; d="scan'208";a="742911381" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 08 Jun 2015 03:41:37 -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 t58AfajB029627; Mon, 8 Jun 2015 11:41:36 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t58AfaMX017551; Mon, 8 Jun 2015 11:41:36 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id t58AfacF017547; Mon, 8 Jun 2015 11:41:36 +0100 From: Konstantin Ananyev To: dev@dpdk.org Date: Mon, 8 Jun 2015 11:41:23 +0100 Message-Id: <1433760090-17110-2-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433760090-17110-1-git-send-email-konstantin.ananyev@intel.com> References: <1433373024-5558-2-git-send-email-konstantin.ananyev@intel.com> <1433760090-17110-1-git-send-email-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCHv2 1/8] acl: fix invalid rule wildness calculation for bitmask field type 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: Mon, 08 Jun 2015 10:43:54 -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 3801843..aee6ed5 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; -- 2.4.2