Skip to content

drivers: hv: use new api for channel callbacks with hv drivers#5

Closed
rlmenge wants to merge 2 commits intorust-nextfrom
rlmenge/new-callback-api
Closed

drivers: hv: use new api for channel callbacks with hv drivers#5
rlmenge wants to merge 2 commits intorust-nextfrom
rlmenge/new-callback-api

Conversation

@rlmenge
Copy link
Copy Markdown
Owner

@rlmenge rlmenge commented Oct 5, 2023

This patchset introduces new function apis for "vmbus_open" as "vmbus_open_channel" and "vmbus_connect_ring" as "vmbus_connect_ring_channel" which add an additional parameter for the vmbus channel. The current api passes the channel as a part of the context. 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

  • __vmbus_open

    • now accepts a boolean on if it should use the v1 callback api
  • vmbus_channel struct

    • original callback function renamed to onchannel_callback_v1
      void (*onchannel_callback)(void *context); -> void (*onchannel_callback_v1)(void *context);
    • added new callback function which requires context and channel
      typedef void onchannel_t(void *context, struct vmbus_channel *chan);
      void (*onchannel_callback_v1)(void *context);

Checks:

  • Builds with CONFIG_HYPERV
  • Builds without CONFIG_HYPERV

TODO

  • clean up commits
  • finish all hv drivers
  • cleanup v1 api
  • test
  • send to linux-hyperv

@rlmenge
Copy link
Copy Markdown
Owner Author

rlmenge commented Jun 14, 2024

close in favor of #6

@rlmenge rlmenge closed this Jun 14, 2024
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