DPRINT_ENTER(NETVSC);
- 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(struct vmtransfer_page_packet_header));
+ DPRINT_DBG(NETVSC, "sizeof(struct hv_netvsc_packet)=%zd, sizeof(struct nvsp_message)=%zd, sizeof(struct vmtransfer_page_packet_header)=%zd",
+ sizeof(struct hv_netvsc_packet), sizeof(struct nvsp_message), sizeof(struct vmtransfer_page_packet_header));
/* Make sure we are at least 2 pages since 1 page is used for control */
ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1));
{
int ret=0;
struct NETVSC_DEVICE *netDevice;
- NVSP_MESSAGE *initPacket;
+ struct nvsp_message *initPacket;
DPRINT_ENTER(NETVSC);
initPacket = &netDevice->ChannelInitPacket;
- memset(initPacket, 0, sizeof(NVSP_MESSAGE));
+ memset(initPacket, 0, sizeof(struct nvsp_message));
initPacket->Header.MessageType = NvspMessage1TypeSendReceiveBuffer;
initPacket->Messages.Version1Messages.SendReceiveBuffer.GpadlHandle = netDevice->ReceiveBufferGpadlHandle;
/* Send the gpadl notification request */
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)initPacket,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
netDevice->ReceiveSectionCount = initPacket->Messages.Version1Messages.SendReceiveBufferComplete.NumSections;
- netDevice->ReceiveSections = kmalloc(netDevice->ReceiveSectionCount * sizeof(NVSP_1_RECEIVE_BUFFER_SECTION), GFP_KERNEL);
+ netDevice->ReceiveSections = kmalloc(netDevice->ReceiveSectionCount * sizeof(struct nvsp_1_receive_buffer_section), GFP_KERNEL);
if (netDevice->ReceiveSections == NULL)
{
ret = -1;
memcpy(netDevice->ReceiveSections,
initPacket->Messages.Version1Messages.SendReceiveBufferComplete.Sections,
- netDevice->ReceiveSectionCount * sizeof(NVSP_1_RECEIVE_BUFFER_SECTION));
+ netDevice->ReceiveSectionCount * sizeof(struct nvsp_1_receive_buffer_section));
DPRINT_INFO(NETVSC,
"Receive sections info (count %d, offset %d, endoffset %d, suballoc size %d, num suballocs %d)",
{
int ret=0;
struct NETVSC_DEVICE *netDevice;
- NVSP_MESSAGE *initPacket;
+ struct nvsp_message *initPacket;
DPRINT_ENTER(NETVSC);
initPacket = &netDevice->ChannelInitPacket;
- memset(initPacket, 0, sizeof(NVSP_MESSAGE));
+ memset(initPacket, 0, sizeof(struct nvsp_message));
initPacket->Header.MessageType = NvspMessage1TypeSendSendBuffer;
initPacket->Messages.Version1Messages.SendReceiveBuffer.GpadlHandle = netDevice->SendBufferGpadlHandle;
/* Send the gpadl notification request */
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)initPacket,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
struct NETVSC_DEVICE *NetDevice
)
{
- NVSP_MESSAGE *revokePacket;
+ struct nvsp_message *revokePacket;
int ret=0;
/* Send the revoke receive buffer */
revokePacket = &NetDevice->RevokePacket;
- memset(revokePacket, 0, sizeof(NVSP_MESSAGE));
+ memset(revokePacket, 0, sizeof(struct nvsp_message));
revokePacket->Header.MessageType = NvspMessage1TypeRevokeReceiveBuffer;
revokePacket->Messages.Version1Messages.RevokeReceiveBuffer.Id = NETVSC_RECEIVE_BUFFER_ID;
ret = NetDevice->Device->Driver->VmbusChannelInterface.SendPacket(NetDevice->Device,
revokePacket,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)revokePacket,
VmbusPacketTypeDataInBand,
0);
struct NETVSC_DEVICE *NetDevice
)
{
- NVSP_MESSAGE *revokePacket;
+ struct nvsp_message *revokePacket;
int ret=0;
/* Send the revoke send buffer */
revokePacket = &NetDevice->RevokePacket;
- memset(revokePacket, 0, sizeof(NVSP_MESSAGE));
+ memset(revokePacket, 0, sizeof(struct nvsp_message));
revokePacket->Header.MessageType = NvspMessage1TypeRevokeSendBuffer;
revokePacket->Messages.Version1Messages.RevokeSendBuffer.Id = NETVSC_SEND_BUFFER_ID;
ret = NetDevice->Device->Driver->VmbusChannelInterface.SendPacket(NetDevice->Device,
revokePacket,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)revokePacket,
VmbusPacketTypeDataInBand,
0);
{
int ret=0;
struct NETVSC_DEVICE *netDevice;
- NVSP_MESSAGE *initPacket;
+ struct nvsp_message *initPacket;
int ndisVersion;
DPRINT_ENTER(NETVSC);
initPacket = &netDevice->ChannelInitPacket;
- memset(initPacket, 0, sizeof(NVSP_MESSAGE));
+ memset(initPacket, 0, sizeof(struct nvsp_message));
initPacket->Header.MessageType = NvspMessageTypeInit;
initPacket->Messages.InitMessages.Init.MinProtocolVersion = NVSP_MIN_PROTOCOL_VERSION;
initPacket->Messages.InitMessages.Init.MaxProtocolVersion = NVSP_MAX_PROTOCOL_VERSION;
/* Send the init request */
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)initPacket,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendNdisVersion...");
/* Send the ndis version */
- memset(initPacket, 0, sizeof(NVSP_MESSAGE));
+ memset(initPacket, 0, sizeof(struct nvsp_message));
ndisVersion = 0x00050000;
/* Send the init request */
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
initPacket,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)initPacket,
VmbusPacketTypeDataInBand,
0);
)
{
struct NETVSC_DEVICE *netDevice;
- NVSP_MESSAGE *nvspPacket;
+ struct nvsp_message *nvspPacket;
struct hv_netvsc_packet *nvscPacket;
DPRINT_ENTER(NETVSC);
return;
}
- nvspPacket = (NVSP_MESSAGE*)((unsigned long)Packet + (Packet->DataOffset8 << 3));
+ nvspPacket = (struct nvsp_message *)((unsigned long)Packet + (Packet->DataOffset8 << 3));
DPRINT_DBG(NETVSC, "send completion packet - type %d", nvspPacket->Header.MessageType);
nvspPacket->Header.MessageType == NvspMessage1TypeSendSendBufferComplete)
{
/* Copy the response back */
- memcpy(&netDevice->ChannelInitPacket, nvspPacket, sizeof(NVSP_MESSAGE));
+ memcpy(&netDevice->ChannelInitPacket, nvspPacket, sizeof(struct nvsp_message));
osd_WaitEventSet(netDevice->ChannelInitEvent);
}
else if (nvspPacket->Header.MessageType == NvspMessage1TypeSendRNDISPacketComplete)
struct NETVSC_DEVICE *netDevice;
int ret=0;
- NVSP_MESSAGE sendMessage;
+ struct nvsp_message sendMessage;
DPRINT_ENTER(NETVSC);
Packet->PageBuffers,
Packet->PageBufferCount,
&sendMessage,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)Packet);
}
else
{
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
&sendMessage,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
(unsigned long)Packet,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
{
struct NETVSC_DEVICE *netDevice;
struct vmtransfer_page_packet_header *vmxferpagePacket;
- NVSP_MESSAGE *nvspPacket;
+ struct nvsp_message *nvspPacket;
struct hv_netvsc_packet *netvscPacket=NULL;
LIST_ENTRY* entry;
unsigned long start;
return;
}
- nvspPacket = (NVSP_MESSAGE*)((unsigned long)Packet + (Packet->DataOffset8 << 3));
+ nvspPacket = (struct nvsp_message*)((unsigned long)Packet + (Packet->DataOffset8 << 3));
/* Make sure this is a valid nvsp packet */
if (nvspPacket->Header.MessageType != NvspMessage1TypeSendRNDISPacket )
u64 TransactionId
)
{
- NVSP_MESSAGE recvcompMessage;
+ struct nvsp_message recvcompMessage;
int retries=0;
int ret=0;
/* Send the completion */
ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
&recvcompMessage,
- sizeof(NVSP_MESSAGE),
+ sizeof(struct nvsp_message),
TransactionId,
VmbusPacketTypeCompletion,
0);
#define NVSP_MIN_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
#define NVSP_MAX_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
-typedef enum _NVSP_MESSAGE_TYPE {
+enum {
NvspMessageTypeNone = 0,
/* Init Messages */
* the maximum number of messages.
*/
NvspNumMessagePerVersion = 9,
-} NVSP_MESSAGE_TYPE, *PNVSP_MESSAGE_TYPE;
+};
-typedef enum _NVSP_STATUS {
+enum {
NvspStatusNone = 0,
NvspStatusSuccess,
NvspStatusFailure,
NvspStatusInvalidRndisPacket,
NvspStatusBusy,
NvspStatusMax,
-} NVSP_STATUS, *PNVSP_STATUS;
+};
-typedef struct _NVSP_MESSAGE_HEADER {
+struct nvsp_message_header {
u32 MessageType;
-} NVSP_MESSAGE_HEADER, *PNVSP_MESSAGE_HEADER;
+};
/* Init Messages */
* has been opened. This message should never include anything other then
* versioning (i.e. this message will be the same for ever).
*/
-typedef struct _NVSP_MESSAGE_INIT {
+struct nvsp_message_init {
u32 MinProtocolVersion;
u32 MaxProtocolVersion;
-} __attribute__((packed)) NVSP_MESSAGE_INIT, *PNVSP_MESSAGE_INIT;
+} __attribute__((packed));
/*
* This message is used by the VSP to complete the initialization of the
* channel. This message should never include anything other then versioning
* (i.e. this message will be the same for ever).
*/
-typedef struct _NVSP_MESSAGE_INIT_COMPLETE {
+struct nvsp_message_init_complete {
u32 NegotiatedProtocolVersion;
u32 MaximumMdlChainLength;
u32 Status;
-} __attribute__((packed)) NVSP_MESSAGE_INIT_COMPLETE, *PNVSP_MESSAGE_INIT_COMPLETE;
+} __attribute__((packed));
-typedef union _NVSP_MESSAGE_INIT_UBER {
- NVSP_MESSAGE_INIT Init;
- NVSP_MESSAGE_INIT_COMPLETE InitComplete;
-} __attribute__((packed)) NVSP_MESSAGE_INIT_UBER;
+union nvsp_message_init_uber {
+ struct nvsp_message_init Init;
+ struct nvsp_message_init_complete InitComplete;
+} __attribute__((packed));
/* Version 1 Messages */
* This message is used by the VSC to send the NDIS version to the VSP. The VSP
* can use this information when handling OIDs sent by the VSC.
*/
-typedef struct _NVSP_1_MESSAGE_SEND_NDIS_VERSION {
+struct nvsp_1_message_send_ndis_version {
u32 NdisMajorVersion;
u32 NdisMinorVersion;
-} __attribute__((packed)) NVSP_1_MESSAGE_SEND_NDIS_VERSION, *PNVSP_1_MESSAGE_SEND_NDIS_VERSION;
+} __attribute__((packed));
/*
* This message is used by the VSC to send a receive buffer to the VSP. The VSP
* can then use the receive buffer to send data to the VSC.
*/
-typedef struct _NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER {
+struct nvsp_1_message_send_receive_buffer {
u32 GpadlHandle;
u16 Id;
-} __attribute__((packed)) NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER, *PNVSP_1_MESSAGE_SEND_RECEIVE_BUFFER;
+} __attribute__((packed));
-typedef struct _NVSP_1_RECEIVE_BUFFER_SECTION {
+struct nvsp_1_receive_buffer_section {
u32 Offset;
u32 SubAllocationSize;
u32 NumSubAllocations;
u32 EndOffset;
-} __attribute__((packed)) NVSP_1_RECEIVE_BUFFER_SECTION, *PNVSP_1_RECEIVE_BUFFER_SECTION;
+} __attribute__((packed));
/*
* This message is used by the VSP to acknowledge a receive buffer send by the
* VSC. This message must be sent by the VSP before the VSP uses the receive
* buffer.
*/
-typedef struct _NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE {
+struct nvsp_1_message_send_receive_buffer_complete {
u32 Status;
u32 NumSections;
* LargeOffset SmallOffset
*/
- NVSP_1_RECEIVE_BUFFER_SECTION Sections[1];
-} __attribute__((packed)) NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE, *PNVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE;
+ struct nvsp_1_receive_buffer_section Sections[1];
+} __attribute__((packed));
/*
* This message is sent by the VSC to revoke the receive buffer. After the VSP
* completes this transaction, the vsp should never use the receive buffer
* again.
*/
-typedef struct _NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER {
+struct nvsp_1_message_revoke_receive_buffer {
u16 Id;
-} NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER, *PNVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER;
+};
/*
* This message is used by the VSC to send a send buffer to the VSP. The VSC
* can then use the send buffer to send data to the VSP.
*/
-typedef struct _NVSP_1_MESSAGE_SEND_SEND_BUFFER {
+struct nvsp_1_message_send_send_buffer {
u32 GpadlHandle;
u16 Id;
-} __attribute__((packed)) NVSP_1_MESSAGE_SEND_SEND_BUFFER, *PNVSP_1_MESSAGE_SEND_SEND_BUFFER;
+} __attribute__((packed));
/*
* This message is used by the VSP to acknowledge a send buffer sent by the
* VSC. This message must be sent by the VSP before the VSP uses the sent
* buffer.
*/
-typedef struct _NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE {
+struct nvsp_1_message_send_send_buffer_complete {
u32 Status;
/*
* decreases.
*/
u32 SectionSize;
-} __attribute__((packed)) NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE, *PNVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE;
+} __attribute__((packed));
/*
* This message is sent by the VSC to revoke the send buffer. After the VSP
* completes this transaction, the vsp should never use the send buffer again.
*/
-typedef struct _NVSP_1_MESSAGE_REVOKE_SEND_BUFFER {
+struct nvsp_1_message_revoke_send_buffer {
u16 Id;
-} NVSP_1_MESSAGE_REVOKE_SEND_BUFFER, *PNVSP_1_MESSAGE_REVOKE_SEND_BUFFER;
+};
/*
* This message is used by both the VSP and the VSC to send a RNDIS message to
* the opposite channel endpoint.
*/
-typedef struct _NVSP_1_MESSAGE_SEND_RNDIS_PACKET {
+struct nvsp_1_message_send_rndis_packet {
/*
* This field is specified by RNIDS. They assume there's two different
* channels of communication. However, the Network VSP only has one.
*/
u32 SendBufferSectionIndex;
u32 SendBufferSectionSize;
-} __attribute__((packed)) NVSP_1_MESSAGE_SEND_RNDIS_PACKET, *PNVSP_1_MESSAGE_SEND_RNDIS_PACKET;
+} __attribute__((packed));
/*
* This message is used by both the VSP and the VSC to complete a RNDIS message
* to the opposite channel endpoint. At this point, the initiator of this
* message cannot use any resources associated with the original RNDIS packet.
*/
-typedef struct _NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE {
+struct nvsp_1_message_send_rndis_packet_complete {
u32 Status;
-} NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE, *PNVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE;
+};
-typedef union _NVSP_MESSAGE_1_UBER {
- NVSP_1_MESSAGE_SEND_NDIS_VERSION SendNdisVersion;
+union nvsp_1_message_uber {
+ struct nvsp_1_message_send_ndis_version SendNdisVersion;
- NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER SendReceiveBuffer;
- NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE SendReceiveBufferComplete;
- NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER RevokeReceiveBuffer;
+ struct nvsp_1_message_send_receive_buffer SendReceiveBuffer;
+ struct nvsp_1_message_send_receive_buffer_complete
+ SendReceiveBufferComplete;
+ struct nvsp_1_message_revoke_receive_buffer RevokeReceiveBuffer;
- NVSP_1_MESSAGE_SEND_SEND_BUFFER SendSendBuffer;
- NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE SendSendBufferComplete;
- NVSP_1_MESSAGE_REVOKE_SEND_BUFFER RevokeSendBuffer;
+ struct nvsp_1_message_send_send_buffer SendSendBuffer;
+ struct nvsp_1_message_send_send_buffer_complete SendSendBufferComplete;
+ struct nvsp_1_message_revoke_send_buffer RevokeSendBuffer;
- NVSP_1_MESSAGE_SEND_RNDIS_PACKET SendRNDISPacket;
- NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE SendRNDISPacketComplete;
-} __attribute__((packed)) NVSP_1_MESSAGE_UBER;
+ struct nvsp_1_message_send_rndis_packet SendRNDISPacket;
+ struct nvsp_1_message_send_rndis_packet_complete
+ SendRNDISPacketComplete;
+} __attribute__((packed));
-typedef union _NVSP_ALL_MESSAGES {
- NVSP_MESSAGE_INIT_UBER InitMessages;
- NVSP_1_MESSAGE_UBER Version1Messages;
-} __attribute__((packed)) NVSP_ALL_MESSAGES;
+union nvsp_all_messages {
+ union nvsp_message_init_uber InitMessages;
+ union nvsp_1_message_uber Version1Messages;
+} __attribute__((packed));
/* ALL Messages */
-typedef struct _NVSP_MESSAGE {
- NVSP_MESSAGE_HEADER Header;
- NVSP_ALL_MESSAGES Messages;
-} __attribute__((packed)) NVSP_MESSAGE, *PNVSP_MESSAGE;
+struct nvsp_message {
+ struct nvsp_message_header Header;
+ union nvsp_all_messages Messages;
+} __attribute__((packed));