--*/
int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel,
- PAGE_BUFFER PageBuffers[],
+ struct hv_page_buffer PageBuffers[],
u32 PageCount,
void * Buffer,
u32 BufferLen,
DumpVmbusChannel(Channel);
/* Adjust the size down since VMBUS_CHANNEL_PACKET_PAGE_BUFFER is the largest size we support */
- descSize = sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER) - ((MAX_PAGE_BUFFER_COUNT - PageCount)*sizeof(PAGE_BUFFER));
+ descSize = sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER) - ((MAX_PAGE_BUFFER_COUNT - PageCount)*sizeof(struct hv_page_buffer));
packetLen = descSize + BufferLen;
packetLenAligned = ALIGN_UP(packetLen, sizeof(u64));
--*/
int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel,
- MULTIPAGE_BUFFER *MultiPageBuffer,
+ struct hv_multipage_buffer *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
u64 RequestId
u64 TransactionId;
u32 Reserved;
u32 RangeCount;
- PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT];
+ struct hv_page_buffer Range[MAX_PAGE_BUFFER_COUNT];
} __attribute__((packed));
/* The format must be the same as VMDATA_GPA_DIRECT */
u64 TransactionId;
u32 Reserved;
u32 RangeCount; /* Always 1 in this case */
- MULTIPAGE_BUFFER Range;
+ struct hv_multipage_buffer Range;
} __attribute__((packed));
u32 Flags);
extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
- PAGE_BUFFER PageBuffers[],
+ struct hv_page_buffer PageBuffers[],
u32 PageCount,
void *Buffer,
u32 BufferLen,
u64 RequestId);
extern int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
- MULTIPAGE_BUFFER *MultiPageBuffer,
+ struct hv_multipage_buffer *mpb,
void *Buffer,
u32 BufferLen,
u64 RequestId);
static int
IVmbusChannelSendPacketPageBuffer(
struct hv_device *Device,
- PAGE_BUFFER PageBuffers[],
+ struct hv_page_buffer PageBuffers[],
u32 PageCount,
void * Buffer,
u32 BufferLen,
static int
IVmbusChannelSendPacketMultiPageBuffer(
struct hv_device *Device,
- MULTIPAGE_BUFFER *MultiPageBuffer,
+ struct hv_multipage_buffer *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
u64 RequestId
}
-void GetChannelInterface(VMBUS_CHANNEL_INTERFACE *ChannelInterface)
+void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface)
{
ChannelInterface->Open = IVmbusChannelOpen;
ChannelInterface->Close = IVmbusChannelClose;
}
-void GetChannelInfo(struct hv_device *Device, DEVICE_INFO *DeviceInfo)
+void GetChannelInfo(struct hv_device *Device, struct hv_device_info *DeviceInfo)
{
struct vmbus_channel_debug_info debugInfo;
#include "include/VmbusApi.h"
-void GetChannelInterface(VMBUS_CHANNEL_INTERFACE *ChannelInterface);
+void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface);
-void GetChannelInfo(struct hv_device *Device, DEVICE_INFO *DeviceInfo);
+void GetChannelInfo(struct hv_device *Device, struct hv_device_info *DeviceInfo);
#endif /* _CHANNEL_INTERFACE_H_ */
for (i=0; i < NETVSC_RECEIVE_PACKETLIST_COUNT; i++)
{
- packet = kzalloc(sizeof(struct hv_netvsc_packet) + (NETVSC_RECEIVE_SG_COUNT* sizeof(PAGE_BUFFER)), GFP_KERNEL);
+ packet = kzalloc(sizeof(struct hv_netvsc_packet) + (NETVSC_RECEIVE_SG_COUNT* sizeof(struct hv_page_buffer)), GFP_KERNEL);
if (!packet)
{
DPRINT_DBG(NETVSC, "unable to allocate netvsc pkts for receive pool (wanted %d got %d)", NETVSC_RECEIVE_PACKETLIST_COUNT, i);
/* Simplify allocation by having a netvsc packet inline */
struct hv_netvsc_packet Packet;
- PAGE_BUFFER Buffer;
+ struct hv_page_buffer Buffer;
/* FIXME: We assumed a fixed size request here. */
struct rndis_message RequestMessage;
} RNDIS_REQUEST;
/* Internal routines */
-static void
-VmbusGetChannelInterface(
- VMBUS_CHANNEL_INTERFACE *Interface
- );
+static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface);
static void
VmbusGetChannelInfo(
struct hv_device *DeviceObject,
- DEVICE_INFO *DeviceInfo
+ struct hv_device_info *DeviceInfo
);
static void
struct hv_driver *drv
)
{
- VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv;
+ struct vmbus_driver *driver = (struct vmbus_driver *)drv;
int ret=0;
DPRINT_ENTER(VMBUS);
Get the channel interface
--*/
-static void
-VmbusGetChannelInterface(
- VMBUS_CHANNEL_INTERFACE *Interface
- )
+static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface)
{
GetChannelInterface(Interface);
}
/*++;
Name:
- VmbusGetChannelInterface()
+ VmbusGetChannelInfo()
Description:
Get the device info for the specified device object
static void
VmbusGetChannelInfo(
struct hv_device *DeviceObject,
- DEVICE_INFO *DeviceInfo
+ struct hv_device_info *DeviceInfo
)
{
GetChannelInfo(DeviceObject, DeviceInfo);
struct hv_guid *DeviceInstance,
void *Context)
{
- VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
+ struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
return vmbusDriver->OnChildDeviceCreate(
DeviceType,
--*/
int VmbusChildDeviceAdd(struct hv_device *ChildDevice)
{
- VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
+ struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
return vmbusDriver->OnChildDeviceAdd(gDevice, ChildDevice);
}
--*/
void VmbusChildDeviceRemove(struct hv_device *ChildDevice)
{
- VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
+ struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
vmbusDriver->OnChildDeviceRemove(ChildDevice);
}
struct hv_device *ChildDevice
)
{
-VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
+ struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
-vmbusDriver->OnChildDeviceDestroy(ChildDevice);
+ vmbusDriver->OnChildDeviceDestroy(ChildDevice);
}
************* */
struct hv_driver *drv
)
{
- /* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */
+ /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
DPRINT_ENTER(VMBUS);
struct hv_driver *drv
)
{
- /* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */
+ /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
int ret=0;
/* struct page* page; */
u32 TotalDataBufferLength;
/* Points to the send/receive buffer where the ethernet frame is */
u32 PageBufferCount;
- PAGE_BUFFER PageBuffers[NETVSC_PACKET_MAXPAGE];
+ struct hv_page_buffer PageBuffers[NETVSC_PACKET_MAXPAGE];
};
/* This points to the memory after DataBuffer */
void * Extension;
- MULTIPAGE_BUFFER DataBuffer;
+ struct hv_multipage_buffer DataBuffer;
};
#pragma pack(push, 1)
/* Single-page buffer */
-typedef struct _PAGE_BUFFER {
+struct hv_page_buffer {
u32 Length;
u32 Offset;
u64 Pfn;
-} PAGE_BUFFER;
+};
/* Multiple-page buffer */
-typedef struct _MULTIPAGE_BUFFER {
+struct hv_multipage_buffer {
/* Length and Offset determines the # of pfns in the array */
u32 Length;
u32 Offset;
u64 PfnArray[MAX_MULTIPAGE_BUFFER_COUNT];
-} MULTIPAGE_BUFFER;
+};
/* 0x18 includes the proprietary packet header */
#define MAX_PAGE_BUFFER_PACKET (0x18 + \
- (sizeof(PAGE_BUFFER) * \
+ (sizeof(struct hv_page_buffer) * \
MAX_PAGE_BUFFER_COUNT))
-#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + sizeof(MULTIPAGE_BUFFER))
+#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \
+ sizeof(struct hv_multipage_buffer))
#pragma pack(pop)
typedef void (*PFN_ON_DPC)(struct hv_driver *drv);
typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
-typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)
+typedef struct hv_device * (*PFN_ON_CHILDDEVICE_CREATE)
(struct hv_guid *DeviceType,
struct hv_guid *DeviceInstance,
void *Context);
u32 Type,
u32 Flags);
typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(struct hv_device *Device,
- PAGE_BUFFER PageBuffers[],
- u32 PageCount,
- void *Buffer,
- u32 BufferLen,
- u64 RequestId);
-typedef int(*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)
+ struct hv_page_buffer PageBuffers[],
+ u32 PageCount,
+ void *Buffer,
+ u32 BufferLen,
+ u64 RequestId);
+typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)
(struct hv_device *Device,
- MULTIPAGE_BUFFER *MultiPageBuffer,
+ struct hv_multipage_buffer *mpb,
void *Buffer,
u32 BufferLen,
u64 RequestId);
u32 GpadlHandle);
-typedef struct _PORT_INFO {
+struct hv_dev_port_info {
u32 InterruptMask;
u32 ReadIndex;
u32 WriteIndex;
u32 BytesAvailToRead;
u32 BytesAvailToWrite;
-} PORT_INFO;
+};
-typedef struct _DEVICE_INFO {
+struct hv_device_info {
u32 ChannelId;
u32 ChannelState;
struct hv_guid ChannelType;
u32 ClientMonitorLatency;
u32 ClientMonitorConnectionId;
- PORT_INFO Inbound;
- PORT_INFO Outbound;
-} DEVICE_INFO;
+ struct hv_dev_port_info Inbound;
+ struct hv_dev_port_info Outbound;
+};
typedef void (*VMBUS_GET_CHANNEL_INFO)(struct hv_device *Device,
- DEVICE_INFO *DeviceInfo);
+ struct hv_device_info *DeviceInfo);
-typedef struct _VMBUS_CHANNEL_INTERFACE {
+struct vmbus_channel_interface {
VMBUS_CHANNEL_OPEN Open;
VMBUS_CHANNEL_CLOSE Close;
VMBUS_CHANNEL_SEND_PACKET SendPacket;
VMBUS_CHANNEL_ESTABLISH_GPADL EstablishGpadl;
VMBUS_CHANNEL_TEARDOWN_GPADL TeardownGpadl;
VMBUS_GET_CHANNEL_INFO GetInfo;
-} VMBUS_CHANNEL_INTERFACE;
+};
-typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(VMBUS_CHANNEL_INTERFACE *Interface);
+typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(struct vmbus_channel_interface *i);
/* Base driver object */
struct hv_driver {
PFN_ON_GETDEVICEIDS OnGetDeviceIds;
PFN_ON_CLEANUP OnCleanup;
- VMBUS_CHANNEL_INTERFACE VmbusChannelInterface;
+ struct vmbus_channel_interface VmbusChannelInterface;
};
/* Base device object */
};
/* Vmbus driver object */
-typedef struct _VMBUS_DRIVER_OBJECT {
+struct vmbus_driver {
/* !! Must be the 1st field !! */
/* FIXME if ^, then someone is doing somthing stupid */
struct hv_driver Base;
VMBUS_GET_CHANNEL_INTERFACE GetChannelInterface;
VMBUS_GET_CHANNEL_INFO GetChannelInfo;
-} VMBUS_DRIVER_OBJECT;
+};
int VmbusInitialize(struct hv_driver *drv);
num_frags = skb_shinfo(skb)->nr_frags + 1 + net_drv_obj->AdditionalRequestPageBufferCount;
/* Allocate a netvsc packet based on # of frags. */
- packet = kzalloc(sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(PAGE_BUFFER)) + net_drv_obj->RequestExtSize, GFP_ATOMIC);
+ packet = kzalloc(sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(struct hv_page_buffer)) + net_drv_obj->RequestExtSize, GFP_ATOMIC);
if (!packet)
{
DPRINT_ERR(NETVSC_DRV, "unable to allocate hv_netvsc_packet");
return -1;
}
- packet->Extension = (void*)(unsigned long)packet + sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(PAGE_BUFFER)) ;
+ packet->Extension = (void*)(unsigned long)packet + sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(struct hv_page_buffer)) ;
/* Setup the rndis header */
packet->PageBufferCount = num_frags;
int vmbus_child_driver_register(struct driver_context *driver_ctx);
void vmbus_child_driver_unregister(struct driver_context *driver_ctx);
-void vmbus_get_interface(VMBUS_CHANNEL_INTERFACE *interface);
+void vmbus_get_interface(struct vmbus_channel_interface *interface);
#endif /* _VMBUS_H_ */
/* The driver field is not used in here. Instead, the bus field is */
/* used to represent the driver */
struct driver_context drv_ctx;
- VMBUS_DRIVER_OBJECT drv_obj;
+ struct vmbus_driver drv_obj;
struct bus_type bus;
struct tasklet_struct msg_dpc;
static void vmbus_child_device_destroy(struct hv_device *device_obj);
static int vmbus_child_device_register(struct hv_device *root_device_obj, struct hv_device *child_device_obj);
static void vmbus_child_device_unregister(struct hv_device *child_device_obj);
-static void vmbus_child_device_get_info(struct hv_device *device_obj, DEVICE_INFO *device_info);
+static void vmbus_child_device_get_info(struct hv_device *device_obj, struct hv_device_info *device_info);
/* static ssize_t vmbus_show_class_id(struct device *dev, struct device_attribute *attr, char *buf); */
/* static ssize_t vmbus_show_device_id(struct device *dev, struct device_attribute *attr, char *buf); */
static ssize_t vmbus_show_device_attr(struct device *dev, struct device_attribute *dev_attr, char *buf)
{
struct device_context *device_ctx = device_to_device_context(dev);
- DEVICE_INFO device_info;
+ struct hv_device_info device_info;
- memset(&device_info, 0, sizeof(DEVICE_INFO));
+ memset(&device_info, 0, sizeof(struct hv_device_info));
vmbus_child_device_get_info(&device_ctx->device_obj, &device_info);
unsigned int vector=0;
struct vmbus_driver_context *vmbus_drv_ctx=&g_vmbus_drv;
- VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
+ struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
struct device_context *dev_ctx=&g_vmbus_drv.device_ctx;
--*/
static void vmbus_bus_exit(void)
{
- VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
+ struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
struct vmbus_driver_context *vmbus_drv_ctx=&g_vmbus_drv;
struct device_context *dev_ctx=&g_vmbus_drv.device_ctx;
--*/
int vmbus_child_driver_register(struct driver_context* driver_ctx)
{
- VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
+ struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
int ret;
DPRINT_ENTER(VMBUS_DRV);
Desc: Get the vmbus channel interface. This is invoked by child/client driver that sits
above vmbus
--*/
-void vmbus_get_interface(VMBUS_CHANNEL_INTERFACE *interface)
+void vmbus_get_interface(struct vmbus_channel_interface *interface)
{
- VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
+ struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
vmbus_drv_obj->GetChannelInterface(interface);
}
Desc: Get the vmbus child device info. This is invoked to display various device attributes in sysfs.
--*/
-static void vmbus_child_device_get_info(struct hv_device *device_obj, DEVICE_INFO *device_info)
+static void vmbus_child_device_get_info(struct hv_device *device_obj, struct hv_device_info *device_info)
{
- VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
+ struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
vmbus_drv_obj->GetChannelInfo(device_obj, device_info);
}
--*/
static void vmbus_msg_dpc(unsigned long data)
{
- VMBUS_DRIVER_OBJECT* vmbus_drv_obj = (VMBUS_DRIVER_OBJECT*)data;
+ struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data;
DPRINT_ENTER(VMBUS_DRV);
--*/
static void vmbus_event_dpc(unsigned long data)
{
- VMBUS_DRIVER_OBJECT* vmbus_drv_obj = (VMBUS_DRIVER_OBJECT*)data;
+ struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data;
DPRINT_ENTER(VMBUS_DRV);
static irqreturn_t vmbus_isr(int irq, void* dev_id)
{
int ret=0;
- VMBUS_DRIVER_OBJECT* vmbus_driver_obj = &g_vmbus_drv.drv_obj;
+ struct vmbus_driver *vmbus_driver_obj = &g_vmbus_drv.drv_obj;
DPRINT_ENTER(VMBUS_DRV);