drivers: hv: use new api for channel callbacks with hv drivers #6
Draft
drivers: hv: use new api for channel callbacks with hv drivers #6
Conversation
callbacks today use context to pass around channels. However, this allows for channels to be openned when these callbacks are established. Introduce new api which requires the channel explicitly.
vmbus_open and vmbus_connect_ring have been replaced by vmbus_open_channel and vmbus_connect_ring_channel
2 tasks
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 patchset introduces new function apis for "vmbus_open" and "vmbus_connect_ring". The current api passes the channel as a part of the context. The new functions add an additional parameter for the vmbus channel explicitly. This new function api is in preparation for Rust integration.
Rust code is built to create sound code blocks and to prevent the user from ever entering into undefined behavior. Rust will need a new type state to prevent writing and reading from channels which are not yet open. However, this requires the channel to be separate from the context as the channel may not have been opened yet.
An implementation of this can be seen at https://github.com/wedsonaf/linux/tree/hv
Background
vmbus_channel is given callback function by __vmbus_open
__vmbus_open called by vmbus_open
drvier -> vmbus_add_channel_work -> vmbus_open -> __vmbus_open -> sets channel callback function
API changes
vmbus_open -> vmbus_open_channel
vmbus_connect_ring -> vmbus_connect_ring_channel
internal function changes during trasnsition
__vmbus_open
vmbus_channel struct
onchannel_callback_v1void (*onchannel_callback)(void *context);->void (*onchannel_callback_v1)(void *context);typedef void onchannel_t(void *context, struct vmbus_channel *chan);void (*onchannel_callback_v1)(void *context);Checks:
TODO