DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] L3 Forwarding Exact Match Timeout
@ 2018-03-01  8:05 Ali Volkan Atli
  0 siblings, 0 replies; only message in thread
From: Ali Volkan Atli @ 2018-03-01  8:05 UTC (permalink / raw)
  To: users; +Cc: Ali Volkan Atli

Hi 

I'm trying to understand l3fwd application for exact match case. It only adds keys into hash but never deletes them. So I just want to delete entries according to a timeout by iterating through the hash table. But I have many entries and I don't want to iterate the hash table in a lump, I need to sweep it piece by piece in another thread during adding continuing. So does the following pseudo code work in multithread cases?

adding_thread
{
    while (1) {
        ...
        rte_hash_add_key_data(handle, key, data); // data has a last_seen timeout
        ...
    }
}

sweeping_thread
{
    static uint32_t sweep_iter = 0;
    const void *next_key;
    void *next_data;

    for (int i = 0; i < SWEEP_CNT; ++i) {
        ...
        rte_hash_iterate(handle, &next_key, &next_data, &sweep_iter)
        sweep_iter = (sweep_iter + 1) & HASH_MASK
        if (current_time - next_data->timeout > TIMEOUT)
            rte_hash_del_key(handle, (void *)&next_key);
        ...
    }
}


Thanks in advance.

- Volkan

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-01  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01  8:05 [dpdk-users] L3 Forwarding Exact Match Timeout Ali Volkan Atli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).