DPDK usage discussions
 help / color / mirror / Atom feed
From: Ali Volkan Atli <Volkan.Atli@argela.com.tr>
To: "users@dpdk.org" <users@dpdk.org>
Cc: Ali Volkan Atli <Volkan.Atli@argela.com.tr>
Subject: [dpdk-users] L3 Forwarding Exact Match Timeout
Date: Thu, 1 Mar 2018 08:05:14 +0000	[thread overview]
Message-ID: <e1077acf1d774908bd614f313ea69cc5@MX1.argela.com.tr> (raw)

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

                 reply	other threads:[~2018-03-01  8:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1077acf1d774908bd614f313ea69cc5@MX1.argela.com.tr \
    --to=volkan.atli@argela.com.tr \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).