Yuliang, > Get it. It use spinlock (in vppinfra/bihash_template.c): > > while (__sync_lock_test_and_set (h->writer_lock, 1)) > > On Mon, Oct 16, 2017 at 11:39 AM, Yuliang Li <[email protected]> wrote: > Hi all, > > I am curious in the SNAT implementation. I see that SNAT's hash tables are > shared by all worker threads. Does SNAT use lock to avoid multiple threads > updating the hash table concurrently? If not, how does it avoid race > condition?
Are you on latest?
The "global" NAT state space is essentially split across all workers. So there
is no locking.
typedef struct {
/* Main lookup tables */
clib_bihash_8_8_t out2in;
clib_bihash_8_8_t in2out;
/* Find-a-user => src address lookup */
clib_bihash_8_8_t user_hash;
/* User pool */
snat_user_t * users;
/* Session pool */
snat_session_t * sessions;
/* Pool of doubly-linked list elements */
dlist_elt_t * list_pool;
u32 snat_thread_index;
} snat_main_per_thread_data_t;
Best regards,
Ole
signature.asc
Description: Message signed with OpenPGP
_______________________________________________ vpp-dev mailing list [email protected] https://lists.fd.io/mailman/listinfo/vpp-dev
