Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection
Subsystems (3)
Dexuan Cui
maintainerPATCH v2 4/7 Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection
With the 2 APIs supplied by the VMBus driver, the coming net/hvsock driver can register 2 callbacks and can know when a new hvsock connection is offered by the host, and when a hvsock connection is being closed by the host.
Signed-off-by Dexuan Cui <[email protected]>
--- drivers/hv/Makefile | 4 ++- drivers/hv/channel_mgmt.c | 9 ++++++ drivers/hv/hvsock_callbacks.c | 71 +++++++++++++++++++++++++++++++++++++++++++ include/linux/hyperv.h | 9 ++++++ 4 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 drivers/hv/hvsock_callbacks.c
drivers/hv/Makefile +3 -1
@@ -4,5 +4,7 @@ obj-$(CONFIG_HYPERV_BALLOON) += hv_balloon.o hv_vmbus-y := vmbus_drv.o \ hv.o connection.o channel.o \ - channel_mgmt.o ring_buffer.o + channel_mgmt.o ring_buffer.o \ + hvsock_callbacks.o + hv_utils-y := hv_util.o hv_kvp.o hv_snapshot.o hv_fcopy.o hv_utils_transport.o
drivers/hv/channel_mgmt.c +9 -0
@@ -300,6 +300,12 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)return ; } +if (is_hvsock_channel (newchannel)) { +if (hvsock_process_offer (newchannel) !=0 ) + goto err_deq_chan; +return ; + } +/* * Start the process of binding this offer to the driver * We need to set the DeviceObject field before calling
@@ -564,7 +570,10 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)vmbus_device_unregister (channel->device_obj);put_device (dev); } + }else if (is_hvsock_channel (channel)) { +hvsock_process_offer_rescind (channel); }else { +/* it is a sub-channel. */ hv_process_channel_removal (channel, channel->offermsg.child_relid); }
drivers/hv/hvsock_callbacks.c new file +71 -0
71 lines not on this page · raw message
include/linux/hyperv.h +9 -0
@@ -1270,6 +1270,15 @@ extern __u32 vmbus_proto_version;int vmbus_send_tl_connect_request (const uuid_le *shv_guest_servie_id,const uuid_le *shv_host_servie_id); +extern int hvsock_process_offer (struct vmbus_channel *channel); +extern void hvsock_process_offer_rescind (struct vmbus_channel *channel); + +extern void vmbus_register_hvsock_callbacks ( +int (*process_offer)(struct vmbus_channel *), +void (*process_offer_rescind)(struct vmbus_channel *)); + +void vmbus_unregister_hvsock_callbacks (void ); +struct vmpipe_proto_header {u32 pkt_type;
Signature · 1 line
2.1.0