[dpdk-users] L3 Forwarding Exact Match Timeout

Ali Volkan Atli Volkan.Atli at argela.com.tr
Thu Mar 1 09:05:14 CET 2018


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


More information about the users mailing list