Skip to content

[PATCH v1] linux-gen: small rst ring and stash improvements#2362

Open
JannePeltonen wants to merge 3 commits into
OpenDataPlane:masterfrom
JannePeltonen:rst-ring-revamp
Open

[PATCH v1] linux-gen: small rst ring and stash improvements#2362
JannePeltonen wants to merge 3 commits into
OpenDataPlane:masterfrom
JannePeltonen:rst-ring-revamp

Conversation

@JannePeltonen

Copy link
Copy Markdown
Collaborator

Avoid using flexible array members in structs in a way that is not allowed by the C standard and get rid of the pragmas that have been used for suppressing related warnings.

  • Make rst rings similar to other ring flavors by removing the data array from the rst ring header structs and by adding a ring data pointer parameter to the rst ring functions. Update all rst ring users accordingly.
  • Move ring data array to the end of stash_t

Also remove unneeded ring init function pointer from stash_t and change checks for invalid stash handles to assertions in fast path stash functions.

The restricted (rst) ring variants contain ring data as a flexible array
member of the ring header struct. Standard C does not allow flexible array
members that are not the last member of a struct, which generates warnings
and requires multiple pragmas to suppress the warnings where rst rings are
embedded in other structs.

Make rst rings similar to other ring flavors by removing the data array
from the rst ring headers and by adding a ring data pointer parameter to
the rst ring functions. Modify call sites to provide the parameter and
remove the now unneeded pragmas that disable the -Wpedantic warnings.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
C does not allow flexible array members in structs that are contained in
other structs. Make the ring data array common between all ring variants
and move it to the top level in the stash structure and remove suppression
of the -Wpedantic warning.

Also remove ring init function pointer from stash struct since it does
not need to be kept around after stash creation.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Calling fastpath ODP API functions with an ODP_STASH_INVALID handle is not
supported. Replace the checks for invalid handles with assertions to make
the stash put and get functions a little bit smaller and faster.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
@odpbuild odpbuild changed the title linux-gen: small rst ring and stash improvements [PATCH v1] linux-gen: small rst ring and stash improvements Jun 12, 2026
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.

1 participant