Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about ofp_tcp_syncache #227

Open
Nesyan opened this issue Jul 11, 2019 · 1 comment
Open

question about ofp_tcp_syncache #227

Nesyan opened this issue Jul 11, 2019 · 1 comment

Comments

@Nesyan
Copy link

Nesyan commented Jul 11, 2019

Hi,
I want to define a variable for counting received packets in ofp_tcp_syncache.c file.
how can I do that? Do I need to use a lock? how?

thanks in advance

@MatiasElo
Copy link
Contributor

For counters you can use ODP atomics instead of locks.

E.g.

	odp_atomic_u64_t pkt_count;
	uint64_t cur_pkt_count;

	odp_atomic_init_u64(&pkt_count, 0);

	odp_atomic_inc_u64(&pkt_count);

	cur_pkt_count = odp_atomic_load_u64(&pkt_count);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants