Staging: hv: rndis.h: typedef removal, part 1

This removes about half of the typedefs in rndis.h

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2009-08-19 16:26:24 -07:00
parent 88a3716f0c
commit 9f33d05439
3 changed files with 112 additions and 131 deletions

View File

@ -68,13 +68,13 @@ typedef struct _RNDIS_REQUEST {
/* FIXME: We assumed a fixed size response here. If we do ever need to handle a bigger response, */
/* we can either define a max response message or add a response buffer variable above this field */
RNDIS_MESSAGE ResponseMessage;
struct rndis_message ResponseMessage;
/* Simplify allocation by having a netvsc packet inline */
struct hv_netvsc_packet Packet;
PAGE_BUFFER Buffer;
/* FIXME: We assumed a fixed size request here. */
RNDIS_MESSAGE RequestMessage;
struct rndis_message RequestMessage;
} RNDIS_REQUEST;
@ -82,7 +82,7 @@ typedef struct _RNDIS_FILTER_PACKET {
void *CompletionContext;
PFN_ON_SENDRECVCOMPLETION OnCompletion;
RNDIS_MESSAGE Message;
struct rndis_message Message;
} RNDIS_FILTER_PACKET;
@ -94,27 +94,17 @@ RndisFilterSendRequest(
RNDIS_REQUEST *Request
);
static void
RndisFilterReceiveResponse(
RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Response
);
static void RndisFilterReceiveResponse(RNDIS_DEVICE *Device,
struct rndis_message *Response);
static void
RndisFilterReceiveIndicateStatus(
RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Response
);
static void RndisFilterReceiveIndicateStatus(RNDIS_DEVICE *Device,
struct rndis_message *Response);
static void
RndisFilterReceiveData(
RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Message,
struct hv_netvsc_packet *Packet
);
static void RndisFilterReceiveData(RNDIS_DEVICE *Device,
struct rndis_message *Message,
struct hv_netvsc_packet *Packet);
static int
RndisFilterOnReceive(
static int RndisFilterOnReceive(
struct hv_device *Device,
struct hv_netvsc_packet *Packet
);
@ -234,8 +224,8 @@ static inline void PutRndisDevice(RNDIS_DEVICE *Device)
static inline RNDIS_REQUEST* GetRndisRequest(RNDIS_DEVICE *Device, u32 MessageType, u32 MessageLength)
{
RNDIS_REQUEST *request;
RNDIS_MESSAGE *rndisMessage;
RNDIS_SET_REQUEST *set;
struct rndis_message *rndisMessage;
struct rndis_set_request *set;
unsigned long flags;
request = kzalloc(sizeof(RNDIS_REQUEST), GFP_KERNEL);
@ -280,7 +270,7 @@ static inline void PutRndisRequest(RNDIS_DEVICE *Device, RNDIS_REQUEST *Request)
kfree(Request);
}
static inline void DumpRndisMessage(RNDIS_MESSAGE *RndisMessage)
static inline void DumpRndisMessage(struct rndis_message *RndisMessage)
{
switch (RndisMessage->NdisMessageType)
{
@ -373,11 +363,8 @@ RndisFilterSendRequest(
}
static void
RndisFilterReceiveResponse(
RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Response
)
static void RndisFilterReceiveResponse(RNDIS_DEVICE *Device,
struct rndis_message *Response)
{
LIST_ENTRY *anchor;
LIST_ENTRY *curr;
@ -406,7 +393,7 @@ RndisFilterReceiveResponse(
if (found)
{
if (Response->MessageLength <= sizeof(RNDIS_MESSAGE))
if (Response->MessageLength <= sizeof(struct rndis_message))
{
memcpy(&request->ResponseMessage, Response, Response->MessageLength);
}
@ -435,13 +422,10 @@ RndisFilterReceiveResponse(
DPRINT_EXIT(NETVSC);
}
static void
RndisFilterReceiveIndicateStatus(
RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Response
)
static void RndisFilterReceiveIndicateStatus(RNDIS_DEVICE *Device,
struct rndis_message *Response)
{
RNDIS_INDICATE_STATUS *indicate = &Response->Message.IndicateStatus;
struct rndis_indicate_status *indicate = &Response->Message.IndicateStatus;
if (indicate->Status == RNDIS_STATUS_MEDIA_CONNECT)
{
@ -457,20 +441,17 @@ RndisFilterReceiveIndicateStatus(
}
}
static void
RndisFilterReceiveData(
RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Message,
struct hv_netvsc_packet *Packet
)
static void RndisFilterReceiveData(RNDIS_DEVICE *Device,
struct rndis_message *Message,
struct hv_netvsc_packet *Packet)
{
RNDIS_PACKET *rndisPacket;
struct rndis_packet *rndisPacket;
u32 dataOffset;
DPRINT_ENTER(NETVSC);
/* empty ethernet frame ?? */
ASSERT(Packet->PageBuffers[0].Length > RNDIS_MESSAGE_SIZE(RNDIS_PACKET));
ASSERT(Packet->PageBuffers[0].Length > RNDIS_MESSAGE_SIZE(struct rndis_packet));
rndisPacket = &Message->Message.Packet;
@ -499,8 +480,8 @@ RndisFilterOnReceive(
{
struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension;
RNDIS_DEVICE *rndisDevice;
RNDIS_MESSAGE rndisMessage;
RNDIS_MESSAGE *rndisHeader;
struct rndis_message rndisMessage;
struct rndis_message *rndisHeader;
DPRINT_ENTER(NETVSC);
@ -521,7 +502,7 @@ RndisFilterOnReceive(
return -1;
}
rndisHeader = (RNDIS_MESSAGE *)kmap_atomic(pfn_to_page(Packet->PageBuffers[0].Pfn), KM_IRQ0);
rndisHeader = (struct rndis_message *)kmap_atomic(pfn_to_page(Packet->PageBuffers[0].Pfn), KM_IRQ0);
rndisHeader = (void*)((unsigned long)rndisHeader + Packet->PageBuffers[0].Offset);
@ -540,13 +521,13 @@ RndisFilterOnReceive(
}
#endif
if ((rndisHeader->NdisMessageType != REMOTE_NDIS_PACKET_MSG) && (rndisHeader->MessageLength > sizeof(RNDIS_MESSAGE)))
if ((rndisHeader->NdisMessageType != REMOTE_NDIS_PACKET_MSG) && (rndisHeader->MessageLength > sizeof(struct rndis_message)))
{
DPRINT_ERR(NETVSC, "incoming rndis message buffer overflow detected (got %u, max %zu)...marking it an error!",
rndisHeader->MessageLength, sizeof(RNDIS_MESSAGE));
rndisHeader->MessageLength, sizeof(struct rndis_message));
}
memcpy(&rndisMessage, rndisHeader, (rndisHeader->MessageLength > sizeof(RNDIS_MESSAGE))?sizeof(RNDIS_MESSAGE):rndisHeader->MessageLength);
memcpy(&rndisMessage, rndisHeader, (rndisHeader->MessageLength > sizeof(struct rndis_message))?sizeof(struct rndis_message):rndisHeader->MessageLength);
kunmap_atomic(rndisHeader - Packet->PageBuffers[0].Offset, KM_IRQ0);
@ -592,8 +573,8 @@ RndisFilterQueryDevice(
{
RNDIS_REQUEST *request;
u32 inresultSize = *ResultSize;
RNDIS_QUERY_REQUEST *query;
RNDIS_QUERY_COMPLETE *queryComplete;
struct rndis_query_request *query;
struct rndis_query_complete *queryComplete;
int ret=0;
DPRINT_ENTER(NETVSC);
@ -601,7 +582,7 @@ RndisFilterQueryDevice(
ASSERT(Result);
*ResultSize = 0;
request = GetRndisRequest(Device, REMOTE_NDIS_QUERY_MSG, RNDIS_MESSAGE_SIZE(RNDIS_QUERY_REQUEST));
request = GetRndisRequest(Device, REMOTE_NDIS_QUERY_MSG, RNDIS_MESSAGE_SIZE(struct rndis_query_request));
if (!request)
{
ret = -1;
@ -611,7 +592,7 @@ RndisFilterQueryDevice(
/* Setup the rndis query */
query = &request->RequestMessage.Message.QueryRequest;
query->Oid = Oid;
query->InformationBufferOffset = sizeof(RNDIS_QUERY_REQUEST);
query->InformationBufferOffset = sizeof(struct rndis_query_request);
query->InformationBufferLength = 0;
query->DeviceVcHandle = 0;
@ -681,16 +662,16 @@ RndisFilterSetPacketFilter(
)
{
RNDIS_REQUEST *request;
RNDIS_SET_REQUEST *set;
RNDIS_SET_COMPLETE *setComplete;
struct rndis_set_request *set;
struct rndis_set_complete *setComplete;
u32 status;
int ret;
DPRINT_ENTER(NETVSC);
ASSERT(RNDIS_MESSAGE_SIZE(RNDIS_SET_REQUEST) + sizeof(u32) <= sizeof(RNDIS_MESSAGE));
ASSERT(RNDIS_MESSAGE_SIZE(struct rndis_set_request) + sizeof(u32) <= sizeof(struct rndis_message));
request = GetRndisRequest(Device, REMOTE_NDIS_SET_MSG, RNDIS_MESSAGE_SIZE(RNDIS_SET_REQUEST) + sizeof(u32));
request = GetRndisRequest(Device, REMOTE_NDIS_SET_MSG, RNDIS_MESSAGE_SIZE(struct rndis_set_request) + sizeof(u32));
if (!request)
{
ret = -1;
@ -701,9 +682,9 @@ RndisFilterSetPacketFilter(
set = &request->RequestMessage.Message.SetRequest;
set->Oid = RNDIS_OID_GEN_CURRENT_PACKET_FILTER;
set->InformationBufferLength = sizeof(u32);
set->InformationBufferOffset = sizeof(RNDIS_SET_REQUEST);
set->InformationBufferOffset = sizeof(struct rndis_set_request);
memcpy((void*)(unsigned long)set + sizeof(RNDIS_SET_REQUEST), &NewFilter, sizeof(u32));
memcpy((void*)(unsigned long)set + sizeof(struct rndis_set_request), &NewFilter, sizeof(u32));
ret = RndisFilterSendRequest(Device, request);
if (ret != 0)
@ -793,14 +774,14 @@ RndisFilterInitDevice(
)
{
RNDIS_REQUEST *request;
RNDIS_INITIALIZE_REQUEST *init;
RNDIS_INITIALIZE_COMPLETE *initComplete;
struct rndis_initialize_request *init;
struct rndis_initialize_complete *initComplete;
u32 status;
int ret;
DPRINT_ENTER(NETVSC);
request = GetRndisRequest(Device, REMOTE_NDIS_INITIALIZE_MSG, RNDIS_MESSAGE_SIZE(RNDIS_INITIALIZE_REQUEST));
request = GetRndisRequest(Device, REMOTE_NDIS_INITIALIZE_MSG, RNDIS_MESSAGE_SIZE(struct rndis_initialize_request));
if (!request)
{
ret = -1;
@ -853,12 +834,12 @@ RndisFilterHaltDevice(
)
{
RNDIS_REQUEST *request;
RNDIS_HALT_REQUEST *halt;
struct rndis_halt_request *halt;
DPRINT_ENTER(NETVSC);
/* Attempt to do a rndis device halt */
request = GetRndisRequest(Device, REMOTE_NDIS_HALT_MSG, RNDIS_MESSAGE_SIZE(RNDIS_HALT_REQUEST));
request = GetRndisRequest(Device, REMOTE_NDIS_HALT_MSG, RNDIS_MESSAGE_SIZE(struct rndis_halt_request));
if (!request)
{
goto Cleanup;
@ -1088,8 +1069,8 @@ RndisFilterOnSend(
{
int ret=0;
RNDIS_FILTER_PACKET *filterPacket;
RNDIS_MESSAGE *rndisMessage;
RNDIS_PACKET *rndisPacket;
struct rndis_message *rndisMessage;
struct rndis_packet *rndisPacket;
u32 rndisMessageSize;
DPRINT_ENTER(NETVSC);
@ -1101,13 +1082,13 @@ RndisFilterOnSend(
memset(filterPacket, 0, sizeof(RNDIS_FILTER_PACKET));
rndisMessage = &filterPacket->Message;
rndisMessageSize = RNDIS_MESSAGE_SIZE(RNDIS_PACKET);
rndisMessageSize = RNDIS_MESSAGE_SIZE(struct rndis_packet);
rndisMessage->NdisMessageType = REMOTE_NDIS_PACKET_MSG;
rndisMessage->MessageLength = Packet->TotalDataBufferLength + rndisMessageSize;
rndisPacket = &rndisMessage->Message.Packet;
rndisPacket->DataOffset = sizeof(RNDIS_PACKET);
rndisPacket->DataOffset = sizeof(struct rndis_packet);
rndisPacket->DataLength = Packet->TotalDataBufferLength;
Packet->IsDataPacket = true;

View File

@ -31,8 +31,8 @@
#include "rndis.h"
#define RNDIS_HEADER_SIZE (sizeof(RNDIS_MESSAGE) - \
sizeof(RNDIS_MESSAGE_CONTAINER))
#define RNDIS_HEADER_SIZE (sizeof(struct rndis_message) - \
sizeof(union rndis_message_container))
#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
#define NDIS_PACKET_TYPE_MULTICAST 0x00000002

View File

@ -282,7 +282,7 @@
*/
#define REMOTE_NDIS_BUS_MSG 0xff000001
/* Defines for DeviceFlags in RNDIS_INITIALIZE_COMPLETE */
/* Defines for DeviceFlags in struct rndis_initialize_complete */
#define RNDIS_DF_CONNECTIONLESS 0x00000001
#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
#define RNDIS_DF_RAW_DATA 0x00000004
@ -313,15 +313,15 @@
/* NdisInitialize message */
typedef struct _RNDIS_INITIALIZE_REQUEST {
struct rndis_initialize_request {
u32 RequestId;
u32 MajorVersion;
u32 MinorVersion;
u32 MaxTransferSize;
} RNDIS_INITIALIZE_REQUEST, *PRNDIS_INITIALIZE_REQUEST;
};
/* Response to NdisInitialize */
typedef struct _RNDIS_INITIALIZE_COMPLETE {
struct rndis_initialize_complete {
u32 RequestId;
u32 Status;
u32 MajorVersion;
@ -333,95 +333,95 @@ typedef struct _RNDIS_INITIALIZE_COMPLETE {
u32 PacketAlignmentFactor;
u32 AFListOffset;
u32 AFListSize;
} RNDIS_INITIALIZE_COMPLETE, *PRNDIS_INITIALIZE_COMPLETE;
};
/* Call manager devices only: Information about an address family */
/* supported by the device is appended to the response to NdisInitialize. */
typedef struct _RNDIS_CO_ADDRESS_FAMILY {
struct rndis_co_address_family {
u32 AddressFamily;
u32 MajorVersion;
u32 MinorVersion;
} RNDIS_CO_ADDRESS_FAMILY, *PRNDIS_CO_ADDRESS_FAMILY;
};
/* NdisHalt message */
typedef struct _RNDIS_HALT_REQUEST {
struct rndis_halt_request {
u32 RequestId;
} RNDIS_HALT_REQUEST, *PRNDIS_HALT_REQUEST;
};
/* NdisQueryRequest message */
typedef struct _RNDIS_QUERY_REQUEST {
struct rndis_query_request {
u32 RequestId;
u32 Oid;
u32 InformationBufferLength;
u32 InformationBufferOffset;
u32 DeviceVcHandle;
} RNDIS_QUERY_REQUEST, *PRNDIS_QUERY_REQUEST;
};
/* Response to NdisQueryRequest */
typedef struct _RNDIS_QUERY_COMPLETE {
struct rndis_query_complete {
u32 RequestId;
u32 Status;
u32 InformationBufferLength;
u32 InformationBufferOffset;
} RNDIS_QUERY_COMPLETE, *PRNDIS_QUERY_COMPLETE;
};
/* NdisSetRequest message */
typedef struct _RNDIS_SET_REQUEST {
struct rndis_set_request {
u32 RequestId;
u32 Oid;
u32 InformationBufferLength;
u32 InformationBufferOffset;
u32 DeviceVcHandle;
} RNDIS_SET_REQUEST, *PRNDIS_SET_REQUEST;
};
/* Response to NdisSetRequest */
typedef struct _RNDIS_SET_COMPLETE {
struct rndis_set_complete {
u32 RequestId;
u32 Status;
} RNDIS_SET_COMPLETE, *PRNDIS_SET_COMPLETE;
};
/* NdisReset message */
typedef struct _RNDIS_RESET_REQUEST {
struct rndis_reset_request {
u32 Reserved;
} RNDIS_RESET_REQUEST, *PRNDIS_RESET_REQUEST;
};
/* Response to NdisReset */
typedef struct _RNDIS_RESET_COMPLETE {
struct rndis_reset_complete {
u32 Status;
u32 AddressingReset;
} RNDIS_RESET_COMPLETE, *PRNDIS_RESET_COMPLETE;
};
/* NdisMIndicateStatus message */
typedef struct _RNDIS_INDICATE_STATUS {
struct rndis_indicate_status {
u32 Status;
u32 StatusBufferLength;
u32 StatusBufferOffset;
} RNDIS_INDICATE_STATUS, *PRNDIS_INDICATE_STATUS;
};
/* Diagnostic information passed as the status buffer in */
/* RNDIS_INDICATE_STATUS messages signifying error conditions. */
/* struct rndis_indicate_status messages signifying error conditions. */
typedef struct _RNDIS_DIAGNOSTIC_INFO {
u32 DiagStatus;
u32 ErrorOffset;
} RNDIS_DIAGNOSTIC_INFO, *PRNDIS_DIAGNOSTIC_INFO;
/* NdisKeepAlive message */
typedef struct _RNDIS_KEEPALIVE_REQUEST {
struct rndis_keepalive_request {
u32 RequestId;
} RNDIS_KEEPALIVE_REQUEST, *PRNDIS_KEEPALIVE_REQUEST;
};
/* Response to NdisKeepAlive */
typedef struct _RNDIS_KEEPALIVE_COMPLETE {
struct rndis_keepalive_complete {
u32 RequestId;
u32 Status;
} RNDIS_KEEPALIVE_COMPLETE, *PRNDIS_KEEPALIVE_COMPLETE;
};
/*
* Data message. All Offset fields contain byte offsets from the beginning of
* the RNDIS_PACKET structure. All Length fields are in bytes. VcHandle is set
* struct rndis_packet. All Length fields are in bytes. VcHandle is set
* to 0 for connectionless data, otherwise it contains the VC handle.
*/
typedef struct _RNDIS_PACKET {
struct rndis_packet {
u32 DataOffset;
u32 DataLength;
u32 OOBDataOffset;
@ -431,33 +431,33 @@ typedef struct _RNDIS_PACKET {
u32 PerPacketInfoLength;
u32 VcHandle;
u32 Reserved;
} RNDIS_PACKET, *PRNDIS_PACKET;
};
/* Optional Out of Band data associated with a Data message. */
typedef struct _RNDIS_OOBD {
struct rndis_oobd {
u32 Size;
u32 Type;
u32 ClassInformationOffset;
} RNDIS_OOBD, *PRNDIS_OOBD;
};
/* Packet extension field contents associated with a Data message. */
typedef struct _RNDIS_PER_PACKET_INFO {
struct rndis_per_packet_info {
u32 Size;
u32 Type;
u32 PerPacketInformationOffset;
} RNDIS_PER_PACKET_INFO, *PRNDIS_PER_PACKET_INFO;
};
/* Format of Information buffer passed in a SetRequest for the OID */
/* OID_GEN_RNDIS_CONFIG_PARAMETER. */
typedef struct _RNDIS_CONFIG_PARAMETER_INFO {
struct rndis_config_parameter_info {
u32 ParameterNameOffset;
u32 ParameterNameLength;
u32 ParameterType;
u32 ParameterValueOffset;
u32 ParameterValueLength;
} RNDIS_CONFIG_PARAMETER_INFO, *PRNDIS_CONFIG_PARAMETER_INFO;
};
/* Values for ParameterType in RNDIS_CONFIG_PARAMETER_INFO */
/* Values for ParameterType in struct rndis_config_parameter_info */
#define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
#define RNDIS_CONFIG_PARAM_TYPE_STRING 2
@ -580,20 +580,20 @@ typedef struct _RCONDIS_MP_DEACTIVATE_VC_COMPLETE {
/* union with all of the RNDIS messages */
typedef union _RNDIS_MESSAGE_CONTAINER {
RNDIS_PACKET Packet;
RNDIS_INITIALIZE_REQUEST InitializeRequest;
RNDIS_HALT_REQUEST HaltRequest;
RNDIS_QUERY_REQUEST QueryRequest;
RNDIS_SET_REQUEST SetRequest;
RNDIS_RESET_REQUEST ResetRequest;
RNDIS_KEEPALIVE_REQUEST KeepaliveRequest;
RNDIS_INDICATE_STATUS IndicateStatus;
RNDIS_INITIALIZE_COMPLETE InitializeComplete;
RNDIS_QUERY_COMPLETE QueryComplete;
RNDIS_SET_COMPLETE SetComplete;
RNDIS_RESET_COMPLETE ResetComplete;
RNDIS_KEEPALIVE_COMPLETE KeepaliveComplete;
union rndis_message_container {
struct rndis_packet Packet;
struct rndis_initialize_request InitializeRequest;
struct rndis_halt_request HaltRequest;
struct rndis_query_request QueryRequest;
struct rndis_set_request SetRequest;
struct rndis_reset_request ResetRequest;
struct rndis_keepalive_request KeepaliveRequest;
struct rndis_indicate_status IndicateStatus;
struct rndis_initialize_complete InitializeComplete;
struct rndis_query_complete QueryComplete;
struct rndis_set_complete SetComplete;
struct rndis_reset_complete ResetComplete;
struct rndis_keepalive_complete KeepaliveComplete;
RCONDIS_MP_CREATE_VC CoMiniportCreateVc;
RCONDIS_MP_DELETE_VC CoMiniportDeleteVc;
RCONDIS_INDICATE_STATUS CoIndicateStatus;
@ -603,27 +603,27 @@ typedef union _RNDIS_MESSAGE_CONTAINER {
RCONDIS_MP_DELETE_VC_COMPLETE CoMiniportDeleteVcComplete;
RCONDIS_MP_ACTIVATE_VC_COMPLETE CoMiniportActivateVcComplete;
RCONDIS_MP_DEACTIVATE_VC_COMPLETE CoMiniportDeactivateVcComplete;
} RNDIS_MESSAGE_CONTAINER, *PRNDIS_MESSAGE_CONTAINER;
};
/* Remote NDIS message format */
typedef __struct_bcount(MessageLength) struct _RNDIS_MESSAGE {
struct rndis_message {
u32 NdisMessageType;
/* Total length of this message, from the beginning */
/* of the RNDIS_MESSAGE struct, in bytes. */
/* of the sruct rndis_message, in bytes. */
u32 MessageLength;
/* Actual message */
RNDIS_MESSAGE_CONTAINER Message;
} RNDIS_MESSAGE, *PRNDIS_MESSAGE;
union rndis_message_container Message;
};
/* Handy macros */
/* get the size of an RNDIS message. Pass in the message type, */
/* RNDIS_SET_REQUEST, RNDIS_PACKET for example */
/* struct rndis_set_request, struct rndis_packet for example */
#define RNDIS_MESSAGE_SIZE(Message) \
(sizeof(Message) + (sizeof(RNDIS_MESSAGE) - \
sizeof(RNDIS_MESSAGE_CONTAINER)))
(sizeof(Message) + (sizeof(struct rndis_message) - \
sizeof(union rndis_message_container)))
/* get pointer to info buffer with message pointer */
#define MESSAGE_TO_INFO_BUFFER(Message) \