/* Data types */
-
-
-typedef struct _RNDIS_FILTER_DRIVER_OBJECT {
+struct rndis_filter_driver_object {
/* The original driver */
struct netvsc_driver InnerDriver;
+};
-} RNDIS_FILTER_DRIVER_OBJECT;
-
-typedef enum {
+enum rndis_device_state {
RNDIS_DEV_UNINITIALIZED = 0,
RNDIS_DEV_INITIALIZING,
RNDIS_DEV_INITIALIZED,
RNDIS_DEV_DATAINITIALIZED,
-} RNDIS_DEVICE_STATE;
+};
-typedef struct _RNDIS_DEVICE {
+struct rndis_device {
struct NETVSC_DEVICE *NetDevice;
- RNDIS_DEVICE_STATE State;
+ enum rndis_device_state State;
u32 LinkStatus;
atomic_t NewRequestId;
LIST_ENTRY RequestList;
unsigned char HwMacAddr[HW_MACADDR_LEN];
-} RNDIS_DEVICE;
+};
-typedef struct _RNDIS_REQUEST {
+struct rndis_request {
LIST_ENTRY ListEntry;
struct osd_waitevent *WaitEvent;
struct hv_page_buffer Buffer;
/* FIXME: We assumed a fixed size request here. */
struct rndis_message RequestMessage;
-} RNDIS_REQUEST;
+};
-typedef struct _RNDIS_FILTER_PACKET {
+struct rndis_filter_packet {
void *CompletionContext;
PFN_ON_SENDRECVCOMPLETION OnCompletion;
struct rndis_message Message;
-} RNDIS_FILTER_PACKET;
+};
/* Internal routines */
static int
RndisFilterSendRequest(
- RNDIS_DEVICE *Device,
- RNDIS_REQUEST *Request
+ struct rndis_device *Device,
+ struct rndis_request *Request
);
-static void RndisFilterReceiveResponse(RNDIS_DEVICE *Device,
+static void RndisFilterReceiveResponse(struct rndis_device *Device,
struct rndis_message *Response);
-static void RndisFilterReceiveIndicateStatus(RNDIS_DEVICE *Device,
+static void RndisFilterReceiveIndicateStatus(struct rndis_device *Device,
struct rndis_message *Response);
-static void RndisFilterReceiveData(RNDIS_DEVICE *Device,
+static void RndisFilterReceiveData(struct rndis_device *Device,
struct rndis_message *Message,
struct hv_netvsc_packet *Packet);
static int
RndisFilterQueryDevice(
- RNDIS_DEVICE *Device,
+ struct rndis_device *Device,
u32 Oid,
void *Result,
u32 *ResultSize
static inline int
RndisFilterQueryDeviceMac(
- RNDIS_DEVICE *Device
+ struct rndis_device *Device
);
static inline int
RndisFilterQueryDeviceLinkStatus(
- RNDIS_DEVICE *Device
+ struct rndis_device *Device
);
static int
RndisFilterSetPacketFilter(
- RNDIS_DEVICE *Device,
+ struct rndis_device *Device,
u32 NewFilter
);
static int
RndisFilterInitDevice(
- RNDIS_DEVICE *Device
+ struct rndis_device *Device
);
static int
RndisFilterOpenDevice(
- RNDIS_DEVICE *Device
+ struct rndis_device *Device
);
static int
RndisFilterCloseDevice(
- RNDIS_DEVICE *Device
+ struct rndis_device *Device
);
static int
/* The one and only */
-static RNDIS_FILTER_DRIVER_OBJECT gRndisFilter;
+static struct rndis_filter_driver_object gRndisFilter;
-static inline RNDIS_DEVICE* GetRndisDevice(void)
+static inline struct rndis_device *GetRndisDevice(void)
{
- RNDIS_DEVICE *device;
+ struct rndis_device *device;
- device = kzalloc(sizeof(RNDIS_DEVICE), GFP_KERNEL);
+ device = kzalloc(sizeof(struct rndis_device), GFP_KERNEL);
if (!device)
{
return NULL;
return device;
}
-static inline void PutRndisDevice(RNDIS_DEVICE *Device)
+static inline void PutRndisDevice(struct rndis_device *Device)
{
kfree(Device);
}
-static inline RNDIS_REQUEST* GetRndisRequest(RNDIS_DEVICE *Device, u32 MessageType, u32 MessageLength)
+static inline struct rndis_request *GetRndisRequest(struct rndis_device *Device, u32 MessageType, u32 MessageLength)
{
- RNDIS_REQUEST *request;
+ struct rndis_request *request;
struct rndis_message *rndisMessage;
struct rndis_set_request *set;
unsigned long flags;
- request = kzalloc(sizeof(RNDIS_REQUEST), GFP_KERNEL);
+ request = kzalloc(sizeof(struct rndis_request), GFP_KERNEL);
if (!request)
{
return NULL;
return request;
}
-static inline void PutRndisRequest(RNDIS_DEVICE *Device, RNDIS_REQUEST *Request)
+static inline void PutRndisRequest(struct rndis_device *Device, struct rndis_request *Request)
{
unsigned long flags;
static int
RndisFilterSendRequest(
- RNDIS_DEVICE *Device,
- RNDIS_REQUEST *Request
+ struct rndis_device *Device,
+ struct rndis_request *Request
)
{
int ret=0;
}
-static void RndisFilterReceiveResponse(RNDIS_DEVICE *Device,
+static void RndisFilterReceiveResponse(struct rndis_device *Device,
struct rndis_message *Response)
{
LIST_ENTRY *anchor;
LIST_ENTRY *curr;
- RNDIS_REQUEST *request=NULL;
+ struct rndis_request *request = NULL;
bool found = false;
unsigned long flags;
spin_lock_irqsave(&Device->request_lock, flags);
ITERATE_LIST_ENTRIES(anchor, curr, &Device->RequestList)
{
- request = CONTAINING_RECORD(curr, RNDIS_REQUEST, ListEntry);
+ request = CONTAINING_RECORD(curr, struct rndis_request, ListEntry);
/* All request/response message contains RequestId as the 1st field */
if (request->RequestMessage.Message.InitializeRequest.RequestId == Response->Message.InitializeComplete.RequestId)
}
else
{
- DPRINT_ERR(NETVSC, "rndis response buffer overflow detected (size %u max %zu)", Response->MessageLength, sizeof(RNDIS_FILTER_PACKET));
+ DPRINT_ERR(NETVSC, "rndis response buffer overflow detected (size %u max %zu)", Response->MessageLength, sizeof(struct rndis_filter_packet));
if (Response->NdisMessageType == REMOTE_NDIS_RESET_CMPLT) /* does not have a request id field */
{
DPRINT_EXIT(NETVSC);
}
-static void RndisFilterReceiveIndicateStatus(RNDIS_DEVICE *Device,
+static void RndisFilterReceiveIndicateStatus(struct rndis_device *Device,
struct rndis_message *Response)
{
struct rndis_indicate_status *indicate = &Response->Message.IndicateStatus;
}
}
-static void RndisFilterReceiveData(RNDIS_DEVICE *Device,
+static void RndisFilterReceiveData(struct rndis_device *Device,
struct rndis_message *Message,
struct hv_netvsc_packet *Packet)
{
)
{
struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension;
- RNDIS_DEVICE *rndisDevice;
+ struct rndis_device *rndisDevice;
struct rndis_message rndisMessage;
struct rndis_message *rndisHeader;
return -1;
}
- rndisDevice = (RNDIS_DEVICE*)netDevice->Extension;
+ rndisDevice = (struct rndis_device*)netDevice->Extension;
if (rndisDevice->State == RNDIS_DEV_UNINITIALIZED)
{
DPRINT_ERR(NETVSC, "got rndis message but rndis device uninitialized...dropping this message!");
static int
RndisFilterQueryDevice(
- RNDIS_DEVICE *Device,
+ struct rndis_device *Device,
u32 Oid,
void *Result,
u32 *ResultSize
)
{
- RNDIS_REQUEST *request;
+ struct rndis_request *request;
u32 inresultSize = *ResultSize;
struct rndis_query_request *query;
struct rndis_query_complete *queryComplete;
return ret;
}
-static inline int
-RndisFilterQueryDeviceMac(
- RNDIS_DEVICE *Device
- )
+static inline int RndisFilterQueryDeviceMac(struct rndis_device *Device)
{
u32 size=HW_MACADDR_LEN;
&size);
}
-static inline int
-RndisFilterQueryDeviceLinkStatus(
- RNDIS_DEVICE *Device
- )
+static inline int RndisFilterQueryDeviceLinkStatus(struct rndis_device *Device)
{
u32 size=sizeof(u32);
static int
RndisFilterSetPacketFilter(
- RNDIS_DEVICE *Device,
+ struct rndis_device *Device,
u32 NewFilter
)
{
- RNDIS_REQUEST *request;
+ struct rndis_request *request;
struct rndis_set_request *set;
struct rndis_set_complete *setComplete;
u32 status;
{
DPRINT_ENTER(NETVSC);
- DPRINT_DBG(NETVSC, "sizeof(RNDIS_FILTER_PACKET) == %zd", sizeof(RNDIS_FILTER_PACKET));
+ DPRINT_DBG(NETVSC, "sizeof(struct rndis_filter_packet) == %zd", sizeof(struct rndis_filter_packet));
- Driver->RequestExtSize = sizeof(RNDIS_FILTER_PACKET);
+ Driver->RequestExtSize = sizeof(struct rndis_filter_packet);
Driver->AdditionalRequestPageBufferCount = 1; /* For rndis header */
/* Driver->Context = rndisDriver; */
- memset(&gRndisFilter, 0, sizeof(RNDIS_FILTER_DRIVER_OBJECT));
+ memset(&gRndisFilter, 0, sizeof(struct rndis_filter_driver_object));
/*rndisDriver->Driver = Driver;
return 0;
}
-static int
-RndisFilterInitDevice(
- RNDIS_DEVICE *Device
- )
+static int RndisFilterInitDevice(struct rndis_device *Device)
{
- RNDIS_REQUEST *request;
+ struct rndis_request *request;
struct rndis_initialize_request *init;
struct rndis_initialize_complete *initComplete;
u32 status;
return ret;
}
-static void
-RndisFilterHaltDevice(
- RNDIS_DEVICE *Device
- )
+static void RndisFilterHaltDevice(struct rndis_device *Device)
{
- RNDIS_REQUEST *request;
+ struct rndis_request *request;
struct rndis_halt_request *halt;
DPRINT_ENTER(NETVSC);
}
-static int
-RndisFilterOpenDevice(
- RNDIS_DEVICE *Device
- )
+static int RndisFilterOpenDevice(struct rndis_device *Device)
{
int ret=0;
return ret;
}
-static int
-RndisFilterCloseDevice(
- RNDIS_DEVICE *Device
- )
+static int RndisFilterCloseDevice(struct rndis_device *Device)
{
int ret;
{
int ret;
struct NETVSC_DEVICE *netDevice;
- RNDIS_DEVICE *rndisDevice;
+ struct rndis_device *rndisDevice;
struct netvsc_device_info *deviceInfo = (struct netvsc_device_info *)AdditionalInfo;
DPRINT_ENTER(NETVSC);
)
{
struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension;
- RNDIS_DEVICE *rndisDevice = (RNDIS_DEVICE*)netDevice->Extension;
+ struct rndis_device *rndisDevice = (struct rndis_device *)netDevice->Extension;
DPRINT_ENTER(NETVSC);
DPRINT_ENTER(NETVSC);
ASSERT(netDevice);
- ret = RndisFilterOpenDevice((RNDIS_DEVICE*)netDevice->Extension);
+ ret = RndisFilterOpenDevice((struct rndis_device *)netDevice->Extension);
DPRINT_EXIT(NETVSC);
DPRINT_ENTER(NETVSC);
ASSERT(netDevice);
- ret = RndisFilterCloseDevice((RNDIS_DEVICE*)netDevice->Extension);
+ ret = RndisFilterCloseDevice((struct rndis_device *)netDevice->Extension);
DPRINT_EXIT(NETVSC);
)
{
int ret=0;
- RNDIS_FILTER_PACKET *filterPacket;
+ struct rndis_filter_packet *filterPacket;
struct rndis_message *rndisMessage;
struct rndis_packet *rndisPacket;
u32 rndisMessageSize;
DPRINT_ENTER(NETVSC);
/* Add the rndis header */
- filterPacket = (RNDIS_FILTER_PACKET*)Packet->Extension;
+ filterPacket = (struct rndis_filter_packet *)Packet->Extension;
ASSERT(filterPacket);
- memset(filterPacket, 0, sizeof(RNDIS_FILTER_PACKET));
+ memset(filterPacket, 0, sizeof(struct rndis_filter_packet));
rndisMessage = &filterPacket->Message;
rndisMessageSize = RNDIS_MESSAGE_SIZE(struct rndis_packet);
RndisFilterOnSendCompletion(
void *Context)
{
- RNDIS_FILTER_PACKET *filterPacket = (RNDIS_FILTER_PACKET *)Context;
+ struct rndis_filter_packet *filterPacket = (struct rndis_filter_packet *)Context;
DPRINT_ENTER(NETVSC);