libtock: add util/streaming_process_slice#492
Merged
Conversation
e9a2c17 to
c6ed0ed
Compare
c6ed0ed to
3f29461
Compare
brghena
requested changes
Feb 17, 2025
Contributor
brghena
left a comment
There was a problem hiding this comment.
This makes sense to me. Pretty reasonably clean interface, with an excellently documented implementation. A couple of questions for you.
brghena
reviewed
Feb 17, 2025
a3e0c8e to
aa58332
Compare
This adds userspace helpers implementing the "streaming process slice" contract as implemented in the Tock kernel in [1]. Instead of working with two separate buffers, these helpers present an interface similar to a regular read-write allow based on a single buffer. Internally, this buffer is then subdivided into an "application-owned" and "kernel-owned" part which are swapped atomically. The caller is responsible for keeping a `streaming_process_slice_state_t`, and is provided with ephemeral references to the kernel-written payloads on each swap operation. The full, original buffer can be reclaimed by deinitializing the `streaming_process_slice_state_t` struct. Currently, these helpers are quite minimal and do not expose the ability to set any optional flags (such as `halt`). They are tested to work against against the interface implemented in [1] (with the fix of [2] included) as part of the LwIP Ethernet tap-driver userspace app. [1]: tock/tock#4208 [2]: tock/tock#4343
lschuermann
added a commit
that referenced
this pull request
Feb 21, 2025
Instead of internally splitting a single buffer to create two halves used in the streaming process slice abstraction, this changes it to accept two separate buffers for the kernel- and application-owned buffer respectively. This was discussed on the pull request introducing this abstraction: #492 (comment) Suggested-by: Branden Ghena <branden.ghena@gmail.com>
aa58332 to
5c24a44
Compare
brghena
requested changes
Feb 24, 2025
Contributor
brghena
left a comment
There was a problem hiding this comment.
A couple of changes for you.
I do think this is cleaner, although again if no one else cares I'm fine going with your single-buffer implementation instead.
brghena
reviewed
Feb 24, 2025
brghena
previously approved these changes
Feb 24, 2025
Instead of internally splitting a single buffer to create two halves used in the streaming process slice abstraction, this changes it to accept two separate buffers for the kernel- and application-owned buffer respectively. This was discussed on the pull request introducing this abstraction: #492 (comment) Suggested-by: Branden Ghena <branden.ghena@gmail.com>
ddb74c6 to
1a64253
Compare
brghena
approved these changes
Feb 24, 2025
bradjc
approved these changes
Feb 24, 2025
alexandruradovici
approved these changes
Feb 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds userspace helpers implementing the "streaming process slice" contract as implemented in the Tock kernel in 1. Instead of working with two separate buffers, these helpers present an interface similar to a regular read-write allow based on a single buffer. Internally, this buffer is then subdivided into an "application-owned" and "kernel-owned" part which are swapped atomically. The caller is responsible for keeping a
streaming_process_slice_state_t, and is provided with ephemeral references to the kernel-written payloads on each swap operation. The full, original buffer can be reclaimed by deinitializing thestreaming_process_slice_state_tstruct.Currently, these helpers are quite minimal and do not expose the ability to set any optional flags (such as
halt). They are tested to work against against the interface implemented in 1 (with the fix of 2 included) as part of the LwIP Ethernet tap-driver userspace app.