Staging: hv: remove typedefs from VmbusPacketFormat.h
All spiffied up now, shines like a brass button on the bump of a barge's bilge. Cc: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
4bedd6be8b
commit
8dc0a06ad1
|
@ -395,13 +395,13 @@ VmbusChannelCreateGpadlHeader(
|
||||||
pfn = virt_to_phys(Kbuffer) >> PAGE_SHIFT;
|
pfn = virt_to_phys(Kbuffer) >> PAGE_SHIFT;
|
||||||
|
|
||||||
/* do we need a gpadl body msg */
|
/* do we need a gpadl body msg */
|
||||||
pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(struct vmbus_channel_gpadl_header) - sizeof(GPA_RANGE);
|
pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(struct vmbus_channel_gpadl_header) - sizeof(struct gpa_range);
|
||||||
pfnCount = pfnSize / sizeof(u64);
|
pfnCount = pfnSize / sizeof(u64);
|
||||||
|
|
||||||
if (pageCount > pfnCount) /* we need a gpadl body */
|
if (pageCount > pfnCount) /* we need a gpadl body */
|
||||||
{
|
{
|
||||||
/* fill in the header */
|
/* fill in the header */
|
||||||
msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64);
|
msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(struct gpa_range) + pfnCount*sizeof(u64);
|
||||||
msgHeader = kzalloc(msgSize, GFP_KERNEL);
|
msgHeader = kzalloc(msgSize, GFP_KERNEL);
|
||||||
|
|
||||||
INITIALIZE_LIST_HEAD(&msgHeader->SubMsgList);
|
INITIALIZE_LIST_HEAD(&msgHeader->SubMsgList);
|
||||||
|
@ -409,7 +409,7 @@ VmbusChannelCreateGpadlHeader(
|
||||||
|
|
||||||
gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
|
gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
|
||||||
gpaHeader->RangeCount = 1;
|
gpaHeader->RangeCount = 1;
|
||||||
gpaHeader->RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(u64);
|
gpaHeader->RangeBufLen = sizeof(struct gpa_range) + pageCount*sizeof(u64);
|
||||||
gpaHeader->Range[0].ByteOffset = 0;
|
gpaHeader->Range[0].ByteOffset = 0;
|
||||||
gpaHeader->Range[0].ByteCount = Size;
|
gpaHeader->Range[0].ByteCount = Size;
|
||||||
for (i=0; i<pfnCount; i++)
|
for (i=0; i<pfnCount; i++)
|
||||||
|
@ -461,13 +461,13 @@ VmbusChannelCreateGpadlHeader(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* everything fits in a header */
|
/* everything fits in a header */
|
||||||
msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(GPA_RANGE) + pageCount*sizeof(u64);
|
msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(struct gpa_range) + pageCount*sizeof(u64);
|
||||||
msgHeader = kzalloc(msgSize, GFP_KERNEL);
|
msgHeader = kzalloc(msgSize, GFP_KERNEL);
|
||||||
msgHeader->MessageSize=msgSize;
|
msgHeader->MessageSize=msgSize;
|
||||||
|
|
||||||
gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
|
gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
|
||||||
gpaHeader->RangeCount = 1;
|
gpaHeader->RangeCount = 1;
|
||||||
gpaHeader->RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(u64);
|
gpaHeader->RangeBufLen = sizeof(struct gpa_range) + pageCount*sizeof(u64);
|
||||||
gpaHeader->Range[0].ByteOffset = 0;
|
gpaHeader->Range[0].ByteOffset = 0;
|
||||||
gpaHeader->Range[0].ByteCount = Size;
|
gpaHeader->Range[0].ByteCount = Size;
|
||||||
for (i=0; i<pageCount; i++)
|
for (i=0; i<pageCount; i++)
|
||||||
|
@ -730,13 +730,13 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel,
|
||||||
const void * Buffer,
|
const void * Buffer,
|
||||||
u32 BufferLen,
|
u32 BufferLen,
|
||||||
u64 RequestId,
|
u64 RequestId,
|
||||||
VMBUS_PACKET_TYPE Type,
|
enum vmbus_packet_type Type,
|
||||||
u32 Flags
|
u32 Flags
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int ret=0;
|
int ret=0;
|
||||||
VMPACKET_DESCRIPTOR desc;
|
struct vmpacket_descriptor desc;
|
||||||
u32 packetLen = sizeof(VMPACKET_DESCRIPTOR) + BufferLen;
|
u32 packetLen = sizeof(struct vmpacket_descriptor) + BufferLen;
|
||||||
u32 packetLenAligned = ALIGN_UP(packetLen, sizeof(u64));
|
u32 packetLenAligned = ALIGN_UP(packetLen, sizeof(u64));
|
||||||
struct scatterlist bufferList[3];
|
struct scatterlist bufferList[3];
|
||||||
u64 alignedData=0;
|
u64 alignedData=0;
|
||||||
|
@ -751,12 +751,12 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel,
|
||||||
/* Setup the descriptor */
|
/* Setup the descriptor */
|
||||||
desc.Type = Type; /* VmbusPacketTypeDataInBand; */
|
desc.Type = Type; /* VmbusPacketTypeDataInBand; */
|
||||||
desc.Flags = Flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
|
desc.Flags = Flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
|
||||||
desc.DataOffset8 = sizeof(VMPACKET_DESCRIPTOR) >> 3; /* in 8-bytes granularity */
|
desc.DataOffset8 = sizeof(struct vmpacket_descriptor) >> 3; /* in 8-bytes granularity */
|
||||||
desc.Length8 = (u16)(packetLenAligned >> 3);
|
desc.Length8 = (u16)(packetLenAligned >> 3);
|
||||||
desc.TransactionId = RequestId;
|
desc.TransactionId = RequestId;
|
||||||
|
|
||||||
sg_init_table(bufferList,3);
|
sg_init_table(bufferList,3);
|
||||||
sg_set_buf(&bufferList[0], &desc, sizeof(VMPACKET_DESCRIPTOR));
|
sg_set_buf(&bufferList[0], &desc, sizeof(struct vmpacket_descriptor));
|
||||||
sg_set_buf(&bufferList[1], Buffer, BufferLen);
|
sg_set_buf(&bufferList[1], Buffer, BufferLen);
|
||||||
sg_set_buf(&bufferList[2], &alignedData, packetLenAligned - packetLen);
|
sg_set_buf(&bufferList[2], &alignedData, packetLenAligned - packetLen);
|
||||||
|
|
||||||
|
@ -946,7 +946,7 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel,
|
||||||
u32 *BufferActualLen,
|
u32 *BufferActualLen,
|
||||||
u64 *RequestId)
|
u64 *RequestId)
|
||||||
{
|
{
|
||||||
VMPACKET_DESCRIPTOR desc;
|
struct vmpacket_descriptor desc;
|
||||||
u32 packetLen;
|
u32 packetLen;
|
||||||
u32 userLen;
|
u32 userLen;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -959,7 +959,7 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel,
|
||||||
|
|
||||||
spin_lock_irqsave(&Channel->inbound_lock, flags);
|
spin_lock_irqsave(&Channel->inbound_lock, flags);
|
||||||
|
|
||||||
ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(VMPACKET_DESCRIPTOR));
|
ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(struct vmpacket_descriptor));
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
spin_unlock_irqrestore(&Channel->inbound_lock, flags);
|
spin_unlock_irqrestore(&Channel->inbound_lock, flags);
|
||||||
|
@ -1022,7 +1022,7 @@ int VmbusChannelRecvPacketRaw(struct vmbus_channel *Channel,
|
||||||
u64* RequestId
|
u64* RequestId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
VMPACKET_DESCRIPTOR desc;
|
struct vmpacket_descriptor desc;
|
||||||
u32 packetLen;
|
u32 packetLen;
|
||||||
u32 userLen;
|
u32 userLen;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1035,7 +1035,7 @@ int VmbusChannelRecvPacketRaw(struct vmbus_channel *Channel,
|
||||||
|
|
||||||
spin_lock_irqsave(&Channel->inbound_lock, flags);
|
spin_lock_irqsave(&Channel->inbound_lock, flags);
|
||||||
|
|
||||||
ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(VMPACKET_DESCRIPTOR));
|
ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(struct vmpacket_descriptor));
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
spin_unlock_irqrestore(&Channel->inbound_lock, flags);
|
spin_unlock_irqrestore(&Channel->inbound_lock, flags);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "ChannelMgmt.h"
|
#include "ChannelMgmt.h"
|
||||||
|
|
||||||
/* The format must be the same as VMDATA_GPA_DIRECT */
|
/* The format must be the same as struct vmdata_gpa_direct */
|
||||||
struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER {
|
struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER {
|
||||||
u16 Type;
|
u16 Type;
|
||||||
u16 DataOffset8;
|
u16 DataOffset8;
|
||||||
|
@ -39,7 +39,7 @@ struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER {
|
||||||
struct hv_page_buffer Range[MAX_PAGE_BUFFER_COUNT];
|
struct hv_page_buffer Range[MAX_PAGE_BUFFER_COUNT];
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
/* The format must be the same as VMDATA_GPA_DIRECT */
|
/* The format must be the same as struct vmdata_gpa_direct */
|
||||||
struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER {
|
struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER {
|
||||||
u16 Type;
|
u16 Type;
|
||||||
u16 DataOffset8;
|
u16 DataOffset8;
|
||||||
|
@ -66,7 +66,7 @@ extern int VmbusChannelSendPacket(struct vmbus_channel *channel,
|
||||||
const void *Buffer,
|
const void *Buffer,
|
||||||
u32 BufferLen,
|
u32 BufferLen,
|
||||||
u64 RequestId,
|
u64 RequestId,
|
||||||
VMBUS_PACKET_TYPE Type,
|
enum vmbus_packet_type Type,
|
||||||
u32 Flags);
|
u32 Flags);
|
||||||
|
|
||||||
extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
|
extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
|
||||||
|
|
|
@ -92,7 +92,7 @@ NetVscConnectToVsp(
|
||||||
static void
|
static void
|
||||||
NetVscOnSendCompletion(
|
NetVscOnSendCompletion(
|
||||||
struct hv_device *Device,
|
struct hv_device *Device,
|
||||||
VMPACKET_DESCRIPTOR *Packet
|
struct vmpacket_descriptor *Packet
|
||||||
);
|
);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -104,7 +104,7 @@ NetVscOnSend(
|
||||||
static void
|
static void
|
||||||
NetVscOnReceive(
|
NetVscOnReceive(
|
||||||
struct hv_device *Device,
|
struct hv_device *Device,
|
||||||
VMPACKET_DESCRIPTOR *Packet
|
struct vmpacket_descriptor *Packet
|
||||||
);
|
);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -236,8 +236,8 @@ NetVscInitialize(
|
||||||
|
|
||||||
DPRINT_ENTER(NETVSC);
|
DPRINT_ENTER(NETVSC);
|
||||||
|
|
||||||
DPRINT_DBG(NETVSC, "sizeof(struct hv_netvsc_packet)=%zd, sizeof(NVSP_MESSAGE)=%zd, sizeof(VMTRANSFER_PAGE_PACKET_HEADER)=%zd",
|
DPRINT_DBG(NETVSC, "sizeof(struct hv_netvsc_packet)=%zd, sizeof(NVSP_MESSAGE)=%zd, sizeof(struct vmtransfer_page_packet_header)=%zd",
|
||||||
sizeof(struct hv_netvsc_packet), sizeof(NVSP_MESSAGE), sizeof(VMTRANSFER_PAGE_PACKET_HEADER));
|
sizeof(struct hv_netvsc_packet), sizeof(NVSP_MESSAGE), sizeof(struct vmtransfer_page_packet_header));
|
||||||
|
|
||||||
/* Make sure we are at least 2 pages since 1 page is used for control */
|
/* Make sure we are at least 2 pages since 1 page is used for control */
|
||||||
ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1));
|
ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1));
|
||||||
|
@ -991,7 +991,7 @@ NetVscOnCleanup(
|
||||||
static void
|
static void
|
||||||
NetVscOnSendCompletion(
|
NetVscOnSendCompletion(
|
||||||
struct hv_device *Device,
|
struct hv_device *Device,
|
||||||
VMPACKET_DESCRIPTOR *Packet
|
struct vmpacket_descriptor *Packet
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct NETVSC_DEVICE *netDevice;
|
struct NETVSC_DEVICE *netDevice;
|
||||||
|
@ -1109,11 +1109,11 @@ NetVscOnSend(
|
||||||
static void
|
static void
|
||||||
NetVscOnReceive(
|
NetVscOnReceive(
|
||||||
struct hv_device *Device,
|
struct hv_device *Device,
|
||||||
VMPACKET_DESCRIPTOR *Packet
|
struct vmpacket_descriptor *Packet
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct NETVSC_DEVICE *netDevice;
|
struct NETVSC_DEVICE *netDevice;
|
||||||
VMTRANSFER_PAGE_PACKET_HEADER *vmxferpagePacket;
|
struct vmtransfer_page_packet_header *vmxferpagePacket;
|
||||||
NVSP_MESSAGE *nvspPacket;
|
NVSP_MESSAGE *nvspPacket;
|
||||||
struct hv_netvsc_packet *netvscPacket=NULL;
|
struct hv_netvsc_packet *netvscPacket=NULL;
|
||||||
LIST_ENTRY* entry;
|
LIST_ENTRY* entry;
|
||||||
|
@ -1157,7 +1157,7 @@ NetVscOnReceive(
|
||||||
|
|
||||||
DPRINT_DBG(NETVSC, "NVSP packet received - type %d", nvspPacket->Header.MessageType);
|
DPRINT_DBG(NETVSC, "NVSP packet received - type %d", nvspPacket->Header.MessageType);
|
||||||
|
|
||||||
vmxferpagePacket = (VMTRANSFER_PAGE_PACKET_HEADER*)Packet;
|
vmxferpagePacket = (struct vmtransfer_page_packet_header *)Packet;
|
||||||
|
|
||||||
if (vmxferpagePacket->TransferPageSetId != NETVSC_RECEIVE_BUFFER_ID)
|
if (vmxferpagePacket->TransferPageSetId != NETVSC_RECEIVE_BUFFER_ID)
|
||||||
{
|
{
|
||||||
|
@ -1420,7 +1420,7 @@ NetVscOnChannelCallback(
|
||||||
u32 bytesRecvd;
|
u32 bytesRecvd;
|
||||||
u64 requestId;
|
u64 requestId;
|
||||||
unsigned char packet[netPacketSize];
|
unsigned char packet[netPacketSize];
|
||||||
VMPACKET_DESCRIPTOR *desc;
|
struct vmpacket_descriptor *desc;
|
||||||
unsigned char *buffer=packet;
|
unsigned char *buffer=packet;
|
||||||
int bufferlen=netPacketSize;
|
int bufferlen=netPacketSize;
|
||||||
|
|
||||||
|
@ -1451,7 +1451,7 @@ NetVscOnChannelCallback(
|
||||||
{
|
{
|
||||||
DPRINT_DBG(NETVSC, "receive %d bytes, tid %llx", bytesRecvd, requestId);
|
DPRINT_DBG(NETVSC, "receive %d bytes, tid %llx", bytesRecvd, requestId);
|
||||||
|
|
||||||
desc = (VMPACKET_DESCRIPTOR*)buffer;
|
desc = (struct vmpacket_descriptor*)buffer;
|
||||||
switch (desc->Type)
|
switch (desc->Type)
|
||||||
{
|
{
|
||||||
case VmbusPacketTypeCompletion:
|
case VmbusPacketTypeCompletion:
|
||||||
|
|
|
@ -151,7 +151,7 @@ struct vmbus_channel_gpadl_header {
|
||||||
u32 Gpadl;
|
u32 Gpadl;
|
||||||
u16 RangeBufLen;
|
u16 RangeBufLen;
|
||||||
u16 RangeCount;
|
u16 RangeCount;
|
||||||
GPA_RANGE Range[0];
|
struct gpa_range Range[0];
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
/* This is the followup packet that contains more PFNs. */
|
/* This is the followup packet that contains more PFNs. */
|
||||||
|
|
|
@ -23,57 +23,55 @@
|
||||||
|
|
||||||
#ifndef _VMBUSPACKETFORMAT_H_
|
#ifndef _VMBUSPACKETFORMAT_H_
|
||||||
|
|
||||||
typedef struct {
|
struct vmpacket_descriptor {
|
||||||
u16 Type;
|
u16 Type;
|
||||||
u16 DataOffset8;
|
u16 DataOffset8;
|
||||||
u16 Length8;
|
u16 Length8;
|
||||||
u16 Flags;
|
u16 Flags;
|
||||||
u64 TransactionId;
|
u64 TransactionId;
|
||||||
} __attribute__((packed)) VMPACKET_DESCRIPTOR, *PVMPACKET_DESCRIPTOR;
|
} __attribute__((packed));
|
||||||
|
|
||||||
typedef u32 PREVIOUS_PACKET_OFFSET, *PPREVIOUS_PACKET_OFFSET;
|
struct vmpacket_header {
|
||||||
|
u32 PreviousPacketStartOffset;
|
||||||
|
struct vmpacket_descriptor Descriptor;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
typedef struct {
|
struct vmtransfer_page_range {
|
||||||
PREVIOUS_PACKET_OFFSET PreviousPacketStartOffset;
|
|
||||||
VMPACKET_DESCRIPTOR Descriptor;
|
|
||||||
} __attribute__((packed)) VMPACKET_HEADER, *PVMPACKET_HEADER;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
u32 ByteCount;
|
u32 ByteCount;
|
||||||
u32 ByteOffset;
|
u32 ByteOffset;
|
||||||
} __attribute__((packed)) VMTRANSFER_PAGE_RANGE, *PVMTRANSFER_PAGE_RANGE;
|
} __attribute__((packed));
|
||||||
|
|
||||||
typedef struct VMTRANSFER_PAGE_PACKET_HEADER {
|
struct vmtransfer_page_packet_header {
|
||||||
VMPACKET_DESCRIPTOR d;
|
struct vmpacket_descriptor d;
|
||||||
u16 TransferPageSetId;
|
u16 TransferPageSetId;
|
||||||
bool SenderOwnsSet;
|
bool SenderOwnsSet;
|
||||||
u8 Reserved;
|
u8 Reserved;
|
||||||
u32 RangeCount;
|
u32 RangeCount;
|
||||||
VMTRANSFER_PAGE_RANGE Ranges[1];
|
struct vmtransfer_page_range Ranges[1];
|
||||||
} __attribute__((packed)) VMTRANSFER_PAGE_PACKET_HEADER, *PVMTRANSFER_PAGE_PACKET_HEADER;
|
} __attribute__((packed));
|
||||||
|
|
||||||
typedef struct _VMGPADL_PACKET_HEADER {
|
struct vmgpadl_packet_header {
|
||||||
VMPACKET_DESCRIPTOR d;
|
struct vmpacket_descriptor d;
|
||||||
u32 Gpadl;
|
u32 Gpadl;
|
||||||
u32 Reserved;
|
u32 Reserved;
|
||||||
} __attribute__((packed)) VMGPADL_PACKET_HEADER, *PVMGPADL_PACKET_HEADER;
|
} __attribute__((packed));
|
||||||
|
|
||||||
typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET {
|
struct vmadd_remove_transfer_page_set {
|
||||||
VMPACKET_DESCRIPTOR d;
|
struct vmpacket_descriptor d;
|
||||||
u32 Gpadl;
|
u32 Gpadl;
|
||||||
u16 TransferPageSetId;
|
u16 TransferPageSetId;
|
||||||
u16 Reserved;
|
u16 Reserved;
|
||||||
} __attribute__((packed)) VMADD_REMOVE_TRANSFER_PAGE_SET, *PVMADD_REMOVE_TRANSFER_PAGE_SET;
|
} __attribute__((packed));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This structure defines a range in guest physical space that can be made to
|
* This structure defines a range in guest physical space that can be made to
|
||||||
* look virtually contiguous.
|
* look virtually contiguous.
|
||||||
*/
|
*/
|
||||||
typedef struct _GPA_RANGE {
|
struct gpa_range {
|
||||||
u32 ByteCount;
|
u32 ByteCount;
|
||||||
u32 ByteOffset;
|
u32 ByteOffset;
|
||||||
u64 PfnArray[0];
|
u64 PfnArray[0];
|
||||||
} GPA_RANGE, *PGPA_RANGE;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the format for an Establish Gpadl packet, which contains a handle by
|
* This is the format for an Establish Gpadl packet, which contains a handle by
|
||||||
|
@ -82,71 +80,65 @@ typedef struct _GPA_RANGE {
|
||||||
* ranges, then the resulting MDL will be "chained," representing multiple VA
|
* ranges, then the resulting MDL will be "chained," representing multiple VA
|
||||||
* ranges.
|
* ranges.
|
||||||
*/
|
*/
|
||||||
typedef struct _VMESTABLISH_GPADL {
|
struct vmestablish_gpadl {
|
||||||
VMPACKET_DESCRIPTOR d;
|
struct vmpacket_descriptor d;
|
||||||
u32 Gpadl;
|
u32 Gpadl;
|
||||||
u32 RangeCount;
|
u32 RangeCount;
|
||||||
GPA_RANGE Range[1];
|
struct gpa_range Range[1];
|
||||||
} __attribute__((packed)) VMESTABLISH_GPADL, *PVMESTABLISH_GPADL;
|
} __attribute__((packed));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the format for a Teardown Gpadl packet, which indicates that the
|
* This is the format for a Teardown Gpadl packet, which indicates that the
|
||||||
* GPADL handle in the Establish Gpadl packet will never be referenced again.
|
* GPADL handle in the Establish Gpadl packet will never be referenced again.
|
||||||
*/
|
*/
|
||||||
typedef struct _VMTEARDOWN_GPADL {
|
struct vmteardown_gpadl {
|
||||||
VMPACKET_DESCRIPTOR d;
|
struct vmpacket_descriptor d;
|
||||||
u32 Gpadl;
|
u32 Gpadl;
|
||||||
u32 Reserved; /* for alignment to a 8-byte boundary */
|
u32 Reserved; /* for alignment to a 8-byte boundary */
|
||||||
} __attribute__((packed)) VMTEARDOWN_GPADL, *PVMTEARDOWN_GPADL;
|
} __attribute__((packed));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the format for a GPA-Direct packet, which contains a set of GPA
|
* This is the format for a GPA-Direct packet, which contains a set of GPA
|
||||||
* ranges, in addition to commands and/or data.
|
* ranges, in addition to commands and/or data.
|
||||||
*/
|
*/
|
||||||
typedef struct _VMDATA_GPA_DIRECT {
|
struct vmdata_gpa_direct {
|
||||||
VMPACKET_DESCRIPTOR d;
|
struct vmpacket_descriptor d;
|
||||||
u32 Reserved;
|
u32 Reserved;
|
||||||
u32 RangeCount;
|
u32 RangeCount;
|
||||||
GPA_RANGE Range[1];
|
struct gpa_range Range[1];
|
||||||
} __attribute__((packed)) VMDATA_GPA_DIRECT, *PVMDATA_GPA_DIRECT;
|
} __attribute__((packed));
|
||||||
|
|
||||||
/* This is the format for a Additional Data Packet. */
|
/* This is the format for a Additional Data Packet. */
|
||||||
typedef struct _VMADDITIONAL_DATA {
|
struct vmadditional_data {
|
||||||
VMPACKET_DESCRIPTOR d;
|
struct vmpacket_descriptor d;
|
||||||
u64 TotalBytes;
|
u64 TotalBytes;
|
||||||
u32 ByteOffset;
|
u32 ByteOffset;
|
||||||
u32 ByteCount;
|
u32 ByteCount;
|
||||||
unsigned char Data[1];
|
unsigned char Data[1];
|
||||||
} __attribute__((packed)) VMADDITIONAL_DATA, *PVMADDITIONAL_DATA;
|
} __attribute__((packed));
|
||||||
|
|
||||||
typedef union {
|
union vmpacket_largest_possible_header {
|
||||||
VMPACKET_DESCRIPTOR SimpleHeader;
|
struct vmpacket_descriptor SimpleHeader;
|
||||||
VMTRANSFER_PAGE_PACKET_HEADER TransferPageHeader;
|
struct vmtransfer_page_packet_header TransferPageHeader;
|
||||||
VMGPADL_PACKET_HEADER GpadlHeader;
|
struct vmgpadl_packet_header GpadlHeader;
|
||||||
VMADD_REMOVE_TRANSFER_PAGE_SET AddRemoveTransferPageHeader;
|
struct vmadd_remove_transfer_page_set AddRemoveTransferPageHeader;
|
||||||
VMESTABLISH_GPADL EstablishGpadlHeader;
|
struct vmestablish_gpadl EstablishGpadlHeader;
|
||||||
VMTEARDOWN_GPADL TeardownGpadlHeader;
|
struct vmteardown_gpadl TeardownGpadlHeader;
|
||||||
VMDATA_GPA_DIRECT DataGpaDirectHeader;
|
struct vmdata_gpa_direct DataGpaDirectHeader;
|
||||||
} VMPACKET_LARGEST_POSSIBLE_HEADER, *PVMPACKET_LARGEST_POSSIBLE_HEADER;
|
};
|
||||||
|
|
||||||
#define VMPACKET_DATA_START_ADDRESS(__packet) \
|
#define VMPACKET_DATA_START_ADDRESS(__packet) \
|
||||||
(void *)(((unsigned char *)__packet) + \
|
(void *)(((unsigned char *)__packet) + \
|
||||||
((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8 * 8)
|
((struct vmpacket_descriptor)__packet)->DataOffset8 * 8)
|
||||||
|
|
||||||
#define VMPACKET_DATA_LENGTH(__packet) \
|
#define VMPACKET_DATA_LENGTH(__packet) \
|
||||||
((((PVMPACKET_DESCRIPTOR)__packet)->Length8 - \
|
((((struct vmpacket_descriptor)__packet)->Length8 - \
|
||||||
((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8) * 8)
|
((struct vmpacket_descriptor)__packet)->DataOffset8) * 8)
|
||||||
|
|
||||||
#define VMPACKET_TRANSFER_MODE(__packet) \
|
#define VMPACKET_TRANSFER_MODE(__packet) \
|
||||||
(((PVMPACKET_DESCRIPTOR)__packet)->Type)
|
(((struct IMPACT)__packet)->Type)
|
||||||
|
|
||||||
typedef enum {
|
enum vmbus_packet_type {
|
||||||
VmbusServerEndpoint = 0,
|
|
||||||
VmbusClientEndpoint,
|
|
||||||
VmbusEndpointMaximum
|
|
||||||
} ENDPOINT_TYPE, *PENDPOINT_TYPE;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
VmbusPacketTypeInvalid = 0x0,
|
VmbusPacketTypeInvalid = 0x0,
|
||||||
VmbusPacketTypeSynch = 0x1,
|
VmbusPacketTypeSynch = 0x1,
|
||||||
VmbusPacketTypeAddTransferPageSet = 0x2,
|
VmbusPacketTypeAddTransferPageSet = 0x2,
|
||||||
|
@ -161,7 +153,7 @@ typedef enum {
|
||||||
VmbusPacketTypeCompletion = 0xb,
|
VmbusPacketTypeCompletion = 0xb,
|
||||||
VmbusPacketTypeDataUsingAdditionalPackets = 0xc,
|
VmbusPacketTypeDataUsingAdditionalPackets = 0xc,
|
||||||
VmbusPacketTypeAdditionalData = 0xd
|
VmbusPacketTypeAdditionalData = 0xd
|
||||||
} VMBUS_PACKET_TYPE, *PVMBUS_PACKET_TYPE;
|
};
|
||||||
|
|
||||||
#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
|
#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
/* the host adapter. */
|
/* the host adapter. */
|
||||||
/* The max transfer length will be published when we offer a vmbus channel. */
|
/* The max transfer length will be published when we offer a vmbus channel. */
|
||||||
#define MAX_TRANSFER_LENGTH 0x40000
|
#define MAX_TRANSFER_LENGTH 0x40000
|
||||||
#define DEFAULT_PACKET_SIZE (sizeof(VMDATA_GPA_DIRECT) + \
|
#define DEFAULT_PACKET_SIZE (sizeof(struct vmdata_gpa_direct) + \
|
||||||
sizeof(struct vstor_packet) + \
|
sizeof(struct vstor_packet) + \
|
||||||
sizesizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE)))
|
sizesizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue