From patchwork Tue Jul 23 03:51:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 56935 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F9451BF8F; Tue, 23 Jul 2019 05:49:00 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id BDE3B1BF68; Tue, 23 Jul 2019 05:48:52 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 20:48:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,297,1559545200"; d="scan'208";a="163371727" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga008.jf.intel.com with ESMTP; 22 Jul 2019 20:48:51 -0700 From: Qi Zhang To: qiming.yang@intel.com, wenzhuo.lu@intel.com Cc: paul.m.stillwell.jr@intel.com, dev@dpdk.org, Qi Zhang , stable@dpdk.org, Dan Nowlin Date: Tue, 23 Jul 2019 11:51:15 +0800 Message-Id: <20190723035115.42664-7-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190723035115.42664-1-qi.z.zhang@intel.com> References: <20190723035115.42664-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH 6/6] net/ice/base: fix for and/or bitmap routines 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" There was an issue with ice_and_bitmap and ice_or_bitmap when dealing with bit array sizes that are not even multiples of 32, where some of relevant bits in the highest 32 bits were being cleared. This patch fixes those problems. Fixes: c9e37832c95f ("net/ice/base: rework on bit ops") Cc: stable@dpdk.org Signed-off-by: Dan Nowlin Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_bitops.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/base/ice_bitops.h b/drivers/net/ice/base/ice_bitops.h index c74407d9d..a3a67eb4b 100644 --- a/drivers/net/ice/base/ice_bitops.h +++ b/drivers/net/ice/base/ice_bitops.h @@ -191,8 +191,7 @@ ice_and_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1, * size value alone. */ mask = LAST_CHUNK_MASK(size); - dst[i] &= ~mask; - dst[i] |= (bmp1[i] & bmp2[i]) & mask; + dst[i] = (dst[i] & ~mask) | ((bmp1[i] & bmp2[i]) & mask); res |= dst[i] & mask; return res != 0; @@ -226,8 +225,7 @@ ice_or_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1, * within the specified size. */ mask = LAST_CHUNK_MASK(size); - dst[i] &= ~mask; - dst[i] |= (bmp1[i] | bmp2[i]) & mask; + dst[i] = (dst[i] & ~mask) | ((bmp1[i] | bmp2[i]) & mask); } /**