| 550 | } |
| 551 | |
| 552 | int32_t |
| 553 | rte_hash_count(const struct rte_hash *h) |
| 554 | { |
| 555 | uint32_t tot_ring_cnt, cached_cnt = 0; |
| 556 | uint32_t i, ret; |
| 557 | |
| 558 | if (h == NULL) |
| 559 | return -EINVAL; |
| 560 | |
| 561 | if (h->use_local_cache) { |
| 562 | tot_ring_cnt = h->entries + (RTE_MAX_LCORE - 1) * |
| 563 | (LCORE_CACHE_SIZE - 1); |
| 564 | for (i = 0; i < RTE_MAX_LCORE; i++) |
| 565 | cached_cnt += h->local_free_slots[i].len; |
| 566 | |
| 567 | ret = tot_ring_cnt - rte_ring_count(h->free_slots) - |
| 568 | cached_cnt; |
| 569 | } else { |
| 570 | tot_ring_cnt = h->entries; |
| 571 | ret = tot_ring_cnt - rte_ring_count(h->free_slots); |
| 572 | } |
| 573 | return ret; |
| 574 | } |
| 575 | |
| 576 | /* Read write locks implemented using rte_rwlock */ |
| 577 | static inline void |