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

[PATCH v3] linux-gen: ring: fix ring size detection #1882

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

MatiasElo
Copy link
Collaborator

Previously, _RING_MPMC_ENQ_MULTI() and _RING_MPMC_ENQ_BATCH() could return
zero even though the ring was not actually full. Read w_head before r_tail,
which guarantees that w_head - r_tail <= size. Any additional delay in
reading r_tail makes the subtraction result only smaller. This avoids
returning zero when the ring is not actually full.

@odpbuild odpbuild changed the title linux-gen: ring: fix ring size detection [PATCH v1] linux-gen: ring: fix ring size detection Aug 23, 2023
@odpbuild odpbuild changed the title [PATCH v1] linux-gen: ring: fix ring size detection [PATCH v2] linux-gen: ring: fix ring size detection Aug 23, 2023
Previously, _RING_MPMC_ENQ_MULTI() and _RING_MPMC_ENQ_BATCH() could return
zero even though the ring was not actually full. Read w_head before r_tail,
which guarantees that w_head - r_tail <= size. Any additional delay in
reading r_tail makes the subtraction result only smaller. This avoids
returning zero when the ring is not actually full.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reported-by: Fan Hong <fan.hong@arm.com>
Improve ring documentation by adding additional example figures of ring
operation.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
@odpbuild odpbuild changed the title [PATCH v2] linux-gen: ring: fix ring size detection [PATCH v3] linux-gen: ring: fix ring size detection Aug 24, 2023
@MatiasElo MatiasElo merged commit 5413bb6 into OpenDataPlane:master Aug 24, 2023
174 checks passed
@MatiasElo MatiasElo deleted the fix/mpmc_ring branch August 24, 2023 10:31
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

Successfully merging this pull request may close these issues.

2 participants