summaryrefslogtreecommitdiffstats
path: root/drivers/staging/hv/channel_interface.c
blob: 4032e9c46f20c40c2d07237f12a5363715988e4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 *
 * Copyright (c) 2009, Microsoft Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307 USA.
 *
 * Authors:
 *   Haiyang Zhang <haiyangz@microsoft.com>
 *   Hank Janssen  <hjanssen@microsoft.com>
 *
 */
#include <linux/kernel.h>
#include <linux/mm.h>
#include "osd.h"
#include "vmbus_private.h"

static int ivmbus_open(struct hv_device *device, u32 sendbuffer_size,
			     u32 recv_ringbuffer_size, void *userdata,
			     u32 userdatalen,
			     void (*channel_callback)(void *context),
			     void *context)
{
	return vmbus_open(device->channel, sendbuffer_size,
				recv_ringbuffer_size, userdata, userdatalen,
				channel_callback, context);
}

static void ivmbus_close(struct hv_device *device)
{
	vmbus_close(device->channel);
}

static int ivmbus_sendpacket(struct hv_device *device, const void *buffer,
				   u32 bufferlen, u64 requestid, u32 type,
				   u32 flags)
{
	return vmbus_sendpacket(device->channel, buffer, bufferlen,
				      requestid, type, flags);
}

static int ivmbus_sendpacket_pagebuffer(struct hv_device *device,
				struct hv_page_buffer pagebuffers[],
				u32 pagecount, void *buffer,
				u32 bufferlen, u64 requestid)
{
	return vmbus_sendpacket_pagebuffer(device->channel, pagebuffers,
						pagecount, buffer, bufferlen,
						requestid);
}

/* vmbus interface function pointer table */
const struct vmbus_channel_interface vmbus_ops = {
	.Open = ivmbus_open,
	.Close = ivmbus_close,
	.SendPacket = ivmbus_sendpacket,
	.SendPacketPageBuffer = ivmbus_sendpacket_pagebuffer,
};