Hi Bruce, On 03/15/2016 01:25 PM, Olivier Matz wrote: > Seen by trying to fix the func_reentrancy autotest. The test > was doing the following on several cores in parallel: > > name = "common_name"; > do several times { > obj = allocate_an_object(name) // obj = ring, mempool, hash, lpm, ... > if (obj == NULL && lookup(name) == NULL) > return TEST_FAIL; > } > > Issues: > > 1/ rings, mempools, hashs API are not coherent > rings and mempool return NULL if the object does not exist > hash and lpm return an object that was allocated allocated if > it already was allocated > > 2/ The hash/lpm API looks dangerous: when an object is returned, > the user does not know if it should be freed or not (no refcnt) > > 3/ There are some possible race conditions in cuckoo_hash as the > lock is not held in rte_hash_create(). We could find some cases > where NULL is returned when the object already exists (ex: when > rte_ring_create() fails). > > This patch tries to rationalize the APIs of lpm and hash. > > Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
Sorry, I forgot to CC you in the first mail. Do you have any opinion about this rfc patch? Thanks, Olivier