aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/bitmap.h
AgeCommit message (Collapse)AuthorFilesLines
2023-03-06vppinfra: fix clib_bitmap_will_expand() result inversionVladislav Grishenko1-1/+1
Pool's pool_put_will_expand() calls clib_bitmap_will_expand(), so every put except ones that leads to free_bitmap reallocation will get false positive results and vice versa. Unfortunatelly there's no related test and existing bitmap tests are failing silently with false positive result as well. Fortunatelly neither clib_bitmap_will_expand() nor pool_put_will_expand() are being used by current vpp codebase. Type: fix Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: Id5bb900cf6a1b1002d37670f5c415c74165b5421
2023-01-20vppinfra: clib_bitmap fixMaxime Peim1-5/+5
In clib_bitmap_set_region and clib_bitmap_set_multiple the index of the last bit to set was off by 1. If this index was pointing to the last bit of the bitmap, another uword would have been allocated, even though it was unnecessary. Moreover, in clib_bitmap_set_region, bits in the last word were not properly set. Indeed, the n_bits_left value is wrong since n_bits is not decreased by the number of already set bits. Type: fix Signed-off-by: Maxime Peim <mpeim@cisco.com> Change-Id: I8d7ef6f47abb9f1f64f38297da2c59509d74dd72
2022-08-18vppinfra: correct clib_bitmap_set() return commentJon Loeliger1-1/+1
Fix a copy-n-paste issue that left clib_bitmap_set()'s return type documentation incorrect. Chnage it to indicate that the function returns a new pointer for the bitmap that could be different due to a possible reallocation. Type: docs Signed-off-by: Jon Loeliger <jdl@netgate.com> Change-Id: Ia193c4673c0e4d1760e91cd7f80ebe1868a3c9b5
2022-04-04vppinfra: make _vec_len() read-onlyDamjan Marion1-24/+27
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-03-18vppinfra: refactor *_will_expand() functionsDamjan Marion1-3/+1
Type: refactor Change-Id: I3625eacf9e04542ca8778df5d46075a8654642c7 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-16vppinfra: bitops cleanupDamjan Marion1-1/+0
Type: refactor Change-Id: I7fa113e924640f9d798c1eb6ae64b9c0a9e2104c Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-01vppinfra: fix bitmap can't get correct next clear indexjiangxiaoming1-2/+1
when bitmap vec len is 1 and all the bits has been occupied, clib_bitmap_next_clear(ai, 63) will return result:65 which should be 64. It will lead to missing iteration for pool_foreach. Type: fix Signed-off-by: jiangxiaoming <jiangxiaoming@outlook.com> Change-Id: Iadac7e6f6b4da357943c4c9d50bf22353c4a8408
2021-11-25vppinfra: will_expand for pool_put and bitmapStanislav Zaikin1-0/+8
Macro for pool_put and put a barrier inside load_balance_destroy when bitmap is actually growing. Type: improvement Signed-off-by: Stanislav Zaikin <zstaseg@gmail.com> Change-Id: Ief2912e8efd744289ebed68373fa6fd0ee83118e
2021-10-28vppinfra: A bitmap copy functionNeale Ranns1-0/+18
Type: improvement Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Id7a7788b41dbcf280e025e5256c41729b0c95f39
2021-07-16vppinfra: remove pool_foreach_old, pool_foreach_index_old, ↵Damjan Marion1-19/+0
clib_bitmap_foreach_old Type: refactor Change-Id: Ifacdd001bdeb5d609d495406f53546090b86476d Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-04-15vppinfra: move bitmap format functions to .c file, add format_bitmap_listDamjan Marion1-120/+4
Type: improvement Change-Id: I9baa845ecab8655e0623453666092d2dbc674b0f Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-14misc: refactor clib_bitmap_foreach macroDamjan Marion1-1/+7
Type: refactor Change-Id: I077110e1a422722e20aa546a6f3224c06ab0cde5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-04-28vppinfra: improve test coverageDave Barach1-1/+1
Bonus corner-case bugfix in bitmap.h, found during the exercise. Issue dates from 2001 or thereabouts. Please review this specific change carefully. lcov_post: filter system include directories and generated files in build-root Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iaa0b63e9dc571dfe3d992197ac49ba4d93403c61
2018-08-08fix typo in bitmap.hKorian Edeline1-1/+1
Change-Id: I11587fc382a529cfd9c0971cc2ad59cd97dd6a13 Signed-off-by: Korian Edeline <korian.edeline@ulg.ac.be>
2018-08-01Improve cpu { coremask-% } configure optionYi He1-0/+36
Accept any sized hexadecimal bitmask specification to support platforms with hundreds of cores. Change-Id: Ib881db0cf60f78bdeffa13acfc2fc7fe7e128cc4 Signed-off-by: Yi He <yi.he@arm.com>
2018-07-04Fix clib_bitmap_next_clear() function when no clear bits leftJohn Lo1-0/+3
If the bitmap has no bit clear after the input bit position i, the function will return i even if its bit is set. Fix is to return the next bit just beyond the free bitmap. This can cause IP neighbor scan crash in ip_neighbor_scan() with a debug image. With production image, ip_neighbor_scan() may still function, AFAICT, with extra neighbor delete attempts for entries already deleted, until these entries are reused for new neighbors. Change-Id: If6422ef6f63908ea39651de4ccbd8cb0b294bd69 Signed-off-by: John Lo <loj@cisco.com>
2018-06-30bitmap: add nocheck variants for bit opsFlorin Coras1-14/+47
Change-Id: Ifd155e2980a9f8e6af9bb6b08619c15b2bf18ef1 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-26We don't have (yet) 128-bit unaligned load/store on ARMDamjan Marion1-2/+2
Change-Id: I16395bbf843e338cdd366d85bb4df3de95d9b265 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-06-26SIMD optimized linear search in clib_bitmap_first_setDamjan Marion1-2/+23
Change-Id: Ib3a55598a83cc99485b40e38e7c406ecb126fd42 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-05-10vppinfra: use count_trailing_zeros in sparse_vec_indexDamjan Marion1-1/+1
It is much cheaper to use ctzll than to do shift,subtract and mask in likely case when we are looking for 1st set bit in the uword. Change-Id: I31954081571978878c7098bafad0c85a91755fa2 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+774
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>