* Bitmap bit clear * * @param bmp * Handle to bitmap instance * @param pos * Bit position */
| 455 | * Bit position |
| 456 | */ |
| 457 | static inline void |
| 458 | rte_bitmap_clear(struct rte_bitmap *bmp, uint32_t pos) |
| 459 | { |
| 460 | uint64_t *slab1, *slab2; |
| 461 | uint32_t index1, index2, offset1, offset2; |
| 462 | |
| 463 | /* Clear bit in array2 slab */ |
| 464 | index2 = pos >> RTE_BITMAP_SLAB_BIT_SIZE_LOG2; |
| 465 | offset2 = pos & RTE_BITMAP_SLAB_BIT_MASK; |
| 466 | slab2 = bmp->array2 + index2; |
| 467 | |
| 468 | /* Return if array2 slab is not all-zeros */ |
| 469 | *slab2 &= ~(1llu << offset2); |
| 470 | if (*slab2){ |
| 471 | return; |
| 472 | } |
| 473 | |
| 474 | /* Check the entire cache line of array2 for all-zeros */ |
| 475 | index2 &= ~ RTE_BITMAP_CL_SLAB_MASK; |
| 476 | slab2 = bmp->array2 + index2; |
| 477 | if (__rte_bitmap_line_not_empty(slab2)) { |
| 478 | return; |
| 479 | } |
| 480 | |
| 481 | /* The array2 cache line is all-zeros, so clear bit in array1 slab */ |
| 482 | index1 = pos >> (RTE_BITMAP_SLAB_BIT_SIZE_LOG2 + RTE_BITMAP_CL_BIT_SIZE_LOG2); |
| 483 | offset1 = (pos >> RTE_BITMAP_CL_BIT_SIZE_LOG2) & RTE_BITMAP_SLAB_BIT_MASK; |
| 484 | slab1 = bmp->array1 + index1; |
| 485 | *slab1 &= ~(1llu << offset1); |
| 486 | |
| 487 | return; |
| 488 | } |
| 489 | |
| 490 | static inline int |
| 491 | __rte_bitmap_scan_search(struct rte_bitmap *bmp) |