MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_hash_reset

Function rte_hash_reset

dpdk/lib/hash/rte_cuckoo_hash.c:621–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619}
620
621void
622rte_hash_reset(struct rte_hash *h)
623{
624 uint32_t tot_ring_cnt, i;
625 unsigned int pending;
626
627 if (h == NULL)
628 return;
629
630 __hash_rw_writer_lock(h);
631
632 if (h->dq) {
633 /* Reclaim all the resources */
634 rte_rcu_qsbr_dq_reclaim(h->dq, ~0, NULL, &pending, NULL);
635 if (pending != 0)
636 RTE_LOG(ERR, HASH, "RCU reclaim all resources failed\n");
637 }
638
639 memset(h->buckets, 0, h->num_buckets * sizeof(struct rte_hash_bucket));
640 memset(h->key_store, 0, h->key_entry_size * (h->entries + 1));
641 *h->tbl_chng_cnt = 0;
642
643 /* reset the free ring */
644 rte_ring_reset(h->free_slots);
645
646 /* flush free extendable bucket ring and memory */
647 if (h->ext_table_support) {
648 memset(h->buckets_ext, 0, h->num_buckets *
649 sizeof(struct rte_hash_bucket));
650 rte_ring_reset(h->free_ext_bkts);
651 }
652
653 /* Repopulate the free slots ring. Entry zero is reserved for key misses */
654 if (h->use_local_cache)
655 tot_ring_cnt = h->entries + (RTE_MAX_LCORE - 1) *
656 (LCORE_CACHE_SIZE - 1);
657 else
658 tot_ring_cnt = h->entries;
659
660 for (i = 1; i < tot_ring_cnt + 1; i++)
661 rte_ring_sp_enqueue_elem(h->free_slots, &i, sizeof(uint32_t));
662
663 /* Repopulate the free ext bkt ring. */
664 if (h->ext_table_support) {
665 for (i = 1; i <= h->num_buckets; i++)
666 rte_ring_sp_enqueue_elem(h->free_ext_bkts, &i,
667 sizeof(uint32_t));
668 }
669
670 if (h->use_local_cache) {
671 /* Reset local caches per lcore */
672 for (i = 0; i < RTE_MAX_LCORE; i++)
673 h->local_free_slots[i].len = 0;
674 }
675 __hash_rw_writer_unlock(h);
676}
677
678/*

Calls 6

__hash_rw_writer_lockFunction · 0.85
rte_rcu_qsbr_dq_reclaimFunction · 0.85
memsetFunction · 0.85
rte_ring_resetFunction · 0.85
rte_ring_sp_enqueue_elemFunction · 0.85
__hash_rw_writer_unlockFunction · 0.85