[dpdk-dev] [PATCH v3] hash table: add an iterator over conflicting entries

Wang, Yipeng1 yipeng1.wang at intel.com
Tue Sep 4 21:51:59 CEST 2018


Hmm, I guess my comment is for code readability. If we don’t need the extra state that would be great.

I think "rte_hash" is defined as an internal data structure but expose the type to the public header. Would this work?

I propose to malloc inside function mostly because I think it is cleaner to the user. But your argument is
valid. Depending on use case I think it is OK.

Another comment is you put the total_entry in the state, is it for performance of the rte_hash_iterate?
If you use it to iterate conflict entries, especially If you reuse same "state" struct and init it again and again for different keys,
would this slow down the performance for your specific use case? 

Also iterate_conflic_entry may need reader lock protection.

Thanks
Yipeng

>-----Original Message-----
>From: Michel Machado [mailto:michel at digirati.com.br]
>Sent: Tuesday, September 4, 2018 12:08 PM
>To: Wang, Yipeng1 <yipeng1.wang at intel.com>; Qiaobin Fu <qiaobinf at bu.edu>; Richardson, Bruce <bruce.richardson at intel.com>; De
>Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
>Cc: dev at dpdk.org; doucette at bu.edu; Wiles, Keith <keith.wiles at intel.com>; Gobriel, Sameh <sameh.gobriel at intel.com>; Tai, Charlie
><charlie.tai at intel.com>; stephen at networkplumber.org; nd at arm.com; honnappa.nagarahalli at arm.com
>Subject: Re: [PATCH v3] hash table: add an iterator over conflicting entries
>
>Hi Yipeng,
>
>On 09/04/2018 02:55 PM, Wang, Yipeng1 wrote:
>> Do we need both of the state and istate struct? struct rte_hash_iterator_state  seems not doing much.
>> How about we only have one "state" struct and just not expose the internals to the public API, similar to the
>> rte_hash struct or rte_member_setsum struct.
>> And in _init function use rte_malloc to allocate the state and add a _free function to free it.
>
>    The purpose of have struct state is to enable applications to
>allocate iterator states on their execution stack or embedding iterator
>states in larger structs to avoid an extra malloc()/free().
>
>    Do you foresee that the upcoming new underlying algorithm of hash
>tables will need to dynamically allocate iterator states?
>
>[ ]'s
>Michel Machado


More information about the dev mailing list