/*
* Copyright (c) 2009, Microsoft Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
*
* Authors:
* Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com>
*/
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/slab.h>
#include "osd.h"
#include "logging.h"
#include "netvsc.h"
#include "rndis_filter.h"
/* Globals */
static const char *gDriverName = "netvsc";
/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */
static const struct hv_guid gNetVscDeviceType = {
.data = {
0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46,
0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E
}
};
static int NetVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo);
static int NetVscOnDeviceRemove(struct hv_device *Device);
static void NetVscOnCleanup(struct hv_driver *Driver);
static void NetVscOnChannelCallback(void *context);
static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device);
static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device);
static int NetVscDestroySendBuffer(struct netvsc_device *NetDevice);
static int NetVscDestroyReceiveBuffer(struct netvsc_device *NetDevice);
static int NetVscConnectToVsp(struct hv_device *Device);
static void NetVscOnSendCompletion(struct hv_device *Device,
struct vmpacket_descriptor *Packet);
static int NetVscOnSend(struct hv_device