]> git.droids-corp.org - dpdk.git/commitdiff
net/ice/base: fix bitmap and/or routines
authorQi Zhang <qi.z.zhang@intel.com>
Tue, 23 Jul 2019 03:51:15 +0000 (11:51 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 24 Jul 2019 14:00:57 +0000 (16:00 +0200)
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 <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
drivers/net/ice/base/ice_bitops.h

index c74407d9d51dd9c218297969b812dd9e15b00e2d..a3a67eb4bf5a28f364189a118672e33ae2dc5ef2 100644 (file)
@@ -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);
 }
 
 /**