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

io_uring_cqe_shift comment. #1129

Open
YoSTEALTH opened this issue Apr 17, 2024 · 3 comments
Open

io_uring_cqe_shift comment. #1129

YoSTEALTH opened this issue Apr 17, 2024 · 3 comments

Comments

@YoSTEALTH
Copy link
Contributor

Testing io_uring_cqe_shift, The comment says:

  • for standard CQE its 1
  • for big CQE its 2

I am actually getting 0 for standard cqe, and 1 when using IORING_SETUP_CQE32. Comment should be fixed? Maybe a test?

@alviroiskandar
Copy link
Contributor

That's used for bit shift operation in io_uring_cqe_index().

#define io_uring_cqe_index(ring,ptr,mask) \
	(((ptr) & (mask)) << io_uring_cqe_shift(ring))

n << 0 is the same as n * 1
n << 1 is the same as n * 2

So basically, 0 means multiply by 1, and 1 means multiply by 2.

@YoSTEALTH
Copy link
Contributor Author

@alviroiskandar Makes sense. So the comment the should be above io_uring_cqe_index

@isilence
Copy link
Collaborator

Yes, the comment should change. The entire 2nd line can be killed, these 1/2 description tries to verbatim repeat what the code does.

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

3 participants